private static final Log log = LogFactory.getLog(AprEndpoint.class);
- private static final boolean IS_SECURITY_ENABLED =
- (System.getSecurityManager() != null);
-
// ----------------------------------------------------------------- Fields
/**
* Root APR memory pool.
new SocketEventProcessor(wrapper, status);
ClassLoader loader = Thread.currentThread().getContextClassLoader();
try {
- if (IS_SECURITY_ENABLED) {
+ if (Constants.IS_SECURITY_ENABLED) {
PrivilegedAction<Void> pa = new PrivilegedSetTccl(
getClass().getClassLoader());
AccessController.doPrivileged(pa);
}
getExecutor().execute(proc);
} finally {
- if (IS_SECURITY_ENABLED) {
+ if (Constants.IS_SECURITY_ENABLED) {
PrivilegedAction<Void> pa = new PrivilegedSetTccl(loader);
AccessController.doPrivileged(pa);
} else {
SocketProcessor proc = new SocketProcessor(socket, status);
ClassLoader loader = Thread.currentThread().getContextClassLoader();
try {
- if (IS_SECURITY_ENABLED) {
+ //threads should not be created by the webapp classloader
+ if (Constants.IS_SECURITY_ENABLED) {
PrivilegedAction<Void> pa = new PrivilegedSetTccl(
getClass().getClassLoader());
AccessController.doPrivileged(pa);
Thread.currentThread().setContextClassLoader(
getClass().getClassLoader());
}
+ // During shutdown, executor may be null - avoid NPE
+ if (!running) {
+ return false;
+ }
getExecutor().execute(proc);
} finally {
- if (IS_SECURITY_ENABLED) {
+ if (Constants.IS_SECURITY_ENABLED) {
PrivilegedAction<Void> pa = new PrivilegedSetTccl(loader);
AccessController.doPrivileged(pa);
} else {
}
}
} catch (RejectedExecutionException x) {
- log.warn("Socket processing request was rejected for:"+socket,x);
+ log.warn("Socket processing request was rejected for: "+socket, x);
return false;
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);