More javadocs cleanup
This commit is contained in:
parent
e4ed551490
commit
3e31af68e4
@ -102,21 +102,21 @@ public abstract class AbstractBootstrap<B extends AbstractBootstrap<?>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See {@link #localAddress(SocketAddress)}
|
* @see {@link #localAddress(SocketAddress)}
|
||||||
*/
|
*/
|
||||||
public B localAddress(int port) {
|
public B localAddress(int port) {
|
||||||
return localAddress(new InetSocketAddress(port));
|
return localAddress(new InetSocketAddress(port));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See {@link #localAddress(SocketAddress)}
|
* @see {@link #localAddress(SocketAddress)}
|
||||||
*/
|
*/
|
||||||
public B localAddress(String host, int port) {
|
public B localAddress(String host, int port) {
|
||||||
return localAddress(new InetSocketAddress(host, port));
|
return localAddress(new InetSocketAddress(host, port));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See {@link #localAddress(SocketAddress)}
|
* @see {@link #localAddress(SocketAddress)}
|
||||||
*/
|
*/
|
||||||
public B localAddress(InetAddress host, int port) {
|
public B localAddress(InetAddress host, int port) {
|
||||||
return localAddress(new InetSocketAddress(host, port));
|
return localAddress(new InetSocketAddress(host, port));
|
||||||
@ -249,6 +249,7 @@ public abstract class AbstractBootstrap<B extends AbstractBootstrap<?>> {
|
|||||||
return attrs;
|
return attrs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
buf.append(getClass().getSimpleName());
|
buf.append(getClass().getSimpleName());
|
||||||
@ -308,6 +309,7 @@ public abstract class AbstractBootstrap<B extends AbstractBootstrap<?>> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return clazz.getSimpleName() + ".class";
|
return clazz.getSimpleName() + ".class";
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ public class Bootstrap extends AbstractBootstrap<Bootstrap> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See {@link #remoteAddress(SocketAddress)}
|
* @see {@link #remoteAddress(SocketAddress)}
|
||||||
*/
|
*/
|
||||||
public Bootstrap remoteAddress(String host, int port) {
|
public Bootstrap remoteAddress(String host, int port) {
|
||||||
remoteAddress = new InetSocketAddress(host, port);
|
remoteAddress = new InetSocketAddress(host, port);
|
||||||
@ -58,7 +58,7 @@ public class Bootstrap extends AbstractBootstrap<Bootstrap> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See {@link #remoteAddress(SocketAddress)}
|
* @see {@link #remoteAddress(SocketAddress)}
|
||||||
*/
|
*/
|
||||||
public Bootstrap remoteAddress(InetAddress host, int port) {
|
public Bootstrap remoteAddress(InetAddress host, int port) {
|
||||||
remoteAddress = new InetSocketAddress(host, port);
|
remoteAddress = new InetSocketAddress(host, port);
|
||||||
@ -96,7 +96,7 @@ public class Bootstrap extends AbstractBootstrap<Bootstrap> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See {@link #connect()}
|
* @see {@link #connect()}
|
||||||
*/
|
*/
|
||||||
public ChannelFuture connect(ChannelFuture future) {
|
public ChannelFuture connect(ChannelFuture future) {
|
||||||
validate(future);
|
validate(future);
|
||||||
@ -166,6 +166,8 @@ public class Bootstrap extends AbstractBootstrap<Bootstrap> {
|
|||||||
/**
|
/**
|
||||||
* Create a new {@link Bootstrap} which has the identical configuration with this {@link Bootstrap}.
|
* Create a new {@link Bootstrap} which has the identical configuration with this {@link Bootstrap}.
|
||||||
* This method is useful when you make multiple connections with similar settings.
|
* This method is useful when you make multiple connections with similar settings.
|
||||||
|
*
|
||||||
|
* Be aware that if you call {@link #shutdown()} on one of them it will shutdown shared resources.
|
||||||
*/
|
*/
|
||||||
public Bootstrap duplicate() {
|
public Bootstrap duplicate() {
|
||||||
validate();
|
validate();
|
||||||
|
@ -119,6 +119,10 @@ public class ServerBootstrap extends AbstractBootstrap<ServerBootstrap> {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the specific {@link AttributeKey} with the given value on every child {@link Channel}. If the value is
|
||||||
|
* {@code null} the {@link AttributeKey} is removed
|
||||||
|
*/
|
||||||
public <T> ServerBootstrap childAttr(AttributeKey<T> childKey, T value) {
|
public <T> ServerBootstrap childAttr(AttributeKey<T> childKey, T value) {
|
||||||
if (childKey == null) {
|
if (childKey == null) {
|
||||||
throw new NullPointerException("childKey");
|
throw new NullPointerException("childKey");
|
||||||
|
@ -20,6 +20,7 @@ import io.netty.buffer.ByteBuf;
|
|||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
|
import io.netty.channel.ChannelStateHandlerAdapter;
|
||||||
import io.netty.channel.ServerChannel;
|
import io.netty.channel.ServerChannel;
|
||||||
import io.netty.util.CharsetUtil;
|
import io.netty.util.CharsetUtil;
|
||||||
|
|
||||||
@ -75,12 +76,12 @@ import java.util.Set;
|
|||||||
* b.releaseExternalResources();
|
* b.releaseExternalResources();
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* public class MyHandler extends {@link SimpleChannelUpstreamHandler} {
|
* public class MyHandler extends {@link ChannelStateHandlerAdapter} {
|
||||||
* {@code @Override}
|
* {@code @Override}
|
||||||
* public void channelOpen({@link ChannelHandlerContext} ctx, {@link ChannelStateEvent} e) {
|
* public void channelActive({@link ChannelHandlerContext} ctx) {
|
||||||
* // Add all open channels to the global group so that they are
|
|
||||||
* // closed on shutdown.
|
* // closed on shutdown.
|
||||||
* <strong>allChannels.add(e.getChannel());</strong>
|
* <strong>allChannels.add(e.getChannel());</strong>
|
||||||
|
* super.channelActive(ctx);
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
* </pre>
|
* </pre>
|
||||||
|
@ -73,29 +73,26 @@ import java.util.concurrent.TimeUnit;
|
|||||||
* <pre>
|
* <pre>
|
||||||
* // BAD - NEVER DO THIS
|
* // BAD - NEVER DO THIS
|
||||||
* {@code @Override}
|
* {@code @Override}
|
||||||
* public void messageReceived({@link ChannelHandlerContext} ctx, {@link MessageEvent} e) {
|
* public void messageReceived({@link ChannelHandlerContext} ctx, ShutdownMessage msg) {
|
||||||
* if (e.getMessage() instanceof ShutdownMessage) {
|
* {@link ChannelGroup} allChannels = MyServer.getAllChannels();
|
||||||
* {@link ChannelGroup} allChannels = MyServer.getAllChannels();
|
* {@link ChannelGroupFuture} future = allChannels.close();
|
||||||
* {@link ChannelGroupFuture} future = allChannels.close();
|
* future.awaitUninterruptibly();
|
||||||
* future.awaitUninterruptibly();
|
* // Perform post-shutdown operation
|
||||||
* // Perform post-shutdown operation
|
* // ...
|
||||||
* // ...
|
*
|
||||||
* }
|
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* // GOOD
|
* // GOOD
|
||||||
* {@code @Override}
|
* {@code @Override}
|
||||||
* public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) {
|
* public void messageReceived(ChannelHandlerContext ctx, ShutdownMessage msg) {
|
||||||
* if (e.getMessage() instanceof ShutdownMessage) {
|
* {@link ChannelGroup} allChannels = MyServer.getAllChannels();
|
||||||
* {@link ChannelGroup} allChannels = MyServer.getAllChannels();
|
* {@link ChannelGroupFuture} future = allChannels.close();
|
||||||
* {@link ChannelGroupFuture} future = allChannels.close();
|
* future.addListener(new {@link ChannelGroupFutureListener}() {
|
||||||
* future.addListener(new {@link ChannelGroupFutureListener}() {
|
* public void operationComplete({@link ChannelGroupFuture} future) {
|
||||||
* public void operationComplete({@link ChannelGroupFuture} future) {
|
* // Perform post-closure operation
|
||||||
* // Perform post-closure operation
|
* // ...
|
||||||
* // ...
|
* }
|
||||||
* }
|
* });
|
||||||
* });
|
|
||||||
* }
|
|
||||||
* }
|
* }
|
||||||
* </pre>
|
* </pre>
|
||||||
* <p>
|
* <p>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user