List of usage examples for io.netty.channel.group ChannelGroup writeAndFlush
ChannelGroupFuture writeAndFlush(Object message, ChannelMatcher matcher);
From source file:com.github.mrstampy.gameboot.netty.NettyConnectionRegistry.java
License:Open Source License
/** * Send to group./* w w w . jav a 2s .c om*/ * * @param groupName * the group key * @param message * the message * @param matcher * the matcher * @param listeners * the listeners */ public void sendToGroup(String groupName, String message, ChannelMatcher matcher, ChannelFutureListener... listeners) { groupCheck(groupName); if (!groups.containsKey(groupName)) { log.warn("No group {} to send message {}", groupName, message); return; } ChannelGroup group = groups.get(groupName); ChannelFutureListener[] all = utils.prependArray(f -> log((ChannelGroupFuture) f, groupName), listeners); ChannelGroupFuture cf = group.writeAndFlush(message, matcher); cf.addListeners(all); }
From source file:com.github.mrstampy.gameboot.netty.NettyConnectionRegistry.java
License:Open Source License
/** * Send to group.// w w w . j a v a 2 s . co m * * @param groupName * the group key * @param message * the message * @param matcher * the matcher * @param listeners * the listeners */ public void sendToGroup(String groupName, byte[] message, ChannelMatcher matcher, ChannelFutureListener... listeners) { groupCheck(groupName); checkMessage(message); if (!groups.containsKey(groupName)) { log.warn("No group {} to send message {}", groupName, message); return; } ChannelGroup group = groups.get(groupName); ChannelFutureListener[] all = utils.prependArray(f -> log((ChannelGroupFuture) f, groupName), listeners); ChannelGroupFuture cf = group.writeAndFlush(message, matcher); cf.addListeners(all); }