private void unbind(Context context) { if (clBindRequired) { context.unbind(Globals.IS_SECURITY_ENABLED, MY_CLASSLOADER); } } }
private void unbind(Context context) { if (clBindRequired) { context.unbind(Globals.IS_SECURITY_ENABLED, MY_CLASSLOADER); } } }
@Override public void run() { ClassLoader oldCL = context.bind(Globals.IS_SECURITY_ENABLED, null); try { wrapped.run(); } finally { context.unbind(Globals.IS_SECURITY_ENABLED, oldCL); } // Since this runnable is not executing as a result of a socket // event, we need to ensure that any registered dispatches are // executed. coyoteRequest.action(ActionCode.DISPATCH_EXECUTE, null); } }
@Override public void run() { ClassLoader oldCL = context.bind(Globals.IS_SECURITY_ENABLED, null); try { wrapped.run(); } finally { context.unbind(Globals.IS_SECURITY_ENABLED, oldCL); } // Since this runnable is not executing as a result of a socket // event, we need to ensure that any registered dispatches are // executed. coyoteRequest.action(ActionCode.DISPATCH_EXECUTE, null); } }
@Override public void fireOnComplete() { List<AsyncListenerWrapper> listenersCopy = new ArrayList<>(); listenersCopy.addAll(listeners); ClassLoader oldCL = context.bind(Globals.IS_SECURITY_ENABLED, null); try { for (AsyncListenerWrapper listener : listenersCopy) { try { listener.fireOnComplete(event); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); log.warn("onComplete() failed for listener of type [" + listener.getClass().getName() + "]", t); } } } finally { context.fireRequestDestroyEvent(request.getRequest()); clearServletRequestResponse(); context.unbind(Globals.IS_SECURITY_ENABLED, oldCL); } }
public boolean timeout() { AtomicBoolean result = new AtomicBoolean(); request.getCoyoteRequest().action(ActionCode.ASYNC_TIMEOUT, result); // Avoids NPEs during shutdown. A call to recycle will null this field. Context context = this.context; if (result.get()) { ClassLoader oldCL = context.bind(false, null); try { List<AsyncListenerWrapper> listenersCopy = new ArrayList<>(); listenersCopy.addAll(listeners); for (AsyncListenerWrapper listener : listenersCopy) { try { listener.fireOnTimeout(event); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); log.warn("onTimeout() failed for listener of type [" + listener.getClass().getName() + "]", t); } } request.getCoyoteRequest().action( ActionCode.ASYNC_IS_TIMINGOUT, result); } finally { context.unbind(false, oldCL); } } return !result.get(); }
public boolean timeout() { AtomicBoolean result = new AtomicBoolean(); request.getCoyoteRequest().action(ActionCode.ASYNC_TIMEOUT, result); // Avoids NPEs during shutdown. A call to recycle will null this field. Context context = this.context; if (result.get()) { ClassLoader oldCL = context.bind(false, null); try { List<AsyncListenerWrapper> listenersCopy = new ArrayList<>(); listenersCopy.addAll(listeners); for (AsyncListenerWrapper listener : listenersCopy) { try { listener.fireOnTimeout(event); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); log.warn(sm.getString("asyncContextImpl.onTimeoutError", listener.getClass().getName()), t); } } request.getCoyoteRequest().action( ActionCode.ASYNC_IS_TIMINGOUT, result); } finally { context.unbind(false, oldCL); } } return !result.get(); }
@Override public void fireOnComplete() { List<AsyncListenerWrapper> listenersCopy = new ArrayList<>(); listenersCopy.addAll(listeners); ClassLoader oldCL = context.bind(Globals.IS_SECURITY_ENABLED, null); try { for (AsyncListenerWrapper listener : listenersCopy) { try { listener.fireOnComplete(event); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); log.warn(sm.getString("asyncContextImpl.onCompleteError", listener.getClass().getName()), t); } } } finally { context.fireRequestDestroyEvent(request.getRequest()); clearServletRequestResponse(); context.unbind(Globals.IS_SECURITY_ENABLED, oldCL); } }
} finally { if (localDataSource) { context.unbind(Globals.IS_SECURITY_ENABLED, oldThreadContextCL);
} finally { if (localDataSource) { context.unbind(Globals.IS_SECURITY_ENABLED, oldThreadContextCL);
} finally { closeQuietly(in, bytes); context.unbind(Globals.IS_SECURITY_ENABLED, oldThreadContextCL);
} finally { closeQuietly(in, bytes); context.unbind(Globals.IS_SECURITY_ENABLED, oldThreadContextCL);
context.unbind(Globals.IS_SECURITY_ENABLED, oldThreadContextCL);
context.unbind(Globals.IS_SECURITY_ENABLED, oldThreadContextCL);
close(dbConnection); } finally { context.unbind(Globals.IS_SECURITY_ENABLED, oldThreadContextCL); release(_conn);
close(dbConnection); } finally { context.unbind(Globals.IS_SECURITY_ENABLED, oldThreadContextCL); release(_conn);
protected void processChildren(Container container) { ClassLoader originalClassLoader = null; try { if (container instanceof Context) { Loader loader = ((Context) container).getLoader(); // Loader will be null for FailedContext instances if (loader == null) { return; } // Ensure background processing for Contexts and Wrappers // is performed under the web app's class loader originalClassLoader = ((Context) container).bind(false, null); } container.backgroundProcess(); Container[] children = container.findChildren(); for (int i = 0; i < children.length; i++) { if (children[i].getBackgroundProcessorDelay() <= 0) { processChildren(children[i]); } } } catch (Throwable t) { ExceptionUtils.handleThrowable(t); log.error("Exception invoking periodic operation: ", t); } finally { if (container instanceof Context) { ((Context) container).unbind(false, originalClassLoader); } } } }
protected void processChildren(Container container) { ClassLoader originalClassLoader = null; try { if (container instanceof Context) { Loader loader = ((Context) container).getLoader(); // Loader will be null for FailedContext instances if (loader == null) { return; } // Ensure background processing for Contexts and Wrappers // is performed under the web app's class loader originalClassLoader = ((Context) container).bind(false, null); } container.backgroundProcess(); Container[] children = container.findChildren(); for (int i = 0; i < children.length; i++) { if (children[i].getBackgroundProcessorDelay() <= 0) { processChildren(children[i]); } } } catch (Throwable t) { ExceptionUtils.handleThrowable(t); log.error(sm.getString("containerBase.backgroundProcess.error"), t); } finally { if (container instanceof Context) { ((Context) container).unbind(false, originalClassLoader); } } } }
context.unbind(Globals.IS_SECURITY_ENABLED, MY_CLASSLOADER);
context.unbind(Globals.IS_SECURITY_ENABLED, MY_CLASSLOADER);