public class ThreadMgr extends FrameworkBase
ThreadMgr is used to manager all Pool Managers.
active, initMessage, inProcess, jvmService, running, serviceData, totalErrors, totalMessages, totalProcessedCATEGROY_ADAPTER, CATEGROY_APP, CATEGROY_DB_CON, CATEGROY_DB_POOL, CATEGROY_ENGINE, CATEGROY_MODULE, CATEGROY_POOL_MGR, CATEGROY_QUEUE, CATEGROY_THREAD_MGR, CATEGROY_WORKER, COMMAND_DEREGISTER_KEY, COMMAND_PAUSE, COMMAND_REGISTER_KEY, COMMAND_RESTART, COMMAND_SHUTDOWN, COMMAND_START, COMMAND_STOP, FLAG_FALSE, FLAG_TRUE, PARAM_JVM_STR, PARAM_JVMID_STR, PARAM_SERVERNAME_STR, PARAM_SERVICEACTIVE_STR, PARAM_SERVICECATAGORY_STR, PARAM_SERVICENAME_STR, PARAM_SERVICERUNNING_STR, TYPE_CLUSTER, TYPE_DISPLAY_STR, TYPE_EVENT, TYPE_JVM, TYPE_JVM_STR, TYPE_MAX, TYPE_SERVER, TYPE_SERVICE| Modifier and Type | Method and Description |
|---|---|
void |
decrementThreadCount()
This method will decrease the number of threads by one
|
int |
getDefError() |
String |
getGroupName()
This method will return the group name of this Thread Manager.
|
static ThreadMgr |
getInstance()
This method
getInstance will return the instance (singleton)
of Thread manager. |
static ThreadMgr |
getInstance(String aGroupName)
This method
getInstance will return the instance (singleton)
of Thread manager by name. |
PoolMgr |
getPoolMgr(String aName)
This method
getPoolMgr will return the Pool Manager
associated with the supplied name
|
List<PoolMgr> |
getPoolMgrs()
This method
getPoolMgr will return the list of pool managers. |
int |
getThreadMax()
Will return the maximum number of threads allowed to be used by all thread
pools associated with this Thread Manager.
|
int |
getTotalThreads()
Will return the maximum number of threads allowed to be used by all thread
pools associated with this Thread Manager.
|
MessageIntf |
getTreadServiceData(String aName)
This method will return a new ServiceData based on the suppplied serice
name.
|
WorkerThread |
getWorkerThread(PoolMgr aPoolMgr,
String aName,
Class<ServicesIntf> aWorkerClass)
This method will return a worker thread from the pool manager.
|
void |
reapThreads()
This method is called by a cleanup thread to removed unused and inactive
threads.
|
void |
reapThreads(boolean aForce) |
void |
setGroupName(String aGroupName)
This method will set the group name for this thread group.
|
void |
setPoolMgr(String aName,
String aClassName,
int aMinPool,
int aMaxPool,
int aPriority)
This method
setPoolMgr willl add a new pool manager. |
void |
setThreadMax(int aMax)
Will set the maximum number of threads allowed to be used by all thread
pools associated with this Thread Manager
|
void |
shutdown()
This method is called to greacfully shutdown, stop the threads and
free resources.
|
void |
shutdownPoolMgr(String aPoolMgrName)
This method is called to greacfully shutdown a Pool Manager by name
|
static void |
shutdownThreadMgrs()
This methdo will shutdown all thread managers
|
addInProcess, addTotalErrorNumber, addTotalMsgNumber, addTotalProcessed, deRegister, deRegister, doEventMessage, doMessage, getInProcess, getJvmId, getJvmService, getName, getService, getServiceData, getServiceName, getStats, getTotalErrorNumber, getTotalMsgNumber, getTotalProcessed, initMessage, isActive, isRunning, register, register, resetTotals, setActive, setRunning, setServiceData, subtractInProcesspublic static ThreadMgr getInstance()
getInstance will return the instance (singleton)
of Thread manager.
ThreadMgr Singleton Objectpublic static ThreadMgr getInstance(String aGroupName)
getInstance will return the instance (singleton)
of Thread manager by name.
aGroupName - a String Name of thread groupThreadMgr Singleton Object by namepublic String getGroupName()
public void setGroupName(String aGroupName)
aGroupName - String Name of the Thread Grouppublic MessageIntf getTreadServiceData(String aName)
aName - string Service Namepublic void setThreadMax(int aMax)
aMax - int Maximum number of threadspublic int getThreadMax()
public int getTotalThreads()
public PoolMgr getPoolMgr(String aName)
getPoolMgr will return the Pool Manager
associated with the supplied name
aName - a String Pool Manager NamePoolMgr Pool Manager Objectpublic List<PoolMgr> getPoolMgrs()
getPoolMgr will return the list of pool managers.
PoolMgr Array List of Pool Managerspublic void setPoolMgr(String aName, String aClassName, int aMinPool, int aMaxPool, int aPriority) throws Exception
setPoolMgr willl add a new pool manager.
aName - a String Pool Manager NameaClassName - a String Worker Class NameaMinPool - an int Min ThreadsaMaxPool - an int Max ThreadsaPriority - an int Thread PriorityException - expublic WorkerThread getWorkerThread(PoolMgr aPoolMgr, String aName, Class<ServicesIntf> aWorkerClass)
aPoolMgr - a PoolMgr Pool Manager ObjectaName - a String Pool Manager NameaWorkerClass - an Object Object used to initializepublic void decrementThreadCount()
public static void shutdownThreadMgrs()
public void shutdown()
public void shutdownPoolMgr(String aPoolMgrName)
aPoolMgrName - a String Pool Manager Namepublic void reapThreads()
public void reapThreads(boolean aForce)
public int getDefError()
getDefError in class FrameworkBaseCopyright © 2020. All rights reserved.