protected int getChannelCount() { return channels.size(); }
public int currentSize() { return channels.size(); }
@Override public void closeAll() { if (LOG.isDebugEnabled()) { LOG.debug("closeAll()"); } // clear all the connections on which we are selecting int length = cnxns.size(); for (ServerCnxn cnxn : cnxns) { try { // This will remove the cnxn from cnxns cnxn.close(); } catch (Exception e) { LOG.warn("Ignoring exception closing cnxn sessionid 0x" + Long.toHexString(cnxn.getSessionId()), e); } } if (LOG.isDebugEnabled()) { LOG.debug("allChannels size:" + allChannels.size() + " cnxns size:" + length); } }
if (this.allChannels.size() + this.pendingCreateChannelFutures.size() < this.capacity) { final Future<Channel> createChannelFuture = this.channelFactory.create(executor.<Channel>newPromise()); this.pendingCreateChannelFutures.add(createChannelFuture);
@Override public void channelRegistered(ChannelHandlerContext ctx) throws Exception { if (channelGroup.size() >= maxConnectionsCount) { LOGGER.warn("Max allowed connection to server exceeded: current={} configured={}", channelGroup.size(), maxConnectionsCount); ctx.close(); return; } channelGroup.add(ctx.channel()); super.channelRegistered(ctx); } }
@Override public void channelUnregistered(ChannelHandlerContext ctx) throws Exception { accepted.remove(ctx.channel()); if (LOG.isDebugEnabled()) { LOG.debug(serviceName + " closes a connection. The number of current connections are " + accepted.size()); } super.channelUnregistered(ctx); }
@Override public void channelRegistered(ChannelHandlerContext ctx) throws Exception { accepted.add(ctx.channel()); if(LOG.isDebugEnabled()){ LOG.debug(String.format(serviceName + " accepted number of connections (%d)", accepted.size())); } super.channelRegistered(ctx); }
@Override public void channelRegistered(ChannelHandlerContext ctx) throws Exception { accepted.add(ctx.channel()); if(LOG.isDebugEnabled()){ LOG.debug(String.format(serviceName + " accepted number of connections (%d)", accepted.size())); } super.channelRegistered(ctx); }
@Override public void channelRegistered(ChannelHandlerContext ctx) throws Exception { accepted.add(ctx.channel()); if(LOG.isDebugEnabled()) { LOG.debug(String.format("Current number of shuffle connections (%d)", accepted.size())); } super.channelRegistered(ctx); }
@Override public void channelRegistered(ChannelHandlerContext ctx) throws Exception { accepted.add(ctx.channel()); if(LOG.isDebugEnabled()){ LOG.debug(String.format(serviceName + " accepted number of connections (%d)", accepted.size())); } super.channelRegistered(ctx); }
@Override public void channelUnregistered(ChannelHandlerContext ctx) throws Exception { accepted.remove(ctx.channel()); if (LOG.isDebugEnabled()) { LOG.debug(serviceName + " closes a connection. The number of current connections are " + accepted.size()); } super.channelUnregistered(ctx); }
@Override public void channelUnregistered(ChannelHandlerContext ctx) throws Exception { accepted.remove(ctx.channel()); if (LOG.isDebugEnabled()) { LOG.debug(serviceName + " closes a connection. The number of current connections are " + accepted.size()); } super.channelUnregistered(ctx); }
@Override public void channelUnregistered(ChannelHandlerContext ctx) throws Exception { accepted.remove(ctx.channel()); if (LOG.isDebugEnabled()) { LOG.debug(serviceName + " closes a connection. The number of current connections are " + accepted.size()); } super.channelUnregistered(ctx); }
@Override public void channelUnregistered(ChannelHandlerContext ctx) throws Exception { accepted.remove(ctx.channel()); if (LOG.isDebugEnabled()) { LOG.debug(serviceName + " closes a connection. The number of current connections are " + accepted.size()); } super.channelUnregistered(ctx); }
@Override public void channelInactive(final ChannelHandlerContext ctx) throws Exception { super.channelInactive(ctx); clientChannels.remove(ctx.channel()); logger.debug("Closing WebSocket connection; {} clients connected", clientChannels.size()); }
private void closeClients() { int numClients = channelGroup.size(); if (numClients > 0) { log.warn("Closing {} clients", numClients); } channelGroup.close().syncUninterruptibly(); }
@Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { super.userEventTriggered(ctx, evt); if (WebSocketServerProtocolHandler.ServerHandshakeStateEvent.HANDSHAKE_COMPLETE.equals(evt)) { clientChannels.add(ctx.channel()); logger.debug("New WebSocket connection; {} clients currently connected", clientChannels.size()); } }
protected void stopServerBootstrap() { // close all channels LOG.info("ConnectionlessBootstrap disconnecting from {}:{}", configuration.getHost(), configuration.getPort()); LOG.trace("Closing {} channels", allChannels.size()); allChannels.close().awaitUninterruptibly(); // and then shutdown the thread pools if (workerGroup != null) { workerGroup.shutdownGracefully(); workerGroup = null; } }