private boolean futureIsAlreadyCancelled(Channel channel) { // FIXME should we only check isCancelled? if (future.isDone()) { Channels.silentlyCloseChannel(channel); return true; } return false; }
public void attachChannel(Channel channel, boolean reuseChannel) { // future could have been cancelled first if (isDone()) { Channels.silentlyCloseChannel(channel); } this.channel = channel; this.reuseChannel = reuseChannel; }
private void close(Channel channel) { // FIXME pity to have to do this here Channels.setDiscard(channel); Channels.silentlyCloseChannel(channel); }
private boolean abortOnThrowable(Channel channel, Throwable cause) { if (cause != null) { if (cause instanceof IllegalStateException || cause instanceof ClosedChannelException || StackTraceInspector.recoverOnReadOrWriteException(cause)) { LOGGER.debug(cause.getMessage(), cause); Channels.silentlyCloseChannel(channel); } else { future.abort(cause); } return true; } return false; }
public void closeChannel(Channel channel) { LOGGER.debug("Closing Channel {} ", channel); Channels.setDiscard(channel); removeAll(channel); Channels.silentlyCloseChannel(channel); }
public void onFailure(Channel channel, Throwable cause) { // beware, channel can be null Channels.silentlyCloseChannel(channel); boolean canRetry = future.incrementRetryAndCheck(); LOGGER.debug("Trying to recover from failing to connect channel {} with a retry value of {} ", channel, canRetry); if (canRetry// && cause != null // FIXME when can we have a null cause? && (future.getChannelState() != ChannelState.NEW || StackTraceInspector.recoverOnNettyDisconnectException(cause))) { if (requestSender.retry(future)) { return; } } LOGGER.debug("Failed to recover from connect exception: {} with channel {}", cause, channel); String message = cause.getMessage() != null ? cause.getMessage() : future.getUri().getBaseUrl(); ConnectException e = new ConnectException(message); e.initCause(cause); future.abort(e); } }
@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; }
Channels.silentlyCloseChannel(channel);
if (!requestSender.applyIoExceptionFiltersAndReplayRequest(future, ChannelClosedException.INSTANCE, channel)) { Channels.silentlyCloseChannel(channel); Channels.silentlyCloseChannel(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 void attachChannel(Channel channel, boolean reuseChannel) { // future could have been cancelled first if (isDone()) { Channels.silentlyCloseChannel(channel); } this.channel = channel; this.reuseChannel = reuseChannel; }
public void attachChannel(Channel channel, boolean reuseChannel) { // future could have been cancelled first if (isDone()) { Channels.silentlyCloseChannel(channel); } this.channel = channel; this.reuseChannel = reuseChannel; }
public void attachChannel(Channel channel, boolean reuseChannel) { // future could have been cancelled first if (isDone()) { Channels.silentlyCloseChannel(channel); } this.channel = channel; this.reuseChannel = reuseChannel; }
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); }
private boolean abortOnThrowable(Throwable cause, Channel channel) { if (cause != null && future.getState() != NettyResponseFuture.STATE.NEW) { if (cause instanceof IllegalStateException || cause instanceof ClosedChannelException || StackTraceInspector.recoverOnReadOrWriteException(cause)) { LOGGER.debug(cause.getMessage(), cause); Channels.silentlyCloseChannel(channel); } else { future.abort(cause); } return true; } return false; }
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); }
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(channel.getId()); Channels.silentlyCloseChannel(channel); }