Author: markt
Date: Fri Apr 25 20:07:39 2014
New Revision: 1590128
URL: http://svn.apache.org/r1590128
Log:
Stop threads used for secure WebSocket client connections when they are no
longer required and give them better names for easier debugging while they are
running.
Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/AsyncChannelWrapperSecure.java
tomcat/trunk/webapps/docs/changelog.xml
Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/AsyncChannelWrapperSecure.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/AsyncChannelWrapperSecure.java?rev=1590128&r1=1590127&r2=1590128&view=diff
==============================================================================
---
tomcat/trunk/java/org/apache/tomcat/websocket/AsyncChannelWrapperSecure.java
(original)
+++
tomcat/trunk/java/org/apache/tomcat/websocket/AsyncChannelWrapperSecure.java
Fri Apr 25 20:07:39 2014
@@ -26,9 +26,11 @@ import java.util.concurrent.ExecutionExc
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
+import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLEngineResult;
@@ -57,7 +59,8 @@ public class AsyncChannelWrapperSecure i
private final ByteBuffer socketReadBuffer;
private final ByteBuffer socketWriteBuffer;
// One thread for read, one for write
- private final ExecutorService executor = Executors.newFixedThreadPool(2);
+ private final ExecutorService executor =
+ Executors.newFixedThreadPool(2, new SecureIOThreadFactory());
private AtomicBoolean writing = new AtomicBoolean(false);
private AtomicBoolean reading = new AtomicBoolean(false);
@@ -148,6 +151,7 @@ public class AsyncChannelWrapperSecure i
} catch (IOException e) {
log.info(sm.getString("asyncChannelWrapperSecure.closeFail"));
}
+ executor.shutdownNow();
}
@Override
@@ -552,4 +556,19 @@ public class AsyncChannelWrapperSecure i
return new Integer(result.intValue());
}
}
+
+
+ private static class SecureIOThreadFactory implements ThreadFactory {
+
+ private AtomicInteger count = new AtomicInteger(0);
+
+ @Override
+ public Thread newThread(Runnable r) {
+ Thread t = new Thread(r);
+ t.setName("WebSocketClient-SecureIO-" + count.incrementAndGet());
+ t.setContextClassLoader(this.getClass().getClassLoader());
+ t.setDaemon(true);
+ return t;
+ }
+ }
}
Modified: tomcat/trunk/webapps/docs/changelog.xml
URL:
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1590128&r1=1590127&r2=1590128&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Fri Apr 25 20:07:39 2014
@@ -268,6 +268,11 @@
<bug>56458</bug>: Report WebSocket sessions that are created over
secure
connections as secure rather than as not secure. (markt)
</fix>
+ <fix>
+ Stop threads used for secure WebSocket client connections when they are
+ no longer required and give them better names for easier debugging
while
+ they are running. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Web applications">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]