Author: remy.maucherat(a)jboss.com
Date: 2014-03-13 06:59:45 -0400 (Thu, 13 Mar 2014)
New Revision: 2384
Modified:
branches/7.4.x/src/main/java/org/apache/tomcat/util/net/NioEndpoint.java
Log:
Avoid shutdown of an external executor.
Modified: branches/7.4.x/src/main/java/org/apache/tomcat/util/net/NioEndpoint.java
===================================================================
--- branches/7.4.x/src/main/java/org/apache/tomcat/util/net/NioEndpoint.java 2014-03-12
17:33:18 UTC (rev 2383)
+++ branches/7.4.x/src/main/java/org/apache/tomcat/util/net/NioEndpoint.java 2014-03-13
10:59:45 UTC (rev 2384)
@@ -84,6 +84,11 @@
protected Sendfile sendfile;
/**
+ * Using an internal executor.
+ */
+ protected boolean internalExecutor = false;
+
+ /**
* Create a new instance of {@code NioEndpoint}
*/
public NioEndpoint() {
@@ -181,6 +186,7 @@
// If the executor is not set, create it with a fixed thread pool
if (this.executor == null) {
+ internalExecutor = true;
this.executor = Executors.newFixedThreadPool(this.maxThreads, this.threadFactory);
}
@@ -297,7 +303,11 @@
this.serverSocketChannelFactory = null;
// Shut down the executor
- ((ExecutorService) this.executor).shutdown();
+ if (internalExecutor) {
+ ((ExecutorService) this.executor).shutdown();
+ executor = null;
+ internalExecutor = false;
+ }
initialized = false;
}
Show replies by date