|
Platform SDK Java 8.5 API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.genesyslab.platform.commons.management.PSDKMBeanBase
com.genesyslab.platform.commons.threading.ThreadHeartbeatCounter
public final class ThreadHeartbeatCounter
This class is intended to be used with Genesys Management Framework Heartbeat feature for threads hang-up detection functionality. To enable monitoring of particular thread dedicated instance of this class should be initialized and used for the thread liveliness reporting.
This class has no public constructor and each thread for monitoring should create own instance with following static method:
public static ThreadHeartbeatCounter createThreadHeartbeatCounter(
String threadLogicalName,
int threadClass);
This class is designed as JMX MBean and implements
public interface ThreadHeartbeatCounterMBean
which is accessible
through java management framework.
Life cycle of this object including MBeanServer registration
is supported with parent class PSDKMBeanBase
and is following:
ThreadHeartbeatCounter monitor =
ThreadHeartbeatCounter.createThreadHeartbeatCounter(
threadId, threadClass);
monitor.initialize();
monitor.alive();
monitor.setActive(false);
monitor.setActive(true);
monitor.unregister();
Field Summary |
---|
Fields inherited from class com.genesyslab.platform.commons.management.PSDKMBeanBase |
---|
DOMAIN_GENESYS_PLATFORM_SDK |
Fields inherited from interface com.genesyslab.platform.commons.threading.ThreadHeartbeatCounterMBean |
---|
MBEAN_TYPE |
Method Summary | |
---|---|
void |
alive()
It's a thread liveliness notification method. |
static ThreadHeartbeatCounter |
createThreadHeartbeatCounter(java.lang.String threadLogicalName,
int threadClass)
Creates instance for thread monitoring MBean. |
void |
forceUnregister()
|
int |
getHeartbeatCounter()
|
java.lang.String |
getLogicalName()
|
int |
getThreadClass()
|
long |
getThreadSystemId()
|
void |
initialize()
This method initializes monitor with current thread system id and enables monitoring on it. |
boolean |
isActive()
|
void |
setActive(boolean isActive)
This method enables or disables monitoring of the thread. |
void |
setThreadClass(int newThreadClass)
Thread class can be any positive integer number that represent thread class (thread "type" or "group"), for example thread that executes conn_main_loop, pool thread, some special kind of threads like external auth thread in ConfigServer, etc. |
void |
unregister()
This method deactivates monitoring of the thread and unregisters MBean from platform MBeanServer. After deregistration monitor object instance can't be reused - it is required to create new instance. |
Methods inherited from class com.genesyslab.platform.commons.management.PSDKMBeanBase |
---|
createMBeanNameId, doRegisterMBean, doUnregisterMBean, getMBeanDomain, getMBeanName, getMBeanNameExtraKeys, getMBeanType, isRegistered, register, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static ThreadHeartbeatCounter createThreadHeartbeatCounter(java.lang.String threadLogicalName, int threadClass)
threadLogicalName
- logical descriptive thread ID
independent from thread ID provided by OS,
it is used for thread identification within LCA
and for logging purposes as well.
This id should be unique in bound of application.threadClass
- any positive integer number that represent
thread class, for example thread that executes conn_main_loop,
pool thread, some special kind of threads
like external auth thread in ConfigServer, etc.
Thread class values are meaning full in scope of application,
i.e. same value of thread class can have different meaning
in different applications.
The main reason of thread classes is to allow to create
different monitoring settings for different type of threads
within application.
public void initialize()
alive()
).
initialize
in class PSDKMBeanBase
alive()
public void unregister()
unregister
in class PSDKMBeanBase
public void forceUnregister()
public long getThreadSystemId()
getThreadSystemId
in interface ThreadHeartbeatCounterMBean
public java.lang.String getLogicalName()
getLogicalName
in interface ThreadHeartbeatCounterMBean
public int getThreadClass()
getThreadClass
in interface ThreadHeartbeatCounterMBean
public void setThreadClass(int newThreadClass)
setThreadClass
in interface ThreadHeartbeatCounterMBean
newThreadClass
- new thread class valuepublic int getHeartbeatCounter()
getHeartbeatCounter
in interface ThreadHeartbeatCounterMBean
public void setActive(boolean isActive)
setActive
in interface ThreadHeartbeatCounterMBean
public boolean isActive()
isActive
in interface ThreadHeartbeatCounterMBean
public void alive()
initialize()
.
If some thread have monitor initialized, application has LCA connection
and has heartbeat feature configured in Genesys Management Framework,
but does not perform regular liveliness reports, LCA may treat the application
as "hanged-up" and may restart it.
Sometimes it may be required to perform some long tasks, or some kind of long sleeps,
so, is useful to temporary suspend/resume monitoring. It can be done by call of setActive(boolean)
.
initialize()
,
setActive(boolean)
,
unregister()
|
Platform SDK Java 8.5 API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |