Package org.ow2.joram.tools.jmscheck
Class JMSConnectorStatus
- java.lang.Object
-
- org.ow2.joram.tools.jmscheck.JMSConnectorStatus
-
- All Implemented Interfaces:
JMSConnectorStatusMBean
final class JMSConnectorStatus extends Object implements JMSConnectorStatusMBean
-
-
Field Summary
Fields Modifier and Type Field Description (package private) ScheduledFuture<?>callableHandleprivate JMSConnectorCheckcheck(package private) JMSStatusjmsStatusRoot componentprivate static Loggerloggerprivate StringmbeanNameprivate intperiodThe period of time between 2 checks (in seconds).
-
Constructor Summary
Constructors Constructor Description JMSConnectorStatus(JMSStatus jmsStatus, String cfname, InitialContext ictx, String user, String pass, String qname, int period, int timeOut)Creates a JMS connectors healthcheck component.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetErrorMsg()Returns the error message of the last try.StringgetLastConnectTime()Returns the date of last successful connection.longgetLatencyConnect()Returns the latency of the connection during the last try.longgetLatencyPubSub()Returns the latency of the send/receive during the last try.StringgetName()intgetNbFailures()Returns the total number of failures since starting.intgetNbTry()Returns the total number of try since starting.intgetPeriod()Returns the period of time between 2 checks.intgetStatus()Returns the status of the connector: 0 => RUNNING, >0 => UNREACHABLE.StringgetStatusInfo()intgetTimeOut()Returns the maximum time waiting for connection.private voidregisterMBean()private voidschedule()voidsetPeriod(int period)Sets the period of time between 2 checks.voidsetTimeOut(int timeOut)Sets the maximum time waiting for connection.(package private) voidstart()(package private) voidstop()private voidunregisterMBean()
-
-
-
Field Detail
-
logger
private static final Logger logger
-
check
private JMSConnectorCheck check
-
period
private int period
The period of time between 2 checks (in seconds).
-
jmsStatus
JMSStatus jmsStatus
Root component
-
callableHandle
ScheduledFuture<?> callableHandle
-
mbeanName
private String mbeanName
-
-
Constructor Detail
-
JMSConnectorStatus
JMSConnectorStatus(JMSStatus jmsStatus, String cfname, InitialContext ictx, String user, String pass, String qname, int period, int timeOut)
Creates a JMS connectors healthcheck component.- Parameters:
jmsStatus- Root component.cfname- JNDI name of the ConnectionFactory to use.ictx- JNDI context allowing to get the ConnectionFactory.user- User name for authentication, if null uses the ConnectioNfactory default.pass- Password for authentication, if null uses the ConnectioNfactory default.qname- Name of the queue used to check the JMS behavior. It is an internal not a JNDI name, this destination is created by the module.period- Period (in seconds) between 2 attempts of check.timeOut- Maximum amount of time to wait either the connection or the message.
-
-
Method Detail
-
getStatus
public int getStatus()
Description copied from interface:JMSConnectorStatusMBeanReturns the status of the connector: 0 => RUNNING, >0 => UNREACHABLE.- Specified by:
getStatusin interfaceJMSConnectorStatusMBean- Returns:
- the number of unreachable connection
-
getStatusInfo
public String getStatusInfo()
- Specified by:
getStatusInfoin interfaceJMSConnectorStatusMBean
-
getNbTry
public int getNbTry()
Description copied from interface:JMSConnectorStatusMBeanReturns the total number of try since starting.- Specified by:
getNbTryin interfaceJMSConnectorStatusMBean- Returns:
- the total number of try since starting.
-
getNbFailures
public int getNbFailures()
Description copied from interface:JMSConnectorStatusMBeanReturns the total number of failures since starting.- Specified by:
getNbFailuresin interfaceJMSConnectorStatusMBean- Returns:
- the total number of failures since starting.
-
getErrorMsg
public String getErrorMsg()
Description copied from interface:JMSConnectorStatusMBeanReturns the error message of the last try. Returns null if the test is successful.- Specified by:
getErrorMsgin interfaceJMSConnectorStatusMBean- Returns:
-
getLatencyConnect
public long getLatencyConnect()
Description copied from interface:JMSConnectorStatusMBeanReturns the latency of the connection during the last try. Returns -1 if the test failed.- Specified by:
getLatencyConnectin interfaceJMSConnectorStatusMBean- Returns:
- the latency of the connection during the last try.
-
getLastConnectTime
public String getLastConnectTime()
Description copied from interface:JMSConnectorStatusMBeanReturns the date of last successful connection.- Specified by:
getLastConnectTimein interfaceJMSConnectorStatusMBean- Returns:
- the date of last successful connection.
-
getLatencyPubSub
public long getLatencyPubSub()
Description copied from interface:JMSConnectorStatusMBeanReturns the latency of the send/receive during the last try. Returns -1 if the test failed.- Specified by:
getLatencyPubSubin interfaceJMSConnectorStatusMBean- Returns:
- the latency of the send/receive during the last try.
-
getPeriod
public int getPeriod()
Description copied from interface:JMSConnectorStatusMBeanReturns the period of time between 2 checks.- Specified by:
getPeriodin interfaceJMSConnectorStatusMBean- Returns:
- the period of time between 2 checks.
-
setPeriod
public void setPeriod(int period)
Description copied from interface:JMSConnectorStatusMBeanSets the period of time between 2 checks.- Specified by:
setPeriodin interfaceJMSConnectorStatusMBean- Parameters:
period- the period of time between 2 checks.
-
getTimeOut
public int getTimeOut()
Description copied from interface:JMSConnectorStatusMBeanReturns the maximum time waiting for connection.- Specified by:
getTimeOutin interfaceJMSConnectorStatusMBean- Returns:
- the maximum time waiting for connection.
-
setTimeOut
public void setTimeOut(int timeOut)
Description copied from interface:JMSConnectorStatusMBeanSets the maximum time waiting for connection.- Specified by:
setTimeOutin interfaceJMSConnectorStatusMBean- Parameters:
timeOut- the maximum time waiting for connection.
-
getName
public String getName()
- Specified by:
getNamein interfaceJMSConnectorStatusMBean
-
schedule
private void schedule()
-
start
void start()
-
stop
void stop()
-
registerMBean
private void registerMBean()
-
unregisterMBean
private void unregisterMBean()
-
-