Top Description Inners Fields Constructors Methods
org.apache.tomcat.websocket

public Class AsyncChannelGroupUtil

extends Object
Class Inheritance
Imports
java.io.IOException, java.nio.channels.AsynchronousChannelGroup, java.security.AccessController, .PrivilegedAction, java.util.concurrent.ExecutorService, .SynchronousQueue, .ThreadFactory, .TimeUnit, java.util.concurrent.atomic.AtomicInteger, org.apache.tomcat.util.res.StringManager, org.apache.tomcat.util.threads.ThreadPoolExecutor

This is a utility class that enables multiple WsWebSocketContainer instances to share a single AsynchronousChannelGroup while ensuring that the group is destroyed when no longer required.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static AsynchronousChannelGroup
private static final Object
private static final StringManager
private static int

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static AsynchronousChannelGroup
public static AsynchronousChannelGroup
public static void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

groupback to summary
private static AsynchronousChannelGroup group
lockback to summary
private static final Object lock
smback to summary
private static final StringManager sm
usageCountback to summary
private static int usageCount

Constructor Detail

AsyncChannelGroupUtilback to summary
private AsyncChannelGroupUtil()

Method Detail

createAsynchronousChannelGroupback to summary
private static AsynchronousChannelGroup createAsynchronousChannelGroup()
registerback to summary
public static AsynchronousChannelGroup register()
unregisterback to summary
public static void unregister()
org.apache.tomcat.websocket back to summary

private Class AsyncChannelGroupUtil.AsyncIOThreadFactory

extends Object
implements ThreadFactory
Class Inheritance
  • java.lang.Object
  • org.apache.tomcat.websocket.AsyncChannelGroupUtil.AsyncIOThreadFactory
All Implemented Interfaces
java.util.concurrent.ThreadFactory

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public Thread
newThread(final Runnable
a runnable to be executed by new thread instance
r
)

Implements java.util.concurrent.ThreadFactory.newThread.

Constructs a new unstarted Thread to run the given runnable.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

AsyncIOThreadFactoryback to summary
private AsyncIOThreadFactory()

Method Detail

newThreadback to summary
public Thread newThread(final Runnable r)

Implements java.util.concurrent.ThreadFactory.newThread.

Doc from java.util.concurrent.ThreadFactory.newThread.

Constructs a new unstarted Thread to run the given runnable.

Parameters
r:Runnable

a runnable to be executed by new thread instance

Returns:Thread

constructed thread, or null if the request to create a thread is rejected

Annotations
@Override
org.apache.tomcat.websocket back to summary

private Class AsyncChannelGroupUtil.AsyncIOThreadFactory.NewThreadPrivilegedAction

extends Object
implements PrivilegedAction<Thread>
Class Inheritance
  • java.lang.Object
  • org.apache.tomcat.websocket.AsyncChannelGroupUtil.AsyncIOThreadFactory.NewThreadPrivilegedAction
All Implemented Interfaces
java.security.PrivilegedAction

Field Summary

Modifier and TypeField and Description
private static AtomicInteger
private final Runnable
r

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private static void
load()

public Thread
run()

Implements java.security.PrivilegedAction.run.

Performs the computation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

countback to summary
private static AtomicInteger count
rback to summary
private final Runnable r

Constructor Detail

NewThreadPrivilegedActionback to summary
pack-priv NewThreadPrivilegedAction(Runnable r)

Method Detail

loadback to summary
private static void load()
runback to summary
public Thread run()

Implements java.security.PrivilegedAction.run.

Doc from java.security.PrivilegedAction.run.

Performs the computation. This method will be called by AccessController.doPrivileged after enabling privileges.

Returns:Thread

a class-dependent value that may represent the results of the computation. Each class that implements PrivilegedAction should document what (if anything) this value represents.

Annotations
@Override