GemFire 6.6.2

com.gemstone.gemfire
Interface Statistics


public interface Statistics

Instances of this interface maintain the values of various application-defined statistics. The statistics themselves are described by an instance of StatisticsType.

To get an instance of this interface use an instance of StatisticsFactory.

For improved performance, each statistic may be referred to by its descriptor.

For optimal performance, each statistic may be referred to by its id in the statistics object. Note that ids can not be mapped back to their name and methods that take ids are unsafe. It is important to call the correct type of method for the given id. For example if your stat is a long then incLong must be called instead of incInt.

Note that as of the 5.1 release the incInt, incLong, and incDouble methods no longer return the new value of the statistic. They now return void. This incompatible change was made to allow for a more efficient concurrent increment implementation.

Since:
3.0
See Also:
Package introduction

Method Summary
 void close()
          Closes these statistics.
 Number get(StatisticDescriptor descriptor)
          Returns the value of the identified statistic.
 Number get(String name)
          Returns the value of the named statistic.
 double getDouble(int id)
          Returns the value of the identified statistic of type double.
 double getDouble(StatisticDescriptor descriptor)
          Returns the value of the described statistic of type double.
 double getDouble(String name)
          Returns the value of the statistic of type double at the given name.
 int getInt(int id)
          Returns the value of the identified statistic of type int.
 int getInt(StatisticDescriptor descriptor)
          Returns the value of the described statistic of type int.
 int getInt(String name)
          Returns the value of the statistic of type int at the given name.
 long getLong(int id)
          Returns the value of the identified statistic of type long.
 long getLong(StatisticDescriptor descriptor)
          Returns the value of the described statistic of type long.
 long getLong(String name)
          Returns the value of the statistic of type long at the given name.
 long getNumericId()
          Gets the number associated with this instance that helps identify it.
 long getRawBits(StatisticDescriptor descriptor)
          Returns the bits that represent the raw value of the described statistic.
 long getRawBits(String name)
          Returns the bits that represent the raw value of the named statistic.
 String getTextId()
          Gets the text associated with this instance that helps identify it.
 StatisticsType getType()
          Gets the StatisticsType of this instance.
 long getUniqueId()
          Gets a value that uniquely identifies this statistics.
 void incDouble(int id, double delta)
          Increments the value of the identified statistic of type double by the given amount.
 void incDouble(StatisticDescriptor descriptor, double delta)
          Increments the value of the described statistic of type double by the given amount.
 void incDouble(String name, double delta)
          Increments the value of the statistic of type double with the given name by a given amount.
 void incInt(int id, int delta)
          Increments the value of the identified statistic of type int by the given amount.
 void incInt(StatisticDescriptor descriptor, int delta)
          Increments the value of the described statistic of type int by the given amount.
 void incInt(String name, int delta)
          Increments the value of the statistic of type int with the given name by a given amount.
 void incLong(int id, long delta)
          Increments the value of the identified statistic of type long by the given amount.
 void incLong(StatisticDescriptor descriptor, long delta)
          Increments the value of the described statistic of type long by the given amount.
 void incLong(String name, long delta)
          Increments the value of the statistic of type long with the given name by a given amount.
 boolean isAtomic()
          Returns true if modifications are atomic.
 boolean isClosed()
          Returns true if the instance has been closed.
 StatisticDescriptor nameToDescriptor(String name)
          Returns the descriptor of the statistic with the given name in this statistics instance.
 int nameToId(String name)
          Returns the id of the statistic with the given name in this statistics instance.
 void setDouble(int id, double value)
          Sets the value of a statistic with the given id whose type is double.
 void setDouble(StatisticDescriptor descriptor, double value)
          Sets the value of a described statistic of type double
 void setDouble(String name, double value)
          Sets the value of a named statistic of type double.
 void setInt(int id, int value)
          Sets the value of a statistic with the given id whose type is int.
 void setInt(StatisticDescriptor descriptor, int value)
          Sets the value of a described statistic of type int
 void setInt(String name, int value)
          Sets the value of a named statistic of type int
 void setLong(int id, long value)
          Sets the value of a statistic with the given id whose type is long.
 void setLong(StatisticDescriptor descriptor, long value)
          Sets the value of a described statistic of type long
 void setLong(String name, long value)
          Sets the value of a named statistic of type long.
 

Method Detail

close

void close()
Closes these statistics. After statistics have been closed, they are no longer archived. A value access on a closed statistics always results in zero. A value modification on a closed statistics is ignored.


nameToId

int nameToId(String name)
Returns the id of the statistic with the given name in this statistics instance.

Throws:
IllegalArgumentException - No statistic named name exists in this statistics instance.
See Also:
StatisticsType.nameToId(java.lang.String)

nameToDescriptor

StatisticDescriptor nameToDescriptor(String name)
Returns the descriptor of the statistic with the given name in this statistics instance.

Throws:
IllegalArgumentException - No statistic named name exists in this statistics instance.
See Also:
StatisticsType.nameToDescriptor(java.lang.String)

getUniqueId

long getUniqueId()
Gets a value that uniquely identifies this statistics.


getType

StatisticsType getType()
Gets the StatisticsType of this instance.


getTextId

String getTextId()
Gets the text associated with this instance that helps identify it.


getNumericId

long getNumericId()
Gets the number associated with this instance that helps identify it.


isAtomic

boolean isAtomic()
Returns true if modifications are atomic. This means that multiple threads, can safely modify this instance without extra synchronization.

Returns false if modifications are not atomic. This means that modifications to this instance are cheaper but not thread safe.


isClosed

boolean isClosed()
Returns true if the instance has been closed.


setInt

void setInt(int id,
            int value)
Sets the value of a statistic with the given id whose type is int.

Parameters:
id - a statistic id obtained with nameToId(java.lang.String) or StatisticsType.nameToId(java.lang.String).
Throws:
ArrayIndexOutOfBoundsException - If the id is invalid.

setInt

void setInt(String name,
            int value)
Sets the value of a named statistic of type int

Throws:
IllegalArgumentException - If no statistic exists named name or if the statistic with name name is not of type int.

setInt

void setInt(StatisticDescriptor descriptor,
            int value)
Sets the value of a described statistic of type int

Throws:
IllegalArgumentException - If no statistic exists for the given descriptor or if the described statistic is not of type int.

setLong

void setLong(int id,
             long value)
Sets the value of a statistic with the given id whose type is long.

Parameters:
id - a statistic id obtained with nameToId(java.lang.String) or StatisticsType.nameToId(java.lang.String).
Throws:
ArrayIndexOutOfBoundsException - If the id is invalid.

setLong

void setLong(StatisticDescriptor descriptor,
             long value)
Sets the value of a described statistic of type long

Throws:
IllegalArgumentException - If no statistic exists for the given descriptor or if the described statistic is not of type long.

setLong

void setLong(String name,
             long value)
Sets the value of a named statistic of type long.

Throws:
IllegalArgumentException - If no statistic exists named name or if the statistic with name name is not of type long.

setDouble

void setDouble(int id,
               double value)
Sets the value of a statistic with the given id whose type is double.

Parameters:
id - a statistic id obtained with nameToId(java.lang.String) or StatisticsType.nameToId(java.lang.String).
Throws:
ArrayIndexOutOfBoundsException - If the id is invalid.

setDouble

void setDouble(StatisticDescriptor descriptor,
               double value)
Sets the value of a described statistic of type double

Throws:
IllegalArgumentException - If no statistic exists for the given descriptor or if the described statistic is not of type double.

setDouble

void setDouble(String name,
               double value)
Sets the value of a named statistic of type double.

Throws:
IllegalArgumentException - If no statistic exists named name or if the statistic with name name is not of type double.

getInt

int getInt(int id)
Returns the value of the identified statistic of type int.

Parameters:
id - a statistic id obtained with nameToId(java.lang.String) or StatisticsType.nameToId(java.lang.String).
Throws:
ArrayIndexOutOfBoundsException - If the id is invalid.

getInt

int getInt(StatisticDescriptor descriptor)
Returns the value of the described statistic of type int.

Throws:
IllegalArgumentException - If no statistic exists with the specified descriptor or if the described statistic is not of type int.

getInt

int getInt(String name)
Returns the value of the statistic of type int at the given name.

Throws:
IllegalArgumentException - If no statistic exists with name name or if the statistic named name is not of type int.

getLong

long getLong(int id)
Returns the value of the identified statistic of type long.

Parameters:
id - a statistic id obtained with nameToId(java.lang.String) or StatisticsType.nameToId(java.lang.String).
Throws:
ArrayIndexOutOfBoundsException - If the id is invalid.

getLong

