diff --git a/appserver/web/web-core/src/main/java/org/apache/catalina/core/ContainerBase.java b/appserver/web/web-core/src/main/java/org/apache/catalina/core/ContainerBase.java index 9077f558b94..30032acbeb5 100644 --- a/appserver/web/web-core/src/main/java/org/apache/catalina/core/ContainerBase.java +++ b/appserver/web/web-core/src/main/java/org/apache/catalina/core/ContainerBase.java @@ -1750,7 +1750,7 @@ protected void threadStart() { * to update lastaccesstime and accessedTime. */ protected void threadSessionStart() { - if (sessionThread != null) + if (sessionThread != null || manager == null) return; threadSessionDone = false; String threadName = "ContainerBackgroundSessionProcessor[" + toString() + "]"; diff --git a/appserver/web/web-core/src/main/java/org/apache/catalina/core/StandardContext.java b/appserver/web/web-core/src/main/java/org/apache/catalina/core/StandardContext.java index d041e61e209..a84ece1ec7a 100644 --- a/appserver/web/web-core/src/main/java/org/apache/catalina/core/StandardContext.java +++ b/appserver/web/web-core/src/main/java/org/apache/catalina/core/StandardContext.java @@ -5946,6 +5946,8 @@ public synchronized void stop(boolean isShutdown) // Stop ContainerBackgroundProcessor thread super.threadStop(); + // Stop ContainerBackgroundSessionProcessor thread + super.threadSessionStop(); if ((manager != null) && (manager instanceof Lifecycle)) { if(manager instanceof StandardManager) {