|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
jrunx.kernel.ServiceAdapter | +--jrunx.metrics.MetricsService
| Field Summary | |
protected java.util.Stack |
available
|
protected int |
freeMemoryMetric
|
protected java.util.Vector |
history
|
protected long |
lastSnapshotTime
|
protected java.util.Map |
metricObjects
|
protected int[] |
metrics
|
protected int |
nextMetric
|
protected java.lang.Runtime |
rt
|
protected int |
totalMemoryMetric
|
| Fields inherited from class jrunx.kernel.ServiceAdapter |
DEFAULT_DEACTIVATED, DEFAULT_DOMAIN, DOMAIN_NAME_SEPARATOR, DOMAIN_NAME_SUFFIX, domainName, jndiBindable, LOGGER_CACHE_TIME, SCHEDULER_SERVICE, SECURITY_MANAGER, server, status, TRANSACTION_MANAGER |
| Fields inherited from interface jrunx.kernel.Service |
INITIALIZED, STARTED, STARTING, STOPPED, STOPPING, UNINITIALIZED |
| Fields inherited from interface jrunx.metrics.MetricsConstants |
METRICS_BUSY_TH, METRICS_DELAY_MS, METRICS_DELAY_RQ, METRICS_DELAY_TH, METRICS_DROPPED_RQ, METRICS_FREE_MEMORY, METRICS_IDLE_TH, METRICS_LISTEN_TH, METRICS_TOTAL_MEMORY, METRICS_TOTAL_TH |
| Constructor Summary | |
MetricsService()
|
|
| Method Summary | |
int |
createMetric(java.lang.String name)
create a metric with the given name |
int |
createMetric(java.lang.String name,
boolean reset)
create a metric with the given name. |
java.util.Properties |
createProperties(int[] values)
Create a Properties object with the metrics name as the key and the given values as the corresponding element. |
void |
deleteMetric(java.lang.String name)
remove a metric by name |
int[] |
exchangeMetrics(int[] values)
swap metrics arrays atomically. |
int |
findMetric(java.lang.String name)
look up a metric by name |
int |
getHistorySize()
Gets the current size of the metrics history buffer |
int |
getInitialSize()
Gets the initial size of the metrics array |
int |
getMetric(int index)
obtain the value of a metric |
Metrics |
getMetricsService()
Convenience method for returning a reference to the current object instance. |
int[] |
getSnapshot()
Take a snapshot of the current metrics. |
int[] |
getSnapshot(boolean reset)
Take a snapshot of the current metrics. |
java.util.Vector |
getSnapshotHistory()
Returns the snapshot history. |
long |
getSnapshotTime()
Returns the timestamp of the last snapshot. |
void |
init()
Not every service needs to init, implement it out of convenience. |
boolean |
isReset(java.lang.String name)
Determine if the metric should be reset when a snapshot is taken |
void |
setHistorySize(int size)
Sets the size of the metrics history buffer. |
void |
setInitialSize(int size)
Sets the initial size of the metrics array. |
void |
setMetric(int index,
int value)
change the value of a metric |
protected void |
trimHistory()
|
int |
updateMetric(int index,
int delta)
update the value of a metric by adding the given delta value in an atomic operation. |
| Methods inherited from interface jrunx.kernel.ServiceMBean |
bind, getBindToJNDI, getDeactivated, getDomainName, getJRunService, getLogger, getName, getParentService, getServerName, requestServer, setBindToJNDI, setDeactivated, setDomainName, setName, setParentService, unbind |
| Methods inherited from interface jrunx.kernel.Service |
destroy, getStatus, start, stop, updateStatus |
| Field Detail |
protected java.util.Vector history
protected int[] metrics
protected int nextMetric
protected java.util.Stack available
protected java.util.Map metricObjects
protected java.lang.Runtime rt
protected int freeMemoryMetric
protected int totalMemoryMetric
protected long lastSnapshotTime
| Constructor Detail |
public MetricsService()
| Method Detail |
public int getHistorySize()
MetricsServiceMBeangetHistorySize in interface MetricsServiceMBeanjrunx.metrics.MetricsServiceMBeanpublic void setHistorySize(int size)
MetricsServiceMBeansetHistorySize in interface MetricsServiceMBeanjrunx.metrics.MetricsServiceMBeansize - The size of the bufferprotected void trimHistory()
public int getInitialSize()
MetricsServiceMBeangetInitialSize in interface MetricsServiceMBeanjrunx.metrics.MetricsServiceMBeanpublic void setInitialSize(int size)
MetricsServiceMBeansetInitialSize in interface MetricsServiceMBeanjrunx.metrics.MetricsServiceMBeansize - The size of the metrics array
public void init()
throws java.lang.Exception
ServiceAdapterinit in interface Serviceinit in class ServiceAdapterpublic int createMetric(java.lang.String name)
MetricscreateMetric in interface Metricsjrunx.metrics.Metricsthe - name of the metric
public int createMetric(java.lang.String name,
boolean reset)
MetricscreateMetric in interface Metricsjrunx.metrics.Metricsname - the name of the metricreset - true if the value should be reset after loggingpublic void deleteMetric(java.lang.String name)
MetricsdeleteMetric in interface Metricsjrunx.metrics.Metricsname - String name of the metric to be deletedpublic int findMetric(java.lang.String name)
MetricsfindMetric in interface Metricsjrunx.metrics.Metricsthe - name
public void setMetric(int index,
int value)
MetricssetMetric in interface Metricsjrunx.metrics.Metricsindex - metric to be updatedvalue - the new valuepublic int getMetric(int index)
MetricsgetMetric in interface Metricsjrunx.metrics.Metricsindex - metric to be fetched
public int updateMetric(int index,
int delta)
MetricsupdateMetric in interface Metricsjrunx.metrics.Metricsindex - the metric indexpublic int[] exchangeMetrics(int[] values)
MetricsexchangeMetrics in interface Metricsjrunx.metrics.Metricsvalues - an old buffer to installpublic int[] getSnapshot()
MetricsgetSnapshot in interface Metricsjrunx.metrics.Metricspublic int[] getSnapshot(boolean reset)
MetricsgetSnapshot in interface Metricsjrunx.metrics.Metricsreset - true if the metrics should be resetpublic java.util.Vector getSnapshotHistory()
MetricsgetSnapshotHistory in interface Metricsjrunx.metrics.Metricspublic long getSnapshotTime()
MetricsgetSnapshotTime in interface Metricsjrunx.metrics.Metricspublic java.util.Properties createProperties(int[] values)
MetricscreateProperties in interface Metricsjrunx.metrics.MetricsThe - valuespublic boolean isReset(java.lang.String name)
MetricsisReset in interface Metricsjrunx.metrics.Metricsname - The metric namepublic Metrics getMetricsService()
MetricsServiceMBeangetMetricsService in interface MetricsServiceMBean
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||