Package org.glassfish.tyrus.core
Class BaseContainer
- java.lang.Object
-
- org.glassfish.tyrus.core.ExecutorServiceProvider
-
- org.glassfish.tyrus.core.BaseContainer
-
- All Implemented Interfaces:
WebSocketContainer
- Direct Known Subclasses:
ClientManager
,TyrusServerContainer
public abstract class BaseContainer extends ExecutorServiceProvider implements WebSocketContainer
Base WebSocket container.Client and Server containers extend this to provide additional functionality.
- Author:
- Jitendra Kotamraju
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interface
BaseContainer.ShutDownCondition
-
Constructor Summary
Constructors Constructor Description BaseContainer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.ExecutorService
getExecutorService()
Returns a container-managedExecutorService
registered underjava:comp/DefaultManagedExecutorService
or if the lookup has failed, it returns aExecutorService
created and managed by this instance ofBaseContainer
.java.util.concurrent.ScheduledExecutorService
getScheduledExecutorService()
Returns a container-managedScheduledExecutorService
registered underjava:comp/DefaultManagedScheduledExecutorService
or if the lookup has failed it returns aScheduledExecutorService
created and managed by this instance ofBaseContainer
.void
shutdown()
Release executor services managed by this instance.protected void
shutdown(BaseContainer.ShutDownCondition shutDownCondition)
Release executor services managed by this instance if the condition passed in the parameter is fulfilled.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface javax.websocket.WebSocketContainer
connectToServer, connectToServer, connectToServer, connectToServer, getDefaultAsyncSendTimeout, getDefaultMaxBinaryMessageBufferSize, getDefaultMaxSessionIdleTimeout, getDefaultMaxTextMessageBufferSize, getInstalledExtensions, setAsyncSendTimeout, setDefaultMaxBinaryMessageBufferSize, setDefaultMaxSessionIdleTimeout, setDefaultMaxTextMessageBufferSize
-
-
-
-
Method Detail
-
getExecutorService
public java.util.concurrent.ExecutorService getExecutorService()
Returns a container-managedExecutorService
registered underjava:comp/DefaultManagedExecutorService
or if the lookup has failed, it returns aExecutorService
created and managed by this instance ofBaseContainer
.- Specified by:
getExecutorService
in classExecutorServiceProvider
- Returns:
- executor service.
-
getScheduledExecutorService
public java.util.concurrent.ScheduledExecutorService getScheduledExecutorService()
Returns a container-managedScheduledExecutorService
registered underjava:comp/DefaultManagedScheduledExecutorService
or if the lookup has failed it returns aScheduledExecutorService
created and managed by this instance ofBaseContainer
.- Specified by:
getScheduledExecutorService
in classExecutorServiceProvider
- Returns:
- scheduled executor service.
-
shutdown
public void shutdown()
Release executor services managed by this instance. Executor services obtained via JNDI lookup won't be shut down.
-
shutdown
protected void shutdown(BaseContainer.ShutDownCondition shutDownCondition)
Release executor services managed by this instance if the condition passed in the parameter is fulfilled. Executor services obtained via JNDI lookup won't be shut down.- Parameters:
shutDownCondition
- condition that will be evaluated before executor services are released and they will be released only if the condition is evaluated totrue
. The condition will be evaluated in a synchronized block in order to make the process of its evaluation and executor services release an atomic operation.
-
-