You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2014/10/22 21:30:45 UTC
svn commit: r1633689 - in /tomcat/tc7.0.x/trunk: ./
java/org/apache/tomcat/websocket/AsyncChannelGroupUtil.java
webapps/docs/changelog.xml
Author: markt
Date: Wed Oct 22 19:30:45 2014
New Revision: 1633689
URL: http://svn.apache.org/r1633689
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=57091
Work around the behaviour of the Oracle JRE when creating new threads in an applet environment that breaks the WebSocket client implementation.
Patch provided by Niklas Hallqvist.
Modified:
tomcat/tc7.0.x/trunk/ (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/AsyncChannelGroupUtil.java
tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
Merged /tomcat/trunk:r1633688
Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/AsyncChannelGroupUtil.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/AsyncChannelGroupUtil.java?rev=1633689&r1=1633688&r2=1633689&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/AsyncChannelGroupUtil.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/AsyncChannelGroupUtil.java Wed Oct 22 19:30:45 2014
@@ -18,6 +18,8 @@ package org.apache.tomcat.websocket;
import java.io.IOException;
import java.nio.channels.AsynchronousChannelGroup;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadFactory;
@@ -106,12 +108,21 @@ public class AsyncChannelGroupUtil {
private AtomicInteger count = new AtomicInteger(0);
@Override
- public Thread newThread(Runnable r) {
- Thread t = new Thread(r);
- t.setName("WebSocketClient-AsyncIO-" + count.incrementAndGet());
- t.setContextClassLoader(this.getClass().getClassLoader());
- t.setDaemon(true);
- return t;
+ public Thread newThread(final Runnable r) {
+ // Create the new Thread within a doPrivileged block to ensure that
+ // the thread inherits the current ProtectionDomain which is
+ // essential to be able to use this with a Java Applet. See
+ // https://issues.apache.org/bugzilla/show_bug.cgi?id=57091
+ return AccessController.doPrivileged(new PrivilegedAction<Thread>() {
+ @Override
+ public Thread run() {
+ Thread t = new Thread(r);
+ t.setName("WebSocketClient-AsyncIO-" + count.incrementAndGet());
+ t.setContextClassLoader(this.getClass().getClassLoader());
+ t.setDaemon(true);
+ return t;
+ }
+ });
}
}
}
Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1633689&r1=1633688&r2=1633689&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Wed Oct 22 19:30:45 2014
@@ -146,6 +146,11 @@
Add null checks for arguments in remote endpoint. (remm/kkolinko)
</fix>
<fix>
+ <bug>57091</bug>: Work around the behaviour of the Oracle JRE when
+ creating new threads in an applet environment that breaks the WebSocket
+ client implementation. Patch provided by Niklas Hallqvist. (markt)
+ </fix>
+ <fix>
<bug>57118</bug>: Ensure that that an <code>EncodeException</code> is
thrown by <code>RemoteEndpoint.Basic.sendObject(Object)</code> rather
than an <code>IOException</code> when no suitable <code>Encoder</code>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org