gr = tc.prepareGet("vulcan", "secrets", "s1").get(); } finally { ctx.close(); Assert.assertTrue(e.getMessage().startsWith("no permissions for [indices:data/read/get]")); } finally { ctx.close(); ctx.close(); Assert.fail(); } finally { ctx.close(); Assert.assertTrue(gr.isSourceEmpty()); } finally { ctx.close(); Assert.assertTrue(gr.isSourceEmpty()); } finally { ctx.close(); scrollId = searchRes.getScrollId(); } finally { ctx.close(); tc.prepareSearchScroll(scrollId).get(); } finally { ctx.close();
Consumer<Boolean> contextPreservingListener = forced -> { try (ThreadContext.StoredContext ignore = threadContext.stashContext()) { storedContext.restore(); listener.accept(forced);
sgContext.close();
boolean whileRunning = false; try (ThreadContext.StoredContext ignore = stashContext()){ ctx.restore(); whileRunning = true; in.run();
boolean whileRunning = false; try (ThreadContext.StoredContext ignore = stashContext()){ ctx.restore(); whileRunning = true; in.run();
} finally { if (!addedReleaseListener) { IOUtils.close(stream);
Consumer<Boolean> contextPreservingListener = forced -> { try (ThreadContext.StoredContext ignore = threadContext.stashContext()) { storedContext.restore(); listener.accept(forced);
Consumer<Boolean> contextPreservingListener = forced -> { try (ThreadContext.StoredContext ignore = threadContext.stashContext()) { storedContext.restore(); listener.accept(forced);
protected void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { if (cause instanceof ReadTimeoutException) { if (logger.isTraceEnabled()) { logger.trace("Read timeout [{}]", ctx.channel().remoteAddress()); } ctx.channel().close(); } else { if (!lifecycle.started()) { // ignore return; } if (!NetworkExceptionHelper.isCloseConnectionException(cause)) { logger.warn( (Supplier<?>) () -> new ParameterizedMessage( "caught exception while handling client http traffic, closing connection {}", ctx.channel()), cause); ctx.channel().close(); } else { logger.debug( (Supplier<?>) () -> new ParameterizedMessage( "caught exception while handling client http traffic, closing connection {}", ctx.channel()), cause); ctx.channel().close(); } } }
@Override protected void doRun() throws Exception { boolean whileRunning = false; threadsOriginalContext = stashContext(); try { creatorsContext.restore(); whileRunning = true; in.doRun(); whileRunning = false; } catch (IllegalStateException ex) { if (whileRunning || threadLocal.closed.get() == false) { throw ex; } // if we hit an ISE here we have been shutting down // this comes from the threadcontext and barfs if // our threadpool has been shutting down } }
@Override protected void doRun() throws Exception { boolean whileRunning = false; threadsOriginalContext = stashContext(); try { creatorsContext.restore(); whileRunning = true; in.doRun(); whileRunning = false; } catch (IllegalStateException ex) { if (whileRunning || threadLocal.closed.get() == false) { throw ex; } // if we hit an ISE here we have been shutting down // this comes from the threadcontext and barfs if // our threadpool has been shutting down } }
@Override protected void doRun() throws Exception { boolean whileRunning = false; threadsOriginalContext = stashContext(); try { creatorsContext.restore(); whileRunning = true; in.doRun(); whileRunning = false; } catch (IllegalStateException ex) { if (whileRunning || threadLocal.closed.get() == false) { throw ex; } // if we hit an ISE here we have been shutting down // this comes from the threadcontext and barfs if // our threadpool has been shutting down } }
@Override public void run() { boolean whileRunning = false; try (ThreadContext.StoredContext ignore = stashContext()){ ctx.restore(); whileRunning = true; in.run(); whileRunning = false; } catch (IllegalStateException ex) { if (whileRunning || threadLocal.closed.get() == false) { throw ex; } // if we hit an ISE here we have been shutting down // this comes from the threadcontext and barfs if // our threadpool has been shutting down } }
default void restore() { close(); } }
default void restore() { close(); } }
/** * Same as {@link #newRestorableContext(boolean)} but wraps an existing context to restore. * @param storedContext the context to restore */ public Supplier<StoredContext> wrapRestorable(StoredContext storedContext) { return () -> { StoredContext context = newStoredContext(false); storedContext.restore(); return context; }; }
default void restore() { close(); } }
@Override public void handleResponse(T response) { contextToRestore.restore(); innerHandler.handleResponse(response); }
@Override public void onNewClusterState(ClusterState state) { context.close(); run(); }
@Override public void onAfter() { try { in.onAfter(); } finally { if (threadsOriginalContext != null) { threadsOriginalContext.restore(); } } }