[#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.ServerChannel;
|
||||
import io.netty.util.CharsetUtil;
|
||||
import io.netty.util.concurrent.GlobalEventExecutor;
|
||||
|
||||
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
|
||||
* add the {@link Channel}s associated with the recipients and call {@link ChannelGroup#write(Object)}:
|
||||
* <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(channelB);
|
||||
* ..
|
||||
@ -60,15 +62,17 @@ import java.util.Set;
|
||||
* This rule is very useful when you shut down a server in one shot:
|
||||
*
|
||||
* <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 {
|
||||
* {@link ServerBootstrap} b = new {@link ServerBootstrap}(..);
|
||||
* ...
|
||||
* b.childHandler(new MyHandler());
|
||||
*
|
||||
* // Start the server
|
||||
* b.getPipeline().addLast("handler", new MyHandler());
|
||||
* {@link Channel} serverChannel = b.bind(..);
|
||||
* {@link Channel} serverChannel = b.bind(..).sync();
|
||||
* <strong>allChannels.add(serverChannel);</strong>
|
||||
*
|
||||
* ... Wait until the shutdown signal reception ...
|
||||
@ -82,7 +86,7 @@ import java.util.Set;
|
||||
* {@code @Override}
|
||||
* public void channelActive({@link ChannelHandlerContext} ctx) {
|
||||
* // closed on shutdown.
|
||||
* <strong>allChannels.add(e.getChannel());</strong>
|
||||
* <strong>allChannels.add(ctx.channel());</strong>
|
||||
* super.channelActive(ctx);
|
||||
* }
|
||||
* }
|
||||
|
Loading…
Reference in New Issue
Block a user