public class StatsMonitor
extends com.streamscape.sef.dispatcher.AbstractStatsMonitor
Title: Service Event Fabric Runtime
Description: Defines a monitor that periodically collects the static and runtime statistics (OS, JVM, etc).
Copyright: Copyright (c) 2009
Company: StreamScape Technologies
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_CPU_EXCEEDING_INTERVAL |
Constructor and Description |
---|
StatsMonitor(RuntimeContext context)
Constructs the monitor with a default sampling interval (1000 msec).
|
StatsMonitor(RuntimeContext context,
int samplingInterval)
Constructs the monitor with the specified sampling interval (in milliseconds).
|
Modifier and Type | Method and Description |
---|---|
void |
addCpuThresholdListener(int threshold)
Adds a new listener that monitors the specified CPU threshold.
|
void |
addCpuThresholdListener(int threshold,
java.lang.String key)
Adds a new listener that monitors the specified CPU threshold.
|
void |
addCpuThresholdListener(int threshold,
java.lang.String key,
int interval)
Adds a new listener that monitors the specified CPU threshold.
|
void |
addDiskThresholdListener(int threshold)
Adds a new listener that monitors the specified disk threshold.
|
void |
addDiskThresholdListener(int threshold,
java.lang.String key)
Adds a new listener that monitors the specified disk threshold.
|
void |
addListener(java.lang.String name,
StatsListener listener)
Adds the specified specified listener.
|
void |
addMemoryThresholdListener(int threshold)
Adds a new listener that monitors the specified memory threshold.
|
void |
addMemoryThresholdListener(int threshold,
java.lang.String key)
Adds a new listener that monitors the specified memory threshold.
|
void |
clearCpuThresholdListeners()
Removes all CPU threshold listeners.
|
void |
clearDiskThresholdListeners()
Removes all disk threshold listeners.
|
void |
clearMemoryThresholdListeners()
Removes all memory threshold listeners.
|
java.util.List |
getCpuThresholds()
Returns a list of monitored CPU thresholds.
|
java.util.List |
getDiskThresholds()
Returns a list of monitored disk thresholds.
|
java.util.List |
getListeners()
Returns a list of all listeners.
|
java.util.List |
getMemoryThresholds()
Returns a list of monitored memory thresholds.
|
java.util.List |
getRemoteRuntimeStats()
Returns a list of snapshots of the JVM runtime statistics for all node in the sysplex.
|
RuntimeStats |
getRuntimeStats()
Returns a snapshot of the JVM runtime statistics.
|
long |
getSamplingInterval()
Returns the sampling interval of the monitor.
|
SystemEnvironment |
getSystemEnvironment()
Returns the system environment.
|
long |
getTotalSystemMemorySize()
Returns a total size of the system memory.
|
java.util.List |
listListeners()
Returns a list of names of all listeners.
|
StatsListener |
lookupListener(java.lang.String name)
Returns a listener with the specified name.
|
boolean |
removeCpuThresholdListener(int threshold)
Removes the specified CPU threshold listener.
|
boolean |
removeCpuThresholdListener(int threshold,
java.lang.String key)
Removes the specified CPU threshold listener.
|
boolean |
removeDiskThresholdListener(int threshold)
Removes the specified disk threshold listener.
|
boolean |
removeDiskThresholdListener(int threshold,
java.lang.String key)
Removes the specified disk threshold listener.
|
boolean |
removeListener(java.lang.String name)
Removes a listener with the specified name.
|
boolean |
removeMemoryThresholdListener(int threshold)
Removes the specified memory threshold listener.
|
boolean |
removeMemoryThresholdListener(int threshold,
java.lang.String key)
Removes the specified memory threshold listener.
|
void |
setCpuThresholdListenerInterval(int threshold,
java.lang.String key,
int interval)
Sets the exceeding interval for the specified CPU threshold listener.
|
void |
setSamplingInterval(int samplingInterval)
Sets the specified sampling interval of the monitor.
|
void |
start()
Starts an execution of the stats monitor.
|
void |
stop()
Starts an execution of the stats monitor.
|
public static final int DEFAULT_CPU_EXCEEDING_INTERVAL
public StatsMonitor(RuntimeContext context) throws FabricException
FabricException
public StatsMonitor(RuntimeContext context, int samplingInterval) throws FabricException
samplingInterval
- the specified sampling interval (in milliseconds).FabricException
- if the specified sampling interval is not positive.public void start()
public void stop()
public long getSamplingInterval()
public void setSamplingInterval(int samplingInterval) throws FabricException
samplingInterval
- the sampling interval to be set.StatsMonitorException
- if the specified sampling interval is not positive.FabricException
public SystemEnvironment getSystemEnvironment()
public long getTotalSystemMemorySize()
public RuntimeStats getRuntimeStats()
public java.util.List getRemoteRuntimeStats() throws StatsMonitorException
getRemoteRuntimeStats
in class com.streamscape.sef.dispatcher.AbstractStatsMonitor
StatsMonitorException
- if some other error occurs in the Exchange.public void addListener(java.lang.String name, StatsListener listener) throws StatsMonitorException
name
- the name of the listener.listener
- the listener to be added.StatsMonitorException
- if the specified listener already exists.public boolean removeListener(java.lang.String name)
name
- the name of the listener.true
if the specified listener was really removed, false
otherwise.public StatsListener lookupListener(java.lang.String name)
name
- the name of the listener.null
if the listener is not found.public java.util.List getListeners()
public java.util.List listListeners()
public void addMemoryThresholdListener(int threshold) throws StatsMonitorException
MemoryThresholdAdvisory
will be raised.
The listener will be added with name MemoryThreshold<threshold> (e.g. MemoryThreshold25
).
threshold
- the specified threshold.StatsMonitorException
- if the threshold is not positive or
if the listener for the specified threshold already exists.public void addMemoryThresholdListener(int threshold, java.lang.String key) throws StatsMonitorException
MemoryThresholdAdvisory
will be raised.
The key is assigned to eventKey
property of the corresponding advisory.
The listener will be added with name MemoryThreshold<threshold>_<key> (e.g. MemoryThreshold25_Bob
).
threshold
- the specified threshold (in megabytes).key
- the key associated with the threshold.StatsMonitorException
- if the threshold is not positive or
if the listener for the specified threshold and key already exists.public boolean removeMemoryThresholdListener(int threshold)
threshold
- the specified threshold.true
if the specified listener was really removed, false
otherwise.public boolean removeMemoryThresholdListener(int threshold, java.lang.String key)
threshold
- the specified threshold.key
- the key associated with the specified threshold.true
if the specified listener was really removed, false
otherwise.public void clearMemoryThresholdListeners()
public java.util.List getMemoryThresholds()
public void addCpuThresholdListener(int threshold) throws StatsMonitorException
5
seconds,
the CpuThresholdAdvisory
will be raised.
The listener will be added with name CpuThreshold<threshold> (e.g. CpuThreshold25
).
threshold
- the specified threshold.StatsMonitorException
- if the threshold is not int range [1, 100]
or
if the listener for the specified threshold already exists.public void addCpuThresholdListener(int threshold, java.lang.String key) throws StatsMonitorException
5
seconds,
the CpuThresholdAdvisory
will be raised.
The key is assigned to eventKey
property of the corresponding advisory.
The listener will be added with name CpuThreshold<threshold>_<key> (e.g. CpuThreshold25_Bob
).
threshold
- the specified threshold.key
- the key associated with the specified threshold.StatsMonitorException
- if the threshold is not int range [1, 100]
or
if the listener for the specified threshold and key already exists.public void addCpuThresholdListener(int threshold, java.lang.String key, int interval) throws StatsMonitorException
CpuThresholdAdvisory
will be raised.
The key is assigned to eventKey
property of the corresponding advisory.
The listener will be added with name CpuThreshold<threshold>_<key> (e.g. CpuThreshold25_Bob
).
threshold
- the specified threshold.key
- the key associated with the specified threshold.interval
- the specified exceeding interval (in seconds).StatsMonitorException
- if the threshold is not int range [1, 100]
or
if the interval is not positive or
if the listener for the specified threshold and key already exists.public boolean removeCpuThresholdListener(int threshold)
threshold
- the specified threshold.true
if the specified listener was really removed, false
otherwise.public boolean removeCpuThresholdListener(int threshold, java.lang.String key)
threshold
- the specified threshold.key
- the key associated with the specified threshold.true
if the specified listener was really removed, false
otherwise.public void clearCpuThresholdListeners()
public void setCpuThresholdListenerInterval(int threshold, java.lang.String key, int interval) throws StatsMonitorException
threshold
- the specified threshold.key
- the key associated with the specified threshold.interval
- the specified exceeding interval (in seconds).StatsMonitorException
- if a listener for the specified threshold does not exist or
if the interval is not positive.public java.util.List getCpuThresholds()
public void addDiskThresholdListener(int threshold) throws StatsMonitorException
DiskThresholdAdvisory
will be raised.
The listener will be added with name DiskThreshold<threshold> (e.g. DiskThreshold25
).
threshold
- the specified threshold.StatsMonitorException
- if the threshold is not int range [1, 100]
or
if the listener for the specified threshold already exists.public void addDiskThresholdListener(int threshold, java.lang.String key) throws StatsMonitorException
DiskThresholdAdvisory
will be raised.
The key is assigned to eventKey
property of the corresponding advisory.
The listener will be added with name DiskThreshold<threshold>_<key> (e.g. DiskThreshold25_Bob
).
threshold
- the specified threshold (in megabytes).key
- the key associated with the threshold.StatsMonitorException
- if the threshold is not positive or
if the listener for the specified threshold and key already exists.public boolean removeDiskThresholdListener(int threshold)
threshold
- the specified threshold.true
if the specified listener was really removed, false
otherwise.public boolean removeDiskThresholdListener(int threshold, java.lang.String key)
threshold
- the specified threshold.key
- the key associated with the specified threshold.true
if the specified listener was really removed, false
otherwise.public void clearDiskThresholdListeners()
public java.util.List getDiskThresholds()
Copyright © 2015-2024 StreamScape Technologies. All rights reserved.