private void close(Channel channel) { // FIXME pity to have to do this here Channels.setDiscard(channel); Channels.silentlyCloseChannel(channel); }
public void closeChannel(Channel channel) { LOGGER.debug("Closing Channel {} ", channel); Channels.setDiscard(channel); removeAll(channel); Channels.silentlyCloseChannel(channel); }
public final void tryToOfferChannelToPool(Channel channel, AsyncHandler<?> asyncHandler, boolean keepAlive, Object partitionKey) { if (channel.isActive() && keepAlive) { LOGGER.debug("Adding key: {} for channel {}", partitionKey, channel); Channels.setDiscard(channel); try { asyncHandler.onConnectionOffer(channel); } catch (Exception e) { LOGGER.error("onConnectionOffer crashed", e); } if (!channelPool.offer(channel, partitionKey)) { // rejected by pool closeChannel(channel); } } else { // not offered closeChannel(channel); } }
@Override public boolean cancel(boolean force) { releasePartitionKeyLock(); cancelTimeouts(); if (IS_CANCELLED_FIELD.getAndSet(this, 1) != 0) return false; // cancel could happen before channel was attached if (channel != null) { Channels.setDiscard(channel); Channels.silentlyCloseChannel(channel); } if (ON_THROWABLE_CALLED_FIELD.getAndSet(this, 1) == 0) { try { asyncHandler.onThrowable(new CancellationException()); } catch (Throwable t) { LOGGER.warn("cancel", t); } } future.cancel(false); return true; }
logger.info("Received unexpected message while expecting a chunk: " + msg); ctx.pipeline().remove(publisher); Channels.setDiscard(channel);
public void handleFrame(WebSocketFrame frame) { if (frame instanceof TextWebSocketFrame) { onTextFrame((TextWebSocketFrame) frame); } else if (frame instanceof BinaryWebSocketFrame) { onBinaryFrame((BinaryWebSocketFrame) frame); } else if (frame instanceof CloseWebSocketFrame) { Channels.setDiscard(channel); CloseWebSocketFrame closeFrame = (CloseWebSocketFrame) frame; onClose(closeFrame.statusCode(), closeFrame.reasonText()); Channels.silentlyCloseChannel(channel); } else if (frame instanceof PingWebSocketFrame) { onPingFrame((PingWebSocketFrame) frame); } else if (frame instanceof PongWebSocketFrame) { onPongFrame((PongWebSocketFrame) frame); } else if (frame instanceof ContinuationWebSocketFrame) { onContinuationFrame((ContinuationWebSocketFrame) frame); } }
public final void tryToOfferChannelToPool(Channel channel, boolean keepAlive, Object partitionKey) { if (channel.isActive() && keepAlive && channel.isActive()) { LOGGER.debug("Adding key: {} for channel {}", partitionKey, channel); Channels.setDiscard(channel); channelPool.offer(channel, partitionKey); if (maxConnectionsPerHostEnabled) channelId2PartitionKey.putIfAbsent(channel, partitionKey); } else { // not offered closeChannel(channel); } }
public void closeChannel(Channel channel) { // The channel may have already been removed from the future if a // timeout occurred, and this method may be called just after. LOGGER.debug("Closing Channel {} ", channel); try { removeAll(channel); Channels.setDiscard(channel); Channels.silentlyCloseChannel(channel); } catch (Throwable t) { LOGGER.debug("Error closing a connection", t); } openChannels.remove(channel); }
public void closeChannel(Channel channel) { // The channel may have already been removed from the future if a // timeout occurred, and this method may be called just after. LOGGER.debug("Closing Channel {} ", channel); try { removeAll(channel); Channels.setDiscard(channel); Channels.silentlyCloseChannel(channel); } catch (Throwable t) { LOGGER.debug("Error closing a connection", t); } openChannels.remove(channel); }
public void closeChannel(Channel channel) { LOGGER.debug("Closing Channel {} ", channel); removeAll(channel); Channels.setDiscard(channel); Channels.silentlyCloseChannel(channel); openChannels.remove(channel); }
public void closeChannel(Channel channel) { LOGGER.debug("Closing Channel {} ", channel); removeAll(channel); Channels.setDiscard(channel); Channels.silentlyCloseChannel(channel); openChannels.remove(channel); }
public final void tryToOfferChannelToPool(Channel channel, AsyncHandler<?> handler, boolean keepAlive, Object partitionKey) { if (channel.isActive() && keepAlive && channel.isActive()) { LOGGER.debug("Adding key: {} for channel {}", partitionKey, channel); Channels.setDiscard(channel); if (handler instanceof AsyncHandlerExtensions) { AsyncHandlerExtensions.class.cast(handler).onConnectionOffer(channel); } channelPool.offer(channel, partitionKey); if (maxConnectionsPerHostEnabled) channelId2PartitionKey.putIfAbsent(channel, partitionKey); } else { // not offered closeChannel(channel); } }
@Override public boolean cancel(boolean force) { cancelTimeouts(); if (isCancelled.getAndSet(true)) return false; // cancel could happen before channel was attached if (channel != null) { Channels.setDiscard(channel); Channels.silentlyCloseChannel(channel); } if (!onThrowableCalled.getAndSet(true)) { try { asyncHandler.onThrowable(new CancellationException()); } catch (Throwable t) { LOGGER.warn("cancel", t); } } latch.countDown(); runListeners(); return true; }
@Override public boolean cancel(boolean force) { cancelTimeouts(); if (isCancelled.getAndSet(true)) return false; // cancel could happen before channel was attached if (channel != null) { Channels.setDiscard(channel); Channels.silentlyCloseChannel(channel); } if (!onThrowableCalled.getAndSet(true)) { try { asyncHandler.onThrowable(new CancellationException()); } catch (Throwable t) { LOGGER.warn("cancel", t); } } latch.countDown(); runListeners(); return true; }
private void close(Channel channel) { // FIXME pity to have to do this here Channels.setDiscard(channel); channelId2Creation.remove(channel.getId()); Channels.silentlyCloseChannel(channel); }
private void close(Channel channel) { // FIXME pity to have to do this here Channels.setDiscard(channel); channelId2Creation.remove(channelId(channel)); Channels.silentlyCloseChannel(channel); }
private void close(Channel channel) { // FIXME pity to have to do this here Channels.setDiscard(channel); channelId2Creation.remove(channelId(channel)); Channels.silentlyCloseChannel(channel); }
private void close(Channel channel) { // FIXME pity to have to do this here Channels.setDiscard(channel); channelId2Creation.remove(channel.getId()); Channels.silentlyCloseChannel(channel); }
public final void tryToOfferChannelToPool(Channel channel, AsyncHandler<?> handler, boolean keepAlive, Object partitionKey) { if (channel.isConnected() && keepAlive && channel.isReadable()) { LOGGER.debug("Adding key: {} for channel {}", partitionKey, channel); Channels.setDiscard(channel); if (handler instanceof AsyncHandlerExtensions) { AsyncHandlerExtensions.class.cast(handler).onConnectionOffer(channel); } channelPool.offer(channel, partitionKey); if (maxConnectionsPerHostEnabled) channelId2PartitionKey.putIfAbsent(channel.getId(), partitionKey); } else { // not offered closeChannel(channel); } }
public final void tryToOfferChannelToPool(Channel channel, boolean keepAlive, Object partitionKey) { if (channel.isConnected() && keepAlive && channel.isReadable()) { LOGGER.debug("Adding key: {} for channel {}", partitionKey, channel); Channels.setDiscard(channel); channelPool.offer(channel, partitionKey); if (maxConnectionsPerHostEnabled) channelId2PartitionKey.putIfAbsent(channel.getId(), partitionKey); } else { // not offered closeChannel(channel); } }