Package org.apache.bookkeeper.stats
Class CachingStatsProvider
- java.lang.Object
-
- org.apache.bookkeeper.stats.CachingStatsProvider
-
- All Implemented Interfaces:
StatsProvider
public class CachingStatsProvider extends java.lang.Object implements StatsProvider
ACachingStatsProvider
adds the caching functionality to an existingStatsProvider
.The stats provider will cache the stats objects created by the other
StatsProvider
to allow the reusability of stats objects and avoid creating a lot of stats objects.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.concurrent.ConcurrentMap<java.lang.String,StatsLogger>
statsLoggers
protected StatsProvider
underlying
-
Constructor Summary
Constructors Constructor Description CachingStatsProvider(StatsProvider provider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StatsLogger
getStatsLogger(java.lang.String scope)
Return the stats logger to a given scope.java.lang.String
getStatsName(java.lang.String... statsComponents)
Return the fully qualified stats name comprised of given statsComponents.void
start(org.apache.commons.configuration.Configuration conf)
Initialize the stats provider by loading the given configuration conf.void
stop()
Close the stats provider.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.bookkeeper.stats.StatsProvider
writeAllMetrics
-
-
-
-
Field Detail
-
underlying
protected final StatsProvider underlying
-
statsLoggers
protected final java.util.concurrent.ConcurrentMap<java.lang.String,StatsLogger> statsLoggers
-
-
Constructor Detail
-
CachingStatsProvider
public CachingStatsProvider(StatsProvider provider)
-
-
Method Detail
-
start
public void start(org.apache.commons.configuration.Configuration conf)
Description copied from interface:StatsProvider
Initialize the stats provider by loading the given configuration conf.- Specified by:
start
in interfaceStatsProvider
- Parameters:
conf
- Configuration to configure the stats provider.
-
stop
public void stop()
Description copied from interface:StatsProvider
Close the stats provider.- Specified by:
stop
in interfaceStatsProvider
-
getStatsLogger
public StatsLogger getStatsLogger(java.lang.String scope)
Description copied from interface:StatsProvider
Return the stats logger to a given scope.- Specified by:
getStatsLogger
in interfaceStatsProvider
- Parameters:
scope
- Scope for the given stats- Returns:
- stats logger for the given scope
-
getStatsName
public java.lang.String getStatsName(java.lang.String... statsComponents)
Description copied from interface:StatsProvider
Return the fully qualified stats name comprised of given statsComponents.- Specified by:
getStatsName
in interfaceStatsProvider
- Parameters:
statsComponents
- stats components to comprise the fully qualified stats name- Returns:
- the fully qualified stats name
-
-