Top Description Inners Fields Constructors Methods
org.glassfish.tyrus.core

public abstract Class BaseContainer

extends ExecutorServiceProvider
implements WebSocketContainer
Class Inheritance
All Implemented Interfaces
jakarta.websocket.WebSocketContainer
Imports
java.lang.reflect.Method, java.util.concurrent.ExecutorService, .Executors, .ScheduledExecutorService, .ThreadFactory, java.util.concurrent.atomic.AtomicInteger, java.util.logging.Level, .Logger, jakarta.websocket.WebSocketContainer

Base WebSocket container.

Client and Server containers extend this to provide additional functionality.

Author
Jitendra Kotamraju

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
protected static interface

Field Summary

Modifier and TypeField and Description
private final Object
EXECUTORS_CLEAN_UP_LOCK

This lock ensures that only one instance of each type of executors will be created and it also prevents a situation when a client is given an executor that is just about to be shut down.

private volatile ExecutorService
private static final Logger
private final ExecutorService
private final ScheduledExecutorService
private volatile ScheduledExecutorService
private final ThreadFactory

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public ExecutorService

Returns:

executor service.
getExecutorService
()

Implements abstract org.glassfish.tyrus.core.ExecutorServiceProvider.getExecutorService.

Returns a container-managed java.util.concurrent.ExecutorService registered under java:comp/DefaultManagedExecutorService or if the lookup has failed, it returns a java.util.concurrent.ExecutorService created and managed by this instance of org.glassfish.tyrus.core.BaseContainer.

public ScheduledExecutorService

Returns:

scheduled executor service.
getScheduledExecutorService
()

Implements abstract org.glassfish.tyrus.core.ExecutorServiceProvider.getScheduledExecutorService.

Returns a container-managed java.util.concurrent.ScheduledExecutorService registered under java:comp/DefaultManagedScheduledExecutorService or if the lookup has failed it returns a java.util.concurrent.ScheduledExecutorService created and managed by this instance of org.glassfish.tyrus.core.BaseContainer.

private ExecutorService
private ScheduledExecutorService
public void
shutdown()

Release executor services managed by this instance.

protected void
shutdown(BaseContainer.ShutDownCondition
condition that will be evaluated before executor services are released and they will be released only if the condition is evaluated to true. 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.
shutDownCondition
)

Release executor services managed by this instance if the condition passed in the parameter is fulfilled.

Field Detail

EXECUTORS_CLEAN_UP_LOCKback to summary
private final Object EXECUTORS_CLEAN_UP_LOCK

This lock ensures that only one instance of each type of executors will be created and it also prevents a situation when a client is given an executor that is just about to be shut down.

executorServiceback to summary
private volatile ExecutorService executorService
LOGGERback to summary
private static final Logger LOGGER
managedExecutorServiceback to summary
private final ExecutorService managedExecutorService
managedScheduledExecutorServiceback to summary
private final ScheduledExecutorService managedScheduledExecutorService
scheduledExecutorServiceback to summary
private volatile ScheduledExecutorService scheduledExecutorService
threadFactoryback to summary
private final ThreadFactory threadFactory

Constructor Detail

BaseContainerback to summary
public BaseContainer()

Method Detail

getExecutorServiceback to summary
public ExecutorService getExecutorService()

Implements abstract org.glassfish.tyrus.core.ExecutorServiceProvider.getExecutorService.

Returns a container-managed java.util.concurrent.ExecutorService registered under java:comp/DefaultManagedExecutorService or if the lookup has failed, it returns a java.util.concurrent.ExecutorService created and managed by this instance of org.glassfish.tyrus.core.BaseContainer.

Returns:ExecutorService

executor service.

Annotations
@Override
getScheduledExecutorServiceback to summary
public ScheduledExecutorService getScheduledExecutorService()

Implements abstract org.glassfish.tyrus.core.ExecutorServiceProvider.getScheduledExecutorService.

Returns a container-managed java.util.concurrent.ScheduledExecutorService registered under java:comp/DefaultManagedScheduledExecutorService or if the lookup has failed it returns a java.util.concurrent.ScheduledExecutorService created and managed by this instance of org.glassfish.tyrus.core.BaseContainer.

Returns:ScheduledExecutorService

scheduled executor service.

Annotations
@Override
lookupManagedExecutorServiceback to summary
private ExecutorService lookupManagedExecutorService()
lookupManagedScheduledExecutorServiceback to summary
private ScheduledExecutorService lookupManagedScheduledExecutorService()
shutdownback to summary
public void shutdown()

Release executor services managed by this instance. Executor services obtained via JNDI lookup won't be shut down.

shutdownback to summary
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:BaseContainer.ShutDownCondition

condition that will be evaluated before executor services are released and they will be released only if the condition is evaluated to true. 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.

org.glassfish.tyrus.core back to summary

private Class BaseContainer.DaemonThreadFactory

extends Object
implements ThreadFactory
Class Inheritance
All Implemented Interfaces
java.util.concurrent.ThreadFactory

Field Summary

Modifier and TypeField and Description
pack-priv final String
pack-priv static final AtomicInteger
pack-priv final AtomicInteger

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Thread
newThread(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

Field Detail

namePrefixback to summary
pack-priv final String namePrefix
poolNumberback to summary
pack-priv static final AtomicInteger poolNumber
threadNumberback to summary
pack-priv final AtomicInteger threadNumber

Constructor Detail

DaemonThreadFactoryback to summary
pack-priv DaemonThreadFactory()

Method Detail

newThreadback to summary
public Thread newThread(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.glassfish.tyrus.core back to summary

protected Interface BaseContainer.ShutDownCondition


Method Summary

Modifier and TypeMethod and Description
public boolean

Method Detail

evaluateback to summary
public boolean evaluate()