public interface Statistics
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 incDouble.
Note that as of the 5.1 release the 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.
Modifier and Type | Method and Description |
---|---|
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)
Deprecated.
as of Geode 1.10, use
getLong(int) instead |
int |
getInt(StatisticDescriptor descriptor)
Deprecated.
as of Geode 1.10, use
getLong(StatisticDescriptor) instead |
int |
getInt(String name)
Deprecated.
as of Geode 1.10, use
getLong(String) instead |
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)
Deprecated.
as of Geode 1.10, use
incLong(int, long) instead |
void |
incInt(StatisticDescriptor descriptor,
int delta)
Deprecated.
as of Geode 1.10, use
incLong(StatisticDescriptor, long) instead |
void |
incInt(String name,
int delta)
Deprecated.
as of Geode 1.10, use
incLong(String, long) instead |
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 . |
DoubleSupplier |
setDoubleSupplier(int id,
DoubleSupplier supplier)
Provide a callback to compute the value of this statistic every sample interval and use that as
the value of the stat.
|
DoubleSupplier |
setDoubleSupplier(StatisticDescriptor descriptor,
DoubleSupplier supplier)
Provide a callback to compute the value of this statistic every sample interval and use that as
the value of the stat.
|
DoubleSupplier |
setDoubleSupplier(String name,
DoubleSupplier supplier)
Provide a callback to compute the value of this statistic every sample interval and use that as
the value of the stat.
|
void |
setInt(int id,
int value)
Deprecated.
as of Geode 1.10, use
setLong(int, long) instead |
void |
setInt(StatisticDescriptor descriptor,
int value)
Deprecated.
as of Geode 1.10, use
setLong(StatisticDescriptor, long) instead |
void |
setInt(String name,
int value)
Deprecated.
as of Geode 1.10, use
setLong(String, long) instead |
IntSupplier |
setIntSupplier(int id,
IntSupplier supplier)
Deprecated.
as of Geode 1.10, use
setLongSupplier(int, LongSupplier) instead |
IntSupplier |
setIntSupplier(StatisticDescriptor descriptor,
IntSupplier supplier)
Deprecated.
as of Geode 1.10, use
setLongSupplier(StatisticDescriptor, LongSupplier)
instead |
IntSupplier |
setIntSupplier(String name,
IntSupplier supplier)
Deprecated.
as of Geode 1.10, use
setLongSupplier(String, LongSupplier) instead |
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 . |
LongSupplier |
setLongSupplier(int id,
LongSupplier supplier)
Provide a callback to compute the value of this statistic every sample interval and use that as
the value of the stat.
|
LongSupplier |
setLongSupplier(StatisticDescriptor descriptor,
LongSupplier supplier)
Provide a callback to compute the value of this statistic every sample interval and use that as
the value of the stat.
|
LongSupplier |
setLongSupplier(String name,
LongSupplier supplier)
Provide a callback to compute the value of this statistic every sample interval and use that as
the value of the stat.
|
void close()
int nameToId(String name)
name
- the name of the statisticIllegalArgumentException
- No statistic named name
exists in this statistics
instance.StatisticsType.nameToId(java.lang.String)
StatisticDescriptor nameToDescriptor(String name)
name
- the name of the statisticdescriptor
of the statisticIllegalArgumentException
- No statistic named name
exists in this statistics
instance.StatisticsType.nameToDescriptor(java.lang.String)
long getUniqueId()
StatisticsType getType()
StatisticsType
of this instance.StatisticsType
of this instanceString getTextId()
long getNumericId()
boolean isAtomic()
Returns false if modifications are not atomic. This means that modifications to this instance are cheaper but not thread safe.
boolean isClosed()
closed
.closed
.@Deprecated void setInt(int id, int value)
setLong(int, long)
insteadid
whose type is int
.id
- a statistic id obtained with nameToId(java.lang.String)
or StatisticsType.nameToId(java.lang.String)
.value
- the value to set the statistic toArrayIndexOutOfBoundsException
- If the id is invalid.@Deprecated void setInt(String name, int value)
setLong(String, long)
insteadint
name
- the name of the statisticvalue
- the value to set the statistic toIllegalArgumentException
- If no statistic exists named name
or if the
statistic with name name
is not of type int
.@Deprecated void setInt(StatisticDescriptor descriptor, int value)
setLong(StatisticDescriptor, long)
insteadint
descriptor
- a statistic descriptor obtained with nameToDescriptor(java.lang.String)
or
StatisticsType.nameToDescriptor(java.lang.String)
.value
- the value to set the statistic toIllegalArgumentException
- If no statistic exists for the given descriptor
or if the described statistic is not of type int
.void setLong(int id, long value)
id
whose type is long
.id
- a statistic id obtained with nameToId(java.lang.String)
or StatisticsType.nameToId(java.lang.String)
.value
- the value to set the statistic toArrayIndexOutOfBoundsException
- If the id is invalid.void setLong(StatisticDescriptor descriptor, long value)
long
descriptor
- a statistic descriptor obtained with nameToDescriptor(java.lang.String)
or
StatisticsType.nameToDescriptor(java.lang.String)
.value
- the value to set the statistic toIllegalArgumentException
- If no statistic exists for the given descriptor
or if the described statistic is not of type long
.void setLong(String name, long value)
long
.name
- the name of the statisticvalue
- the value to set the statistic toIllegalArgumentException
- If no statistic exists named name
or if the
statistic with name name
is not of type long
.void setDouble(int id, double value)
id
whose type is double
.id
- a statistic id obtained with nameToId(java.lang.String)
or StatisticsType.nameToId(java.lang.String)
.value
- the value to set the statistic toArrayIndexOutOfBoundsException
- If the id is invalid.void setDouble(StatisticDescriptor descriptor, double value)
double
descriptor
- a statistic descriptor obtained with nameToDescriptor(java.lang.String)
or
StatisticsType.nameToDescriptor(java.lang.String)
.value
- the value to set the statistic toIllegalArgumentException
- If no statistic exists for the given descriptor
or if the described statistic is not of type double
.void setDouble(String name, double value)
double
.name
- the name of the statisticvalue
- the value to set the statistic toIllegalArgumentException
- If no statistic exists named name
or if the
statistic with name name
is not of type double
.@Deprecated int getInt(int id)
getLong(int)
insteadint
.id
- a statistic id obtained with nameToId(java.lang.String)
or StatisticsType.nameToId(java.lang.String)
.ArrayIndexOutOfBoundsException
- If the id is invalid.@Deprecated int getInt(StatisticDescriptor descriptor)
getLong(StatisticDescriptor)
insteadint
.descriptor
- a statistic descriptor obtained with nameToDescriptor(java.lang.String)
or
StatisticsType.nameToDescriptor(java.lang.String)
.IllegalArgumentException
- If no statistic exists with the specified
descriptor
or if the described statistic is not of type int
.@Deprecated int getInt(String name)
getLong(String)
insteadint
at the given name.name
- the name of the statisticIllegalArgumentException
- If no statistic exists with name name
or if the
statistic named name
is not of type int
.long getLong(int id)
long
.id
- a statistic id obtained with nameToId(java.lang.String)
or StatisticsType.nameToId(java.lang.String)
.ArrayIndexOutOfBoundsException
- If the id is invalid.long getLong(StatisticDescriptor descriptor)
long
.descriptor
- a statistic descriptor obtained with nameToDescriptor(java.lang.String)
or
StatisticsType.nameToDescriptor(java.lang.String)
.IllegalArgumentException
- If no statistic exists with the specified
descriptor
or if the described statistic is not of type long
.long getLong(String name)
long
at the given name.name
- the name of the statisticIllegalArgumentException
- If no statistic exists with name name
or if the
statistic named name
is not of type long
.double getDouble(int id)
double
.id
- a statistic id obtained with nameToId(java.lang.String)
or StatisticsType.nameToId(java.lang.String)
.ArrayIndexOutOfBoundsException
- If the id is invalid.double getDouble(StatisticDescriptor descriptor)
double
.descriptor
- a statistic descriptor obtained with nameToDescriptor(java.lang.String)
or
StatisticsType.nameToDescriptor(java.lang.String)
.IllegalArgumentException
- If no statistic exists with the specified
descriptor
or if the described statistic is not of type
double
.double getDouble(String name)
double
at the given name.name
- the name of the statisticIllegalArgumentException
- If no statistic exists with name name
or if the
statistic named name
is not of type double
.Number get(StatisticDescriptor descriptor)
descriptor
- a statistic descriptor obtained with nameToDescriptor(java.lang.String)
or
StatisticsType.nameToDescriptor(java.lang.String)
.IllegalArgumentException
- If the described statistic does not existNumber get(String name)
name
- the name of the statisticIllegalArgumentException
- If the named statistic does not existlong getRawBits(StatisticDescriptor descriptor)
descriptor
- a statistic descriptor obtained with nameToDescriptor(java.lang.String)
or
StatisticsType.nameToDescriptor(java.lang.String)
.IllegalArgumentException
- If the described statistic does not existlong getRawBits(String name)
name
- the name of the statisticIllegalArgumentException
- If the named statistic does not exist@Deprecated void incInt(int id, int delta)
incLong(int, long)
insteadint
by the given amount.id
- a statistic id obtained with nameToId(java.lang.String)
or StatisticsType.nameToId(java.lang.String)
.delta
- the amount by which to increment the statistic valueArrayIndexOutOfBoundsException
- If the id is invalid.@Deprecated void incInt(StatisticDescriptor descriptor, int delta)
incLong(StatisticDescriptor, long)
insteadint
by the given amount.descriptor
- the descriptor for the statistic to incrementdelta
- the amount by which to increment the statistic valueIllegalArgumentException
- If no statistic exists with the given descriptor
or if the described statistic is not of type int
.@Deprecated void incInt(String name, int delta)
incLong(String, long)
insteadint
with the given name by a given
amount.name
- the name of the statistic to incrementdelta
- the amount by which to increment the statistic valueIllegalArgumentException
- If no statistic exists with name name
or if the
statistic named name
is not of type int
.void incLong(int id, long delta)
long
by the given amount.id
- a statistic id obtained with nameToId(java.lang.String)
or StatisticsType.nameToId(java.lang.String)
.delta
- the amount by which to increment the statistic valueArrayIndexOutOfBoundsException
- If the id is invalid.void incLong(StatisticDescriptor descriptor, long delta)
long
by the given amount.descriptor
- the descriptor for the statistic to incrementdelta
- the amount by which to increment the statistic valueIllegalArgumentException
- If no statistic exists with the given descriptor
or if the described statistic is not of type long
.void incLong(String name, long delta)
long
with the given name by a given
amount.name
- the name of the statistic to incrementdelta
- the amount by which to increment the statistic valueIllegalArgumentException
- If no statistic exists with name name
or if the
statistic named name
is not of type long
.void incDouble(int id, double delta)
double
by the given
amount.id
- a statistic id obtained with nameToId(java.lang.String)
or StatisticsType.nameToId(java.lang.String)
.delta
- the amount by which to increment the statistic valueArrayIndexOutOfBoundsException
- If the id is invalid.void incDouble(StatisticDescriptor descriptor, double delta)
double
by the given
amount.descriptor
- the descriptor for the statistic to incrementdelta
- the amount by which to increment the statistic valueIllegalArgumentException
- If no statistic exists with the given descriptor
or if the described statistic is not of type double
.void incDouble(String name, double delta)
double
with the given name by a
given amount.name
- the name of the statistic to incrementdelta
- the amount by which to increment the statistic valueIllegalArgumentException
- If no statistic exists with name name
or if the
statistic named name
is not of type double
.@Deprecated IntSupplier setIntSupplier(int id, IntSupplier supplier)
setLongSupplier(int, LongSupplier)
insteadThe callback should return quickly because it is invoked on a shared thread. It should not do any expensive computations, network calls, or access any resources under locks that may be locked by long running processes.
This callback will only be invoked if the distributed system property statistic-sampling-enabled is set to true, and it will be invoked at intervals determined by the statistic-sampling-rate.
Get methods are not guaranteed to recompute a new value, they may return the last sampled value
id
- a statistic id obtained with nameToId(java.lang.String)
or StatisticsType.nameToId(java.lang.String)
.supplier
- a callback that will return the value of the stat. This replaces any previously
registered supplier. If the passed in supplier is null, it will remove any existing
supplierIllegalArgumentException
- If the id is invalid.@Deprecated IntSupplier setIntSupplier(String name, IntSupplier supplier)
setLongSupplier(String, LongSupplier)
insteadThe callback should return quickly because it is invoked on a shared thread. It should not do any expensive computations, network calls, or access any resources under locks that may be locked by long running processes.
This callback will only be invoked if the distributed system property statistic-sampling-enabled is set to true, and it will be invoked at intervals determined by the statistic-sampling-rate.
Get methods are not guaranteed to recompute a new value, they may return the last sampled value
name
- the name of the statistic to updatesupplier
- a callback that will return the value of the stat. This replaces any previously
registered supplier. If the passed in supplier is null, it will remove any existing
supplierIllegalArgumentException
- If no statistic exists with name name
or if the
statistic named name
is not of type int
.@Deprecated IntSupplier setIntSupplier(StatisticDescriptor descriptor, IntSupplier supplier)
setLongSupplier(StatisticDescriptor, LongSupplier)
insteadThe callback should return quickly because it is invoked on a shared thread. It should not do any expensive computations, network calls, or access any resources under locks that may be locked by long running processes.
This callback will only be invoked if the distributed system property statistic-sampling-enabled is set to true, and it will be invoked at intervals determined by the statistic-sampling-rate.
Get methods are not guaranteed to recompute a new value, they may return the last sampled value
descriptor
- the descriptor of the statistic to updatesupplier
- a callback that will return the value of the stat. This replaces any previously
registered supplier. If the passed in supplier is null, it will remove any existing
supplierIllegalArgumentException
- If no statistic exists with the given descriptor
or if the described statistic is not of type int
.LongSupplier setLongSupplier(int id, LongSupplier supplier)
The callback should return quickly because it is invoked on a shared thread. It should not do any expensive computations, network calls, or access any resources under locks that may be locked by long running processes.
This callback will only be invoked if the distributed system property statistic-sampling-enabled is set to true, and it will be invoked at intervals determined by the statistic-sampling-rate.
Get methods are not guaranteed to recompute a new value, they may return the last sampled value
id
- a statistic id obtained with nameToId(java.lang.String)
or StatisticsType.nameToId(java.lang.String)
.supplier
- a callback that will return the value of the stat. This replaces any previously
registered supplier. If the passed in supplier is null, it will remove any existing
supplierIllegalArgumentException
- If the id is invalid.LongSupplier setLongSupplier(String name, LongSupplier supplier)
The callback should return quickly because it is invoked on a shared thread. It should not do any expensive computations, network calls, or access any resources under locks that may be locked by long running processes.
This callback will only be invoked if the distributed system property statistic-sampling-enabled is set to true, and it will be invoked at intervals determined by the statistic-sampling-rate.
Get methods are not guaranteed to recompute a new value, they may return the last sampled value
name
- the name of the statistic to updatesupplier
- a callback that will return the value of the stat. This replaces any previously
registered supplier. If the passed in supplier is null, it will remove any existing
supplierIllegalArgumentException
- If no statistic exists with name name
or if the
statistic named name
is not of type long
.LongSupplier setLongSupplier(StatisticDescriptor descriptor, LongSupplier supplier)
The callback should return quickly because it is invoked on a shared thread. It should not do any expensive computations, network calls, or access any resources under locks that may be locked by long running processes.
This callback will only be invoked if the distributed system property statistic-sampling-enabled is set to true, and it will be invoked at intervals determined by the statistic-sampling-rate.
Get methods are not guaranteed to recompute a new value, they may return the last sampled value
descriptor
- the descriptor of the statistic to updatesupplier
- a callback that will return the value of the stat. This replaces any previously
registered supplier. If the passed in supplier is null, it will remove any existing
supplierIllegalArgumentException
- If no statistic exists with the given descriptor
or if the described statistic is not of type long
.DoubleSupplier setDoubleSupplier(int id, DoubleSupplier supplier)
The callback should return quickly because it is invoked on a shared thread. It should not do any expensive computations, network calls, or access any resources under locks that may be locked by double running processes.
This callback will only be invoked if the distributed system property statistic-sampling-enabled is set to true, and it will be invoked at intervals determined by the statistic-sampling-rate.
Get methods are not guaranteed to recompute a new value, they may return the last sampled value
id
- a statistic id obtained with nameToId(java.lang.String)
or StatisticsType.nameToId(java.lang.String)
.supplier
- a callback that will return the value of the stat. This replaces any previously
registered supplier. If the passed in supplier is null, it will remove any existing
supplierIllegalArgumentException
- If the id is invalid.DoubleSupplier setDoubleSupplier(String name, DoubleSupplier supplier)
The callback should return quickly because it is invoked on a shared thread. It should not do any expensive computations, network calls, or access any resources under locks that may be locked by double running processes.
This callback will only be invoked if the distributed system property statistic-sampling-enabled is set to true, and it will be invoked at intervals determined by the statistic-sampling-rate.
Get methods are not guaranteed to recompute a new value, they may return the last sampled value
name
- the name of the statistic to updatesupplier
- a callback that will return the value of the stat. This replaces any previously
registered supplier. If the passed in supplier is null, it will remove any existing
supplierIllegalArgumentException
- If no statistic exists with name name
or if the
statistic named name
is not of type double
.DoubleSupplier setDoubleSupplier(StatisticDescriptor descriptor, DoubleSupplier supplier)
The callback should return quickly because it is invoked on a shared thread. It should not do any expensive computations, network calls, or access any resources under locks that may be locked by double running processes.
This callback will only be invoked if the distributed system property statistic-sampling-enabled is set to true, and it will be invoked at intervals determined by the statistic-sampling-rate.
Get methods are not guaranteed to recompute a new value, they may return the last sampled value
descriptor
- the descriptor of the statistic to updatesupplier
- a callback that will return the value of the stat. This replaces any previously
registered supplier. If the passed in supplier is null, it will remove any existing
supplierIllegalArgumentException
- If no statistic exists with the given descriptor
or if the described statistic is not of type double
.