public final class JMSStatus extends Object implements JMSStatusMBean
Modifier and Type | Field and Description |
---|---|
private HashMap<String,JMSConnectorStatus> |
connectors |
(package private) static int |
delay |
(package private) static int |
DFLT_DELAY |
(package private) static String |
DFLT_DUMP_FILE |
(package private) static int |
DFLT_PERIOD |
private static int |
DFLT_THREAD_POOL_SIZE |
(package private) static int |
DFLT_THRESHOLD |
(package private) static int |
DFLT_TIMEOUT |
(package private) static String |
dumpFilePath |
private int |
globalPeriod |
private int |
globalTimeout |
static String |
JNDI_FACTORY_DFLT |
static String |
JNDI_HOST_DFLT |
static String |
JNDI_PORT_DFLT |
(package private) static long |
lastDump |
(package private) static Logger |
logger |
(package private) static String |
mbeanName |
private String |
name |
(package private) static ScheduledExecutorService |
scheduler |
(package private) static int |
threshold |
Constructor and Description |
---|
JMSStatus(String name,
int period,
int timeout,
String dumpFilePath,
int threshold,
int delay)
Creates a JMS connectors healthcheck root component.
|
Modifier and Type | Method and Description |
---|---|
void |
addConnectorStatus(String cfname,
InitialContext ictx,
String user,
String pass,
String qname,
int period,
int timeout)
Adds an healthcheck for the specified JMS connector.
|
(package private) static void |
checkDump(String name,
int retry) |
void |
dumpServerState(String path)
Generates a server dump.
|
(package private) static void |
dumpServerState(String path,
String cause) |
int |
getDelay()
Returns the minimal delay between 2 dumps.
|
(package private) InitialContext |
getInitialContext(String jndiFile,
String jndiFactory,
String jndiHost,
String jndiPort)
Creates the JNDI context to use.
|
(package private) String |
getName() |
int |
getPeriod()
Returns the activation period in seconds.
|
int |
getStatus()
Returns the global healthcheck indication, 0 if all connectors are running, 1 otherwise.
|
String |
getStatusInfo()
Returns a user friendly indication of the global healthcheck: RUNNING or UNREACHABLE.
|
int |
getThreshold()
Returns the minimum number of failures before generating a dump.
|
int |
getTimeout()
Returns the timeout used during check.
|
(package private) void |
registerMBean() |
void |
setDelay(int delay)
Sets the minimal delay between 2 dumps.
|
void |
setPeriod(int period)
Sets the activation period in seconds.
|
void |
setThreshold(int threshold)
Sets the minimum number of failures before generating a dump.
|
void |
setTimeout(int timeout)
Sets the timeout used during check.
|
void |
start()
Starts the component and all connector's healthcheck defined.
|
void |
stop()
Stops the component and all connector's healthcheck defined.
|
(package private) void |
unregisterMBean() |
static final Logger logger
static final int DFLT_PERIOD
private int globalPeriod
static final int DFLT_TIMEOUT
private int globalTimeout
static final int DFLT_THRESHOLD
static int threshold
static final int DFLT_DELAY
static int delay
private HashMap<String,JMSConnectorStatus> connectors
static final String DFLT_DUMP_FILE
static String dumpFilePath
static long lastDump
public static final String JNDI_FACTORY_DFLT
public static final String JNDI_HOST_DFLT
public static final String JNDI_PORT_DFLT
static ScheduledExecutorService scheduler
private static final int DFLT_THREAD_POOL_SIZE
private String name
static String mbeanName
public JMSStatus(String name, int period, int timeout, String dumpFilePath, int threshold, int delay)
name
- Name of component, used to define the domain of the JMX MBeans.period
- Default period of activation for checks (seconds).timeout
- Default timeout for checks (seconds).dumpFilePath
- Pathname for server dump, the current time is aggregated at the end of the file name.threshold
- Number of consecutive failures needed to trigger a dump.delay
- Minimal delay between 2 dumps (seconds).public int getStatus()
JMSStatusMBean
getStatus
in interface JMSStatusMBean
public String getStatusInfo()
JMSStatusMBean
getStatusInfo
in interface JMSStatusMBean
public int getPeriod()
JMSStatusMBean
getPeriod
in interface JMSStatusMBean
public void setPeriod(int period)
JMSStatusMBean
setPeriod
in interface JMSStatusMBean
period
- the activation period in seconds.public int getTimeout()
JMSStatusMBean
getTimeout
in interface JMSStatusMBean
public void setTimeout(int timeout)
JMSStatusMBean
setTimeout
in interface JMSStatusMBean
timeout
- the timeout used during check.public int getThreshold()
JMSStatusMBean
getThreshold
in interface JMSStatusMBean
public void setThreshold(int threshold)
JMSStatusMBean
setThreshold
in interface JMSStatusMBean
threshold
- the minimum number of failures before generating a dump.public int getDelay()
JMSStatusMBean
getDelay
in interface JMSStatusMBean
public void setDelay(int delay)
JMSStatusMBean
setDelay
in interface JMSStatusMBean
delay
- the minimal delay between 2 dumps.public void addConnectorStatus(String cfname, InitialContext ictx, String user, String pass, String qname, int period, int timeout)
cfname
- JNDI name of the ConnectionFactory to use.ictx
- JNDI context allowing to retrieve ConnectionFactory.user
- User name for authentication, if no defined uses the ConnectionFactory default.pass
- Password for authentication, if no defined uses the ConnectionFactory default.qname
- Internal name of JMS destination.period
- Period between 2 checks, by default 60s.timeout
- Maximum amount of time to wait connecting and receiving messages, by default 10s.static void checkDump(String name, int retry)
String getName()
InitialContext getInitialContext(String jndiFile, String jndiFactory, String jndiHost, String jndiPort) throws IOException, NamingException
jndiFile
- Path of JNDI properties file. If not defined, Joram's default are used. "fr.dyade.aaa.jndi2.client.NamingContextFactory" for
JNDI Factory, "localhost", and 16400 for host and port. These values can be overloaded by specific properties below.jndiFactory
- Classname of the JNDI factory (see "java.naming.factory.initial" property).jndiHost
- Hostname ou IP address of JNDI server.jndiPort
- Listening port of JNDI server.IOException
NamingException
public void start() throws Exception
start
in interface JMSStatusMBean
Exception
public void stop() throws Exception
stop
in interface JMSStatusMBean
Exception
void registerMBean()
void unregisterMBean()
public void dumpServerState(String path)
JMSStatusMBean
dumpServerState
in interface JMSStatusMBean
path
- Pathname of file to create.Copyright © 2023 ScalAgent D.T.. All rights reserved.