VMware GemFire Java API Reference
Interface Statistics
-
public interface StatisticsInstances of this interface maintain the values of various application-defined statistics. The statistics themselves are described by an instance ofStatisticsType.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
idin 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, andincDoublemethods no longer return the new value of the statistic. They now returnvoid. This incompatible change was made to allow for a more efficient concurrent increment implementation.- Since:
- GemFire 3.0
- See Also:
- Package introduction
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidclose()Closes these statistics.java.lang.Numberget(java.lang.String name)Returns the value of the named statistic.java.lang.Numberget(StatisticDescriptor descriptor)Returns the value of the identified statistic.doublegetDouble(int id)Returns the value of the identified statistic of typedouble.doublegetDouble(java.lang.String name)Returns the value of the statistic of typedoubleat the given name.doublegetDouble(StatisticDescriptor descriptor)Returns the value of the described statistic of typedouble.intgetInt(int id)Deprecated.as of Geode 1.10, usegetLong(int)insteadintgetInt(java.lang.String name)Deprecated.as of Geode 1.10, usegetLong(String)insteadintgetInt(StatisticDescriptor descriptor)Deprecated.as of Geode 1.10, usegetLong(StatisticDescriptor)insteadlonggetLong(int id)Returns the value of the identified statistic of typelong.longgetLong(java.lang.String name)Returns the value of the statistic of typelongat the given name.longgetLong(StatisticDescriptor descriptor)Returns the value of the described statistic of typelong.longgetNumericId()Gets the number associated with this instance that helps identify it.longgetRawBits(java.lang.String name)Returns the bits that represent the raw value of the named statistic.longgetRawBits(StatisticDescriptor descriptor)Returns the bits that represent the raw value of the described statistic.java.lang.StringgetTextId()Gets the text associated with this instance that helps identify it.StatisticsTypegetType()Gets theStatisticsTypeof this instance.longgetUniqueId()Gets a value that uniquely identifies this statistics.voidincDouble(int id, double delta)Increments the value of the identified statistic of typedoubleby the given amount.voidincDouble(java.lang.String name, double delta)Increments the value of the statistic of typedoublewith the given name by a given amount.voidincDouble(StatisticDescriptor descriptor, double delta)Increments the value of the described statistic of typedoubleby the given amount.voidincInt(int id, int delta)Deprecated.as of Geode 1.10, useincLong(int, long)insteadvoidincInt(java.lang.String name, int delta)Deprecated.as of Geode 1.10, useincLong(String, long)insteadvoidincInt(StatisticDescriptor descriptor, int delta)Deprecated.as of Geode 1.10, useincLong(StatisticDescriptor, long)insteadvoidincLong(int id, long delta)Increments the value of the identified statistic of typelongby the given amount.voidincLong(java.lang.String name, long delta)Increments the value of the statistic of typelongwith the given name by a given amount.voidincLong(StatisticDescriptor descriptor, long delta)Increments the value of the described statistic of typelongby the given amount.booleanisAtomic()Returns true if modifications are atomic.booleanisClosed()Returns true if the instance has beenclosed.StatisticDescriptornameToDescriptor(java.lang.String name)Returns the descriptor of the statistic with the given name in this statistics instance.intnameToId(java.lang.String name)Returns the id of the statistic with the given name in this statistics instance.voidsetDouble(int id, double value)Sets the value of a statistic with the givenidwhose type isdouble.voidsetDouble(java.lang.String name, double value)Sets the value of a named statistic of typedouble.voidsetDouble(StatisticDescriptor descriptor, double value)Sets the value of a described statistic of typedoublejava.util.function.DoubleSuppliersetDoubleSupplier(int id, java.util.function.DoubleSupplier supplier)Provide a callback to compute the value of this statistic every sample interval and use that as the value of the stat.java.util.function.DoubleSuppliersetDoubleSupplier(java.lang.String name, java.util.function.DoubleSupplier supplier)Provide a callback to compute the value of this statistic every sample interval and use that as the value of the stat.java.util.function.DoubleSuppliersetDoubleSupplier(StatisticDescriptor descriptor, java.util.function.DoubleSupplier supplier)Provide a callback to compute the value of this statistic every sample interval and use that as the value of the stat.voidsetInt(int id, int value)Deprecated.as of Geode 1.10, usesetLong(int, long)insteadvoidsetInt(java.lang.String name, int value)Deprecated.as of Geode 1.10, usesetLong(String, long)insteadvoidsetInt(StatisticDescriptor descriptor, int value)Deprecated.as of Geode 1.10, usesetLong(StatisticDescriptor, long)insteadjava.util.function.IntSuppliersetIntSupplier(int id, java.util.function.IntSupplier supplier)Deprecated.as of Geode 1.10, usesetLongSupplier(int, LongSupplier)insteadjava.util.function.IntSuppliersetIntSupplier(java.lang.String name, java.util.function.IntSupplier supplier)Deprecated.as of Geode 1.10, usesetLongSupplier(String, LongSupplier)insteadjava.util.function.IntSuppliersetIntSupplier(StatisticDescriptor descriptor, java.util.function.IntSupplier supplier)Deprecated.as of Geode 1.10, usesetLongSupplier(StatisticDescriptor, LongSupplier)insteadvoidsetLong(int id, long value)Sets the value of a statistic with the givenidwhose type islong.voidsetLong(java.lang.String name, long value)Sets the value of a named statistic of typelong.voidsetLong(StatisticDescriptor descriptor, long value)Sets the value of a described statistic of typelongjava.util.function.LongSuppliersetLongSupplier(int id, java.util.function.LongSupplier supplier)Provide a callback to compute the value of this statistic every sample interval and use that as the value of the stat.java.util.function.LongSuppliersetLongSupplier(java.lang.String name, java.util.function.LongSupplier supplier)Provide a callback to compute the value of this statistic every sample interval and use that as the value of the stat.java.util.function.LongSuppliersetLongSupplier(StatisticDescriptor descriptor, java.util.function.LongSupplier supplier)Provide a callback to compute the value of this statistic every sample interval and use that as the value of the stat.
-
-
-
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(java.lang.String name)
Returns the id of the statistic with the given name in this statistics instance.- Parameters:
name- the name of the statistic- Returns:
- the id of the statistic
- Throws:
java.lang.IllegalArgumentException- No statistic namednameexists in this statistics instance.- See Also:
StatisticsType.nameToId(java.lang.String)
-
nameToDescriptor
StatisticDescriptor nameToDescriptor(java.lang.String name)
Returns the descriptor of the statistic with the given name in this statistics instance.- Parameters:
name- the name of the statistic- Returns:
- the
descriptorof the statistic - Throws:
java.lang.IllegalArgumentException- No statistic namednameexists in this statistics instance.- See Also:
StatisticsType.nameToDescriptor(java.lang.String)
-
getUniqueId
long getUniqueId()
Gets a value that uniquely identifies this statistics.- Returns:
- a value that uniquely identifies this statistics
-
getType
StatisticsType getType()
Gets theStatisticsTypeof this instance.- Returns:
- the
StatisticsTypeof this instance
-
getTextId
java.lang.String getTextId()
Gets the text associated with this instance that helps identify it.- Returns:
- the text associated with this instance that helps identify it
-
getNumericId
long getNumericId()
Gets the number associated with this instance that helps identify it.- Returns:
- 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.
- Returns:
- whether modifications are atomic
-
isClosed
boolean isClosed()
Returns true if the instance has beenclosed.- Returns:
- whether the instance has been
closed.
-
setInt
@Deprecated void setInt(int id, int value)Deprecated.as of Geode 1.10, usesetLong(int, long)insteadSets the value of a statistic with the givenidwhose type isint.- Parameters:
id- a statistic id obtained withnameToId(java.lang.String)orStatisticsType.nameToId(java.lang.String).value- the value to set the statistic to- Throws:
java.lang.ArrayIndexOutOfBoundsException- If the id is invalid.
-
setInt
@Deprecated void setInt(java.lang.String name, int value)Deprecated.as of Geode 1.10, usesetLong(String, long)insteadSets the value of a named statistic of typeint- Parameters:
name- the name of the statisticvalue- the value to set the statistic to- Throws:
java.lang.IllegalArgumentException- If no statistic exists namednameor if the statistic with namenameis not of typeint.
-
setInt
@Deprecated void setInt(StatisticDescriptor descriptor, int value)
Deprecated.as of Geode 1.10, usesetLong(StatisticDescriptor, long)insteadSets the value of a described statistic of typeint- Parameters:
descriptor- a statistic descriptor obtained withnameToDescriptor(java.lang.String)orStatisticsType.nameToDescriptor(java.lang.String).value- the value to set the statistic to- Throws:
java.lang.IllegalArgumentException- If no statistic exists for the givendescriptoror if the described statistic is not of typeint.
-
setLong
void setLong(int id, long value)Sets the value of a statistic with the givenidwhose type islong.- Parameters:
id- a statistic id obtained withnameToId(java.lang.String)orStatisticsType.nameToId(java.lang.String).value- the value to set the statistic to- Throws:
java.lang.ArrayIndexOutOfBoundsException- If the id is invalid.
-
setLong
void setLong(StatisticDescriptor descriptor, long value)
Sets the value of a described statistic of typelong- Parameters:
descriptor- a statistic descriptor obtained withnameToDescriptor(java.lang.String)orStatisticsType.nameToDescriptor(java.lang.String).value- the value to set the statistic to- Throws:
java.lang.IllegalArgumentException- If no statistic exists for the givendescriptoror if the described statistic is not of typelong.
-
setLong
void setLong(java.lang.String name, long value)Sets the value of a named statistic of typelong.- Parameters:
name- the name of the statisticvalue- the value to set the statistic to- Throws:
java.lang.IllegalArgumentException- If no statistic exists namednameor if the statistic with namenameis not of typelong.
-
setDouble
void setDouble(int id, double value)Sets the value of a statistic with the givenidwhose type isdouble.- Parameters:
id- a statistic id obtained withnameToId(java.lang.String)orStatisticsType.nameToId(java.lang.String).value- the value to set the statistic to- Throws:
java.lang.ArrayIndexOutOfBoundsException- If the id is invalid.
-
setDouble
void setDouble(StatisticDescriptor descriptor, double value)
Sets the value of a described statistic of typedouble- Parameters:
descriptor- a statistic descriptor obtained withnameToDescriptor(java.lang.String)orStatisticsType.nameToDescriptor(java.lang.String).value- the value to set the statistic to- Throws:
java.lang.IllegalArgumentException- If no statistic exists for the givendescriptoror if the described statistic is not of typedouble.
-
setDouble
void setDouble(java.lang.String name, double value)Sets the value of a named statistic of typedouble.- Parameters:
name- the name of the statisticvalue- the value to set the statistic to- Throws:
java.lang.IllegalArgumentException- If no statistic exists namednameor if the statistic with namenameis not of typedouble.
-
getInt
@Deprecated int getInt(int id)
Deprecated.as of Geode 1.10, usegetLong(int)insteadReturns the value of the identified statistic of typeint.- Parameters:
id- a statistic id obtained withnameToId(java.lang.String)orStatisticsType.nameToId(java.lang.String).- Returns:
- the value of the statistic
- Throws:
java.lang.ArrayIndexOutOfBoundsException- If the id is invalid.
-
getInt
@Deprecated int getInt(StatisticDescriptor descriptor)
Deprecated.as of Geode 1.10, usegetLong(StatisticDescriptor)insteadReturns the value of the described statistic of typeint.- Parameters:
descriptor- a statistic descriptor obtained withnameToDescriptor(java.lang.String)orStatisticsType.nameToDescriptor(java.lang.String).- Returns:
- the value of the statistic
- Throws:
java.lang.IllegalArgumentException- If no statistic exists with the specifieddescriptoror if the described statistic is not of typeint.
-
getInt
@Deprecated int getInt(java.lang.String name)
Deprecated.as of Geode 1.10, usegetLong(String)insteadReturns the value of the statistic of typeintat the given name.- Parameters:
name- the name of the statistic- Returns:
- the value of the statistic
- Throws:
java.lang.IllegalArgumentException- If no statistic exists with namenameor if the statistic namednameis not of typeint.
-
getLong
long getLong(int id)
Returns the value of the identified statistic of typelong.- Parameters:
id- a statistic id obtained withnameToId(java.lang.String)orStatisticsType.nameToId(java.lang.String).- Returns:
- the value of the statistic
- Throws:
java.lang.ArrayIndexOutOfBoundsException- If the id is invalid.
-
getLong
long getLong(StatisticDescriptor descriptor)
Returns the value of the described statistic of typelong.- Parameters:
descriptor- a statistic descriptor obtained withnameToDescriptor(java.lang.String)orStatisticsType.nameToDescriptor(java.lang.String).- Returns:
- the value of the statistic
- Throws:
java.lang.IllegalArgumentException- If no statistic exists with the specifieddescriptoror if the described statistic is not of typelong.
-
getLong
long getLong(java.lang.String name)
Returns the value of the statistic of typelongat the given name.- Parameters:
name- the name of the statistic- Returns:
- the value of the statistic
- Throws:
java.lang.IllegalArgumentException- If no statistic exists with namenameor if the statistic namednameis not of typelong.
-
getDouble
double getDouble(int id)
Returns the value of the identified statistic of typedouble.- Parameters:
id- a statistic id obtained withnameToId(java.lang.String)orStatisticsType.nameToId(java.lang.String).- Returns:
- the value of the statistic
- Throws:
java.lang.ArrayIndexOutOfBoundsException- If the id is invalid.
-
getDouble
double getDouble(StatisticDescriptor descriptor)
Returns the value of the described statistic of typedouble.- Parameters:
descriptor- a statistic descriptor obtained withnameToDescriptor(java.lang.String)orStatisticsType.nameToDescriptor(java.lang.String).- Returns:
- the value of the statistic
- Throws:
java.lang.IllegalArgumentException- If no statistic exists with the specifieddescriptoror if the described statistic is not of typedouble.
-
getDouble
double getDouble(java.lang.String name)
Returns the value of the statistic of typedoubleat the given name.- Parameters:
name- the name of the statistic- Returns:
- the value of the statistic
- Throws:
java.lang.IllegalArgumentException- If no statistic exists with namenameor if the statistic namednameis not of typedouble.
-
get
java.lang.Number get(StatisticDescriptor descriptor)
Returns the value of the identified statistic.- Parameters:
descriptor- a statistic descriptor obtained withnameToDescriptor(java.lang.String)orStatisticsType.nameToDescriptor(java.lang.String).- Returns:
- the value of the statistic
- Throws:
java.lang.IllegalArgumentException- If the described statistic does not exist
-
get
java.lang.Number get(java.lang.String name)
Returns the value of the named statistic.- Parameters:
name- the name of the statistic- Returns:
- the value of the statistic
- Throws:
java.lang.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 withnameToDescriptor(java.lang.String)orStatisticsType.nameToDescriptor(java.lang.String).- Returns:
- the bits that represent the raw value of the named statistic
- Throws:
java.lang.IllegalArgumentException- If the described statistic does not exist
-
getRawBits
long getRawBits(java.lang.String name)
Returns the bits that represent the raw value of the named statistic.- Parameters:
name- the name of the statistic- Returns:
- the bits that represent the raw value of the named statistic
- Throws:
java.lang.IllegalArgumentException- If the named statistic does not exist
-
incInt
@Deprecated void incInt(int id, int delta)Deprecated.as of Geode 1.10, useincLong(int, long)insteadIncrements the value of the identified statistic of typeintby the given amount.- Parameters:
id- a statistic id obtained withnameToId(java.lang.String)orStatisticsType.nameToId(java.lang.String).delta- the amount by which to increment the statistic value- Throws:
java.lang.ArrayIndexOutOfBoundsException- If the id is invalid.
-
incInt
@Deprecated void incInt(StatisticDescriptor descriptor, int delta)
Deprecated.as of Geode 1.10, useincLong(StatisticDescriptor, long)insteadIncrements the value of the described statistic of typeintby the given amount.- Parameters:
descriptor- the descriptor for the statistic to incrementdelta- the amount by which to increment the statistic value- Throws:
java.lang.IllegalArgumentException- If no statistic exists with the givendescriptoror if the described statistic is not of typeint.
-
incInt
@Deprecated void incInt(java.lang.String name, int delta)Deprecated.as of Geode 1.10, useincLong(String, long)insteadIncrements the value of the statistic of typeintwith the given name by a given amount.- Parameters:
name- the name of the statistic to incrementdelta- the amount by which to increment the statistic value- Throws:
java.lang.IllegalArgumentException- If no statistic exists with namenameor if the statistic namednameis not of typeint.
-
incLong
void incLong(int id, long delta)Increments the value of the identified statistic of typelongby the given amount.- Parameters:
id- a statistic id obtained withnameToId(java.lang.String)orStatisticsType.nameToId(java.lang.String).delta- the amount by which to increment the statistic value- Throws:
java.lang.ArrayIndexOutOfBoundsException- If the id is invalid.
-
incLong
void incLong(StatisticDescriptor descriptor, long delta)
Increments the value of the described statistic of typelongby the given amount.- Parameters:
descriptor- the descriptor for the statistic to incrementdelta- the amount by which to increment the statistic value- Throws:
java.lang.IllegalArgumentException- If no statistic exists with the givendescriptoror if the described statistic is not of typelong.
-
incLong
void incLong(java.lang.String name, long delta)Increments the value of the statistic of typelongwith the given name by a given amount.- Parameters:
name- the name of the statistic to incrementdelta- the amount by which to increment the statistic value- Throws:
java.lang.IllegalArgumentException- If no statistic exists with namenameor if the statistic namednameis not of typelong.
-
incDouble
void incDouble(int id, double delta)Increments the value of the identified statistic of typedoubleby the given amount.- Parameters:
id- a statistic id obtained withnameToId(java.lang.String)orStatisticsType.nameToId(java.lang.String).delta- the amount by which to increment the statistic value- Throws:
java.lang.ArrayIndexOutOfBoundsException- If the id is invalid.
-
incDouble
void incDouble(StatisticDescriptor descriptor, double delta)
Increments the value of the described statistic of typedoubleby the given amount.- Parameters:
descriptor- the descriptor for the statistic to incrementdelta- the amount by which to increment the statistic value- Throws:
java.lang.IllegalArgumentException- If no statistic exists with the givendescriptoror if the described statistic is not of typedouble.
-
incDouble
void incDouble(java.lang.String name, double delta)Increments the value of the statistic of typedoublewith the given name by a given amount.- Parameters:
name- the name of the statistic to incrementdelta- the amount by which to increment the statistic value- Throws:
java.lang.IllegalArgumentException- If no statistic exists with namenameor if the statistic namednameis not of typedouble.
-
setIntSupplier
@Deprecated java.util.function.IntSupplier setIntSupplier(int id, java.util.function.IntSupplier supplier)Deprecated.as of Geode 1.10, usesetLongSupplier(int, LongSupplier)insteadProvide a callback to compute the value of this statistic every sample interval and use that as the value of the stat.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
- Parameters:
id- a statistic id obtained withnameToId(java.lang.String)orStatisticsType.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 supplier- Returns:
- the previously registered supplier, or null if there was no previously registered supplier
- Throws:
java.lang.IllegalArgumentException- If the id is invalid.- Since:
- Geode 1.0
-
setIntSupplier
@Deprecated java.util.function.IntSupplier setIntSupplier(java.lang.String name, java.util.function.IntSupplier supplier)Deprecated.as of Geode 1.10, usesetLongSupplier(String, LongSupplier)insteadProvide a callback to compute the value of this statistic every sample interval and use that as the value of the stat.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
- Parameters:
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 supplier- Returns:
- the previously registered supplier, or null if there was no previously registered supplier
- Throws:
java.lang.IllegalArgumentException- If no statistic exists with namenameor if the statistic namednameis not of typeint.- Since:
- Geode 1.0
-
setIntSupplier
@Deprecated java.util.function.IntSupplier setIntSupplier(StatisticDescriptor descriptor, java.util.function.IntSupplier supplier)
Deprecated.as of Geode 1.10, usesetLongSupplier(StatisticDescriptor, LongSupplier)insteadProvide a callback to compute the value of this statistic every sample interval and use that as the value of the stat.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
- Parameters:
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 supplier- Returns:
- the previously registered supplier, or null if there was no previously registered supplier
- Throws:
java.lang.IllegalArgumentException- If no statistic exists with the givendescriptoror if the described statistic is not of typeint.- Since:
- Geode 1.0
-
setLongSupplier
java.util.function.LongSupplier setLongSupplier(int id, java.util.function.LongSupplier supplier)Provide a callback to compute the value of this statistic every sample interval and use that as the value of the stat.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
- Parameters:
id- a statistic id obtained withnameToId(java.lang.String)orStatisticsType.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 supplier- Returns:
- the previously registered supplier, or null if there was no previously registered supplier
- Throws:
java.lang.IllegalArgumentException- If the id is invalid.- Since:
- Geode 1.0
-
setLongSupplier
java.util.function.LongSupplier setLongSupplier(java.lang.String name, java.util.function.LongSupplier supplier)Provide a callback to compute the value of this statistic every sample interval and use that as the value of the stat.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
- Parameters:
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 supplier- Returns:
- the previously registered supplier, or null if there was no previously registered supplier
- Throws:
java.lang.IllegalArgumentException- If no statistic exists with namenameor if the statistic namednameis not of typelong.
-
setLongSupplier
java.util.function.LongSupplier setLongSupplier(StatisticDescriptor descriptor, java.util.function.LongSupplier supplier)
Provide a callback to compute the value of this statistic every sample interval and use that as the value of the stat.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
- Parameters:
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 supplier- Returns:
- the previously registered supplier, or null if there was no previously registered supplier
- Throws:
java.lang.IllegalArgumentException- If no statistic exists with the givendescriptoror if the described statistic is not of typelong.- Since:
- Geode 1.0
-
setDoubleSupplier
java.util.function.DoubleSupplier setDoubleSupplier(int id, java.util.function.DoubleSupplier supplier)Provide a callback to compute the value of this statistic every sample interval and use that as the value of the stat.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
- Parameters:
id- a statistic id obtained withnameToId(java.lang.String)orStatisticsType.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 supplier- Returns:
- the previously registered supplier, or null if there was no previously registered supplier
- Throws:
java.lang.IllegalArgumentException- If the id is invalid.- Since:
- Geode 1.0
-
setDoubleSupplier
java.util.function.DoubleSupplier setDoubleSupplier(java.lang.String name, java.util.function.DoubleSupplier supplier)Provide a callback to compute the value of this statistic every sample interval and use that as the value of the stat.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
- Parameters:
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 supplier- Returns:
- the previously registered supplier, or null if there was no previously registered supplier
- Throws:
java.lang.IllegalArgumentException- If no statistic exists with namenameor if the statistic namednameis not of typedouble.- Since:
- Geode 1.0
-
setDoubleSupplier
java.util.function.DoubleSupplier setDoubleSupplier(StatisticDescriptor descriptor, java.util.function.DoubleSupplier supplier)
Provide a callback to compute the value of this statistic every sample interval and use that as the value of the stat.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
- Parameters:
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 supplier- Returns:
- the previously registered supplier, or null if there was no previously registered supplier
- Throws:
java.lang.IllegalArgumentException- If no statistic exists with the givendescriptoror if the described statistic is not of typedouble.- Since:
- Geode 1.0
-
-