private boolean terminateAndExit() { releasePartitionKeyLock(); cancelTimeouts(); this.channel = null; this.reuseChannel = false; return IS_DONE_FIELD.getAndSet(this, 1) != 0 || isCancelled != 0; }
void finishUpdate(NettyResponseFuture<?> future, Channel channel, boolean close) { future.cancelTimeouts(); if (close) { channelManager.closeChannel(channel); } else { channelManager.tryToOfferChannelToPool(channel, future.getAsyncHandler(), true, future.getPartitionKey()); } try { future.done(); } catch (Exception t) { // Never propagate exception once we know we are done. logger.debug(t.getMessage(), t); } }
private void loadContent() throws ExecutionException { if (future.isDone()) { try { future.get(); } catch (InterruptedException e) { throw new RuntimeException("unreachable", e); } } // No more retry CURRENT_RETRY_UPDATER.set(this, maxRetry); if (CONTENT_PROCESSED_FIELD.getAndSet(this, 1) == 0) { try { future.complete(asyncHandler.onCompleted()); } catch (Throwable ex) { if (ON_THROWABLE_CALLED_FIELD.getAndSet(this, 1) == 0) { try { try { asyncHandler.onThrowable(ex); } catch (Throwable t) { LOGGER.debug("asyncHandler.onThrowable", t); } } finally { cancelTimeouts(); } } future.completeExceptionally(ex); } } future.getNow(null); }
@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; }
/*********************************************/ private boolean terminateAndExit() { cancelTimeouts(); this.channel = null; this.reuseChannel = false; return isDone.getAndSet(true) || isCancelled.get(); }
/*********************************************/ private boolean terminateAndExit() { cancelTimeouts(); this.channel = null; this.reuseChannel = false; return isDone.getAndSet(true) || isCancelled.get(); }
/*********************************************/ private boolean terminateAndExit() { cancelTimeouts(); this.channel = null; this.reuseChannel = false; return isDone.getAndSet(true) || isCancelled.get(); }
/*********************************************/ private boolean terminateAndExit() { cancelTimeouts(); this.channel = null; this.reuseChannel = false; return isDone.getAndSet(true) || isCancelled.get(); }
public void close() { channelPool.destroy(); openChannels.close(); for (Channel channel : openChannels) { Object attribute = Channels.getAttribute(channel); if (attribute instanceof NettyResponseFuture<?>) { NettyResponseFuture<?> future = (NettyResponseFuture<?>) attribute; future.cancelTimeouts(); } } if (allowReleaseEventLoopGroup) eventLoopGroup.shutdownGracefully(); }
@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; }
@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 finishUpdate(final NettyResponseFuture<?> future, Channel channel, boolean expectOtherChunks) throws IOException { future.cancelTimeouts(); boolean keepAlive = future.isKeepAlive(); if (expectOtherChunks && keepAlive) channelManager.drainChannelAndOffer(channel, future); else channelManager.tryToOfferChannelToPool(channel, keepAlive, future.getPartitionKey()); try { future.done(); } catch (Throwable t) { // Never propagate exception once we know we are done. logger.debug(t.getMessage(), t); } }
private void finishUpdate(final NettyResponseFuture<?> future, Channel channel, boolean expectOtherChunks) throws IOException { future.cancelTimeouts(); boolean keepAlive = future.isKeepAlive(); if (expectOtherChunks && keepAlive) channelManager.drainChannelAndOffer(channel, future); else channelManager.tryToOfferChannelToPool(channel, keepAlive, future.getPartitionKey()); try { future.done(); } catch (Throwable t) { // Never propagate exception once we know we are done. logger.debug(t.getMessage(), t); } }
public void close() { channelPool.destroy(); openChannels.close(); for (Channel channel : openChannels) { Object attribute = Channels.getAttribute(channel); if (attribute instanceof NettyResponseFuture<?>) { NettyResponseFuture<?> future = (NettyResponseFuture<?>) attribute; future.cancelTimeouts(); } } if (allowReleaseEventLoopGroup) eventLoopGroup.shutdownGracefully(config.getShutdownQuiet(), config.getShutdownTimeout(), TimeUnit.MILLISECONDS); }
private void finishUpdate(final NettyResponseFuture<?> future, Channel channel, boolean expectOtherChunks) { future.cancelTimeouts(); boolean keepAlive = future.isKeepAlive(); if (expectOtherChunks && keepAlive) channelManager.drainChannelAndOffer(channel, future); else channelManager.tryToOfferChannelToPool(channel, future.getAsyncHandler(), keepAlive, future.getPartitionKey()); try { future.done(); } catch (Exception t) { // Never propagate exception once we know we are done. logger.debug(t.getMessage(), t); } }
private void finishUpdate(final NettyResponseFuture<?> future, Channel channel, boolean expectOtherChunks) throws IOException { future.cancelTimeouts(); boolean keepAlive = future.isKeepAlive(); if (expectOtherChunks && keepAlive) channelManager.drainChannelAndOffer(channel, future); else channelManager.tryToOfferChannelToPool(channel, future.getAsyncHandler(), keepAlive, future.getPartitionKey()); try { future.done(); } catch (Exception t) { // Never propagate exception once we know we are done. logger.debug(t.getMessage(), t); } }
public void close() { channelPool.destroy(); openChannels.close(); for (Channel channel : openChannels) { Object attribute = Channels.getAttribute(channel); if (attribute instanceof NettyResponseFuture<?>) { NettyResponseFuture<?> future = (NettyResponseFuture<?>) attribute; future.cancelTimeouts(); } } // FIXME also shutdown in provider config.getExecutorService().shutdown(); if (allowReleaseSocketChannelFactory) { socketChannelFactory.releaseExternalResources(); httpBootstrap.releaseExternalResources(); wsBootstrap.releaseExternalResources(); } }
public void close() { channelPool.destroy(); openChannels.close(); for (Channel channel : openChannels) { Object attribute = Channels.getAttribute(channel); if (attribute instanceof NettyResponseFuture<?>) { NettyResponseFuture<?> future = (NettyResponseFuture<?>) attribute; future.cancelTimeouts(); } } // FIXME also shutdown in provider config.executorService().shutdown(); if (allowReleaseSocketChannelFactory) { socketChannelFactory.releaseExternalResources(); plainBootstrap.releaseExternalResources(); secureBootstrap.releaseExternalResources(); webSocketBootstrap.releaseExternalResources(); secureWebSocketBootstrap.releaseExternalResources(); } }