public static class RemoteUsage.UsageReader extends Object
Helps obtaining usage parameters by name.
This class can be instantiated directly by a client if an ObjectName reference has already been obtained, but is normally created and returned by calling on of the following methods (or the equivalent method for the unnamed parameter set):
Constructor and Description |
---|
UsageReader(MBeanServerConnection server,
ObjectName objectName)
Create an instance of UsageReader.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the Usage MBean.
|
long |
getCounterValue(String name,
boolean reset)
Get the value of a counter usage parameter.
|
int |
getParameterCount()
Get the number of usage parameters.
|
SampleStatistics |
getSampleStatistics(String name,
boolean reset)
Get the value of a sample usage parameter.
|
boolean |
isCounter(String name)
Check whether a usage parameter is a counter.
|
boolean |
isSample(String name)
Check whether a usage parameter is a sample statistic.
|
Iterator |
nameIterator()
Get an iterator of the usage parameter names.
|
public UsageReader(MBeanServerConnection server, ObjectName objectName) throws ManagementException
Create an instance of UsageReader.
server
- a server connectionobjectName
- the objectName of the Usage MBeanManagementException
public int getParameterCount() throws ManagementException
Get the number of usage parameters.
ManagementException
public Iterator nameIterator() throws ManagementException
Get an iterator of the usage parameter names.
ManagementException
public boolean isSample(String name)
Check whether a usage parameter is a sample statistic.
name
- usage parameter namepublic boolean isCounter(String name)
Check whether a usage parameter is a counter.
name
- usage parameter namepublic long getCounterValue(String name, boolean reset) throws ManagementException
Get the value of a counter usage parameter.
name
- usage parameter namereset
- if true, counter will be reset to zeroManagementException
public SampleStatistics getSampleStatistics(String name, boolean reset) throws ManagementException
Get the value of a sample usage parameter.
name
- usage parameter namereset
- if true, sample will be resetManagementException
public void close() throws ManagementException
Close the Usage MBean.
ManagementException
- if any problem occurs closing the MBean