[#1623] Fix javadocs for ChannelGroup
This commit is contained in:
parent
7903697c36
commit
0b17586731
@ -25,6 +25,7 @@ import io.netty.channel.ChannelInboundHandlerAdapter;
|
|||||||
import io.netty.channel.EventLoop;
|
import io.netty.channel.EventLoop;
|
||||||
import io.netty.channel.ServerChannel;
|
import io.netty.channel.ServerChannel;
|
||||||
import io.netty.util.CharsetUtil;
|
import io.netty.util.CharsetUtil;
|
||||||
|
import io.netty.util.concurrent.GlobalEventExecutor;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@ -42,7 +43,8 @@ import java.util.Set;
|
|||||||
* If you need to broadcast a message to more than one {@link Channel}, you can
|
* If you need to broadcast a message to more than one {@link Channel}, you can
|
||||||
* add the {@link Channel}s associated with the recipients and call {@link ChannelGroup#write(Object)}:
|
* add the {@link Channel}s associated with the recipients and call {@link ChannelGroup#write(Object)}:
|
||||||
* <pre>
|
* <pre>
|
||||||
* <strong>{@link ChannelGroup} recipients = new {@link DefaultChannelGroup}();</strong>
|
* <strong>{@link ChannelGroup} recipients =
|
||||||
|
* new {@link DefaultChannelGroup}({@link GlobalEventExecutor}.INSTANCE);</strong>
|
||||||
* recipients.add(channelA);
|
* recipients.add(channelA);
|
||||||
* recipients.add(channelB);
|
* recipients.add(channelB);
|
||||||
* ..
|
* ..
|
||||||
@ -60,15 +62,17 @@ import java.util.Set;
|
|||||||
* This rule is very useful when you shut down a server in one shot:
|
* This rule is very useful when you shut down a server in one shot:
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* <strong>{@link ChannelGroup} allChannels = new {@link DefaultChannelGroup}();</strong>
|
* <strong>{@link ChannelGroup} allChannels =
|
||||||
|
* new {@link DefaultChannelGroup}({@link GlobalEventExecutor}.INSTANCE);</strong>
|
||||||
*
|
*
|
||||||
* public static void main(String[] args) throws Exception {
|
* public static void main(String[] args) throws Exception {
|
||||||
* {@link ServerBootstrap} b = new {@link ServerBootstrap}(..);
|
* {@link ServerBootstrap} b = new {@link ServerBootstrap}(..);
|
||||||
* ...
|
* ...
|
||||||
|
* b.childHandler(new MyHandler());
|
||||||
*
|
*
|
||||||
* // Start the server
|
* // Start the server
|
||||||
* b.getPipeline().addLast("handler", new MyHandler());
|
* b.getPipeline().addLast("handler", new MyHandler());
|
||||||
* {@link Channel} serverChannel = b.bind(..);
|
* {@link Channel} serverChannel = b.bind(..).sync();
|
||||||
* <strong>allChannels.add(serverChannel);</strong>
|
* <strong>allChannels.add(serverChannel);</strong>
|
||||||
*
|
*
|
||||||
* ... Wait until the shutdown signal reception ...
|
* ... Wait until the shutdown signal reception ...
|
||||||
@ -82,7 +86,7 @@ import java.util.Set;
|
|||||||
* {@code @Override}
|
* {@code @Override}
|
||||||
* public void channelActive({@link ChannelHandlerContext} ctx) {
|
* public void channelActive({@link ChannelHandlerContext} ctx) {
|
||||||
* // closed on shutdown.
|
* // closed on shutdown.
|
||||||
* <strong>allChannels.add(e.getChannel());</strong>
|
* <strong>allChannels.add(ctx.channel());</strong>
|
||||||
* super.channelActive(ctx);
|
* super.channelActive(ctx);
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
|
Loading…
Reference in New Issue
Block a user