long getLong(StatisticDescriptor descriptor)
Returns the value of the described statistic of type long.

Throws:
IllegalArgumentException - If no statistic exists with the specified descriptor or if the described statistic is not of type long.

getLong

long getLong(String name)
Returns the value of the statistic of type long at the given name.

Throws:
IllegalArgumentException - If no statistic exists with name name or if the statistic named name is not of type long.

getDouble

double getDouble(int id)
Returns the value of the identified statistic of type double.

Parameters:
id - a statistic id obtained with nameToId(java.lang.String) or StatisticsType.nameToId(java.lang.String).
Throws:
ArrayIndexOutOfBoundsException - If the id is invalid.

getDouble

double getDouble(StatisticDescriptor descriptor)
Returns the value of the described statistic of type double.

Throws:
IllegalArgumentException - If no statistic exists with the specified descriptor or if the described statistic is not of type double.

getDouble

double getDouble(String name)
Returns the value of the statistic of type double at the given name.

Throws:
IllegalArgumentException - If no statistic exists with name name or if the statistic named name is not of type double.

get

Number get(StatisticDescriptor descriptor)
Returns the value of the identified statistic.

Parameters:
descriptor - a statistic descriptor obtained with nameToDescriptor(java.lang.String) or StatisticsType.nameToDescriptor(java.lang.String).
Throws:
IllegalArgumentException - If the described statistic does not exist

get

Number get(String name)
Returns the value of the named statistic.

Throws:
IllegalArgumentException - If the named statistic does not exist

getRawBits

long getRawBits(StatisticDescriptor descriptor)
Returns the bits that represent the raw value of the described statistic.

Parameters:
descriptor - a statistic descriptor obtained with nameToDescriptor(java.lang.String) or StatisticsType.nameToDescriptor(java.lang.String).
Throws:
IllegalArgumentException - If the described statistic does not exist

getRawBits

long getRawBits(String name)
Returns the bits that represent the raw value of the named statistic.

Throws:
IllegalArgumentException - If the named statistic does not exist

incInt

void incInt(int id,
            int delta)
Increments the value of the identified statistic of type int by the given amount.

Parameters:
id - a statistic id obtained with nameToId(java.lang.String) or StatisticsType.nameToId(java.lang.String).
Throws:
ArrayIndexOutOfBoundsException - If the id is invalid.

incInt

void incInt(StatisticDescriptor descriptor,
            int delta)
Increments the value of the described statistic of type int by the given amount.

Throws:
IllegalArgumentException - If no statistic exists with the given descriptor or if the described statistic is not of type int.

incInt

void incInt(String name,
            int delta)
Increments the value of the statistic of type int with the given name by a given amount.

Throws:
IllegalArgumentException - If no statistic exists with name name or if the statistic named name is not of type int.

incLong

void incLong(int id,
             long delta)
Increments the value of the identified statistic of type long by the given amount.

Parameters:
id - a statistic id obtained with nameToId(java.lang.String) or StatisticsType.nameToId(java.lang.String).
Throws:
ArrayIndexOutOfBoundsException - If the id is invalid.

incLong

void incLong(StatisticDescriptor descriptor,
             long delta)
Increments the value of the described statistic of type long by the given amount.

Throws:
IllegalArgumentException - If no statistic exists with the given descriptor or if the described statistic is not of type long.

incLong

void incLong(String name,
             long delta)
Increments the value of the statistic of type long with the given name by a given amount.

Throws:
IllegalArgumentException - If no statistic exists with name name or if the statistic named name is not of type long.

incDouble

void incDouble(int id,
               double delta)
Increments the value of the identified statistic of type double by the given amount.

Parameters:
id - a statistic id obtained with nameToId(java.lang.String) or StatisticsType.nameToId(java.lang.String).
Throws:
ArrayIndexOutOfBoundsException - If the id is invalid.

incDouble

void incDouble(StatisticDescriptor descriptor,
               double delta)
Increments the value of the described statistic of type double by the given amount.

Throws:
IllegalArgumentException - If no statistic exists with the given descriptor or if the described statistic is not of type double.

incDouble

void incDouble(String name,
               double delta)
Increments the value of the statistic of type double with the given name by a given amount.

Throws:
IllegalArgumentException - If no statistic exists with name name or if the statistic named name is not of type double.

GemFire 6.6.2

Copyright © 1997-2012 VMware, Inc. All rights reserved.