Class QThreadPoolExecutor
java.lang.Object
org.jpos.q2.QBeanSupport
org.jpos.q2.qbean.QThreadPoolExecutor
- All Implemented Interfaces:
Configurable, QBean, QThreadPoolExecutorMBean, QBeanSupportMBean, QPersist
A qbean dedicated to thread pool executor creation and registration by Q2
NameRegistrar registry
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class QBeanSupport
cfg, log, scheduledThreadPoolExecutor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintprotected org.jdom2.AttributegetAttribute(org.jdom2.Element elt, String attrName, boolean mandatory, String errDesc) longintintlongintintintprotected Stringlongintstatic ThreadPoolExecutorgetThreadPoolExecutor(String name) Retrieves a thread pool executor from NameRegistrar given its namestatic <T extends ThreadPoolExecutor>
TgetThreadPoolExecutor(String name, Class<T> clazz) Retrieves a thread pool executor from NameRegistrar given its name, and its expected classprotected voidHandle specific config elements type := "fixed" | "scheduled" | "cached" corePoolSize := integer (required for "fixed" and "scheduled" kinds, optional for "cached" kind)booleanbooleanbooleanprotected voidsetExecSrvType(String execSrvType) protected voidsetInitialCorePoolSize(int initialCorePoolSize) protected voidsetTerminationTimer(int terminationTimer) protected voidprotected voidMethods inherited from class QBeanSupport
addAttr, close, createElement, destroy, destroyService, getAttrs, getAttrs, getConfiguration, getDump, getFactory, getLoader, getLoaderURLS, getLog, getLogger, getName, getPersist, getProperties, getProperty, getRealm, getScheduledThreadPoolExecutor, getServer, getState, getStateAsString, init, isModified, running, setAttr, setConfiguration, setLogger, setModified, setName, setPersist, setProperty, setRealm, setServer, setState, start, stopMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface QBeanSupportMBean
getDump, getLoader, getLoaderURLS, getLogger, getName, getRealm, getServer, setLogger, setName, setPersist, setRealm, setServerMethods inherited from interface QPersist
getPersist, isModified
-
Field Details
-
THREAD_POOL_EXECUTOR__QBEAN_PREFIX
- See Also:
-
XML_CONFIG_ATTR__EXEC_SRV_TYPE
- See Also:
-
XML_CONFIG_ATTR__EXEC_SRV_COREPOOLSIZE
- See Also:
-
XML_CONFIG_ATTR__EXEC_SRV_TERMINATION_TIMER
- See Also:
-
DEFAULT_TERMINATION_TIMER
- See Also:
-
-
Constructor Details
-
QThreadPoolExecutor
public QThreadPoolExecutor()
-
-
Method Details
-
initService
Handle specific config elements type := "fixed" | "scheduled" | "cached" corePoolSize := integer (required for "fixed" and "scheduled" kinds, optional for "cached" kind)- Overrides:
initServicein classQBeanSupport- Throws:
Exception
-
startService
- Overrides:
startServicein classQBeanSupport- Throws:
Exception
-
stopService
- Overrides:
stopServicein classQBeanSupport- Throws:
Exception
-
getRegistrationName
-
getAttribute
protected org.jdom2.Attribute getAttribute(org.jdom2.Element elt, String attrName, boolean mandatory, String errDesc) throws ConfigurationException - Parameters:
elt-attrName-mandatory-errDesc-- Throws:
ConfigurationException
-
getThreadPoolExecutor
public static ThreadPoolExecutor getThreadPoolExecutor(String name) throws NameRegistrar.NotFoundException Retrieves a thread pool executor from NameRegistrar given its name- Parameters:
name-- Throws:
NameRegistrar.NotFoundException
-
getThreadPoolExecutor
public static <T extends ThreadPoolExecutor> T getThreadPoolExecutor(String name, Class<T> clazz) throws NameRegistrar.NotFoundException Retrieves a thread pool executor from NameRegistrar given its name, and its expected class- Parameters:
name-clazz-- Throws:
NameRegistrar.NotFoundException
-
getExecSrvType
- Specified by:
getExecSrvTypein interfaceQThreadPoolExecutorMBean- Returns:
- executor service type
-
getTerminationTimer
- Specified by:
getTerminationTimerin interfaceQThreadPoolExecutorMBean- Returns:
- await termination delay
-
getActiveCount
- Specified by:
getActiveCountin interfaceQThreadPoolExecutorMBean- Returns:
- approximate number of threads that are actively executing tasks
- Throws:
NameRegistrar.NotFoundException
-
getCompletedTaskCount
- Specified by:
getCompletedTaskCountin interfaceQThreadPoolExecutorMBean- Returns:
- the approximate total number of tasks that have completed execution.
- Throws:
NameRegistrar.NotFoundException
-
getCorePoolSize
- Specified by:
getCorePoolSizein interfaceQThreadPoolExecutorMBean- Returns:
- returns the core number of threads.
- Throws:
NameRegistrar.NotFoundException
-
getKeepAliveTimeMS
- Specified by:
getKeepAliveTimeMSin interfaceQThreadPoolExecutorMBean- Returns:
- the thread keep-alive time, which is the amount of time (in milliseconds) which threads in excess of the core pool size may remain idle before being terminated
- Throws:
NameRegistrar.NotFoundException
-
getLargestPoolSize
- Specified by:
getLargestPoolSizein interfaceQThreadPoolExecutorMBean- Returns:
- the largest number of threads that have ever simultaneously been in the pool.
- Throws:
NameRegistrar.NotFoundException
-
getMaximumPoolSize
- Specified by:
getMaximumPoolSizein interfaceQThreadPoolExecutorMBean- Returns:
- the maximum allowed number of threads.
- Throws:
NameRegistrar.NotFoundException
-
getPoolSize
- Specified by:
getPoolSizein interfaceQThreadPoolExecutorMBean- Returns:
- the current number of threads in the pool.
- Throws:
NameRegistrar.NotFoundException
-
getTaskCount
- Specified by:
getTaskCountin interfaceQThreadPoolExecutorMBean- Returns:
- the approximate total number of tasks that have been scheduled for execution
- Throws:
NameRegistrar.NotFoundException
-
isShutdown
- Specified by:
isShutdownin interfaceQThreadPoolExecutorMBean- Returns:
- true if this executor has been shut down.
- Throws:
NameRegistrar.NotFoundException
-
isTerminated
- Specified by:
isTerminatedin interfaceQThreadPoolExecutorMBean- Returns:
- true if all tasks have completed following shut down
- Throws:
NameRegistrar.NotFoundException
-
isTerminating
- Specified by:
isTerminatingin interfaceQThreadPoolExecutorMBean- Returns:
- true if this executor is in the process of terminating after shutdown or shutdownNow but has not completely terminated.
- Throws:
NameRegistrar.NotFoundException
-
getInitialCorePoolSize
-
setExecSrvType
-
setInitialCorePoolSize
-
setTerminationTimer
-