On 05.08.2013 18:22, Mark Thomas wrote:
> On 05/08/2013 11:49, Rainer Jung wrote:

>> The "Thread-4" has stack
>>
>>    java.lang.Thread.State: RUNNABLE
>>         at sun.nio.ch.SolarisEventPort.portGet(Native Method)
>>         at sun.nio.ch.SolarisEventPort.access$400(SolarisEventPort.java:38)
>>         at
>> sun.nio.ch.SolarisEventPort$EventHandlerTask.run(SolarisEventPort.java:167)
>>         at java.lang.Thread.run(Thread.java:724)
>>
>> and gets started between NioBlockingSelector.BlockPoller-2 and
>> ContainerBackgroundProcessor[StandardEngine[Catalina]]. Not sure whether
>> it is started by the JVM under the hood, but if we create it ourselves
>> we should probably give it a name.

Unfortunately we can't :(

Stack at thread creation is:

        at java.lang.Thread.init(Thread.java:439)
        at java.lang.Thread.<init>(Thread.java:479)
        at sun.nio.ch.ThreadPool$1.newThread(ThreadPool.java:45)
        at
sun.nio.ch.AsynchronousChannelGroupImpl$2.run(AsynchronousChannelGroupImpl.java:123)
        at
sun.nio.ch.AsynchronousChannelGroupImpl$2.run(AsynchronousChannelGroupImpl.java:118)
        at java.security.AccessController.doPrivileged(Native Method)
        at
sun.nio.ch.AsynchronousChannelGroupImpl.startInternalThread(AsynchronousChannelGroupImpl.java:118)
        at
sun.nio.ch.AsynchronousChannelGroupImpl.startThreads(AsynchronousChannelGroupImpl.java:132)
        at sun.nio.ch.SolarisEventPort.start(SolarisEventPort.java:82)
        at
sun.nio.ch.SolarisAsynchronousChannelProvider.openAsynchronousChannelGroup(SolarisAsynchronousChannelProvider.java:65)
        at
java.nio.channels.AsynchronousChannelGroup.withCachedThreadPool(AsynchronousChannelGroup.java:233)
        at
org.apache.tomcat.websocket.WsWebSocketContainer.<clinit>(WsWebSocketContainer.java:116)
        at org.apache.tomcat.websocket.server.WsSci.init(WsSci.java:130)
        at org.apache.tomcat.websocket.server.WsSci.onStartup(WsSci.java:47)

and the code in WsWebSocketContainer provides a thread factory that does
set a sensible name. But Thread-4 is some JDK internal thread we can't
influence. Here's the relevant snippet of JDK code:

117     private void startInternalThread(final Runnable task) {
118         AccessController.doPrivileged(new PrivilegedAction<Void>() {
119             @Override
120             public Void run() {
121                 // internal threads should not be visible to
application so
122                 // cannot use user-supplied thread factory
123
ThreadPool.defaultThreadFactory().newThread(task).start();
124                 return null;
125             }
126          });
127     }
128
"./jdk/src/share/classes/sun/nio/ch/AsynchronousChannelGroupImpl.java"

So we have to live with that. Code looks the same in Java 8.

Regards,

Rainer

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to