Package emissary.core
Class ResourceWatcher
- java.lang.Object
-
- emissary.core.ResourceWatcher
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_NAMESPACE_NAMEprotected static org.slf4j.LoggerLOGprotected com.codahale.metrics.MetricRegistrymetricsprotected MetricsFormattermetricsFormatterprotected Threadmonitorprotected Map<String,Long>placeTimeLimitsprotected longtimeLimitMillisprotected booleantimeToQuitprotected Queue<TimedResource>tracking
-
Constructor Summary
Constructors Constructor Description ResourceWatcher()ResourceWatcher(MetricsManager metricsManager)Create a resource watcher set it running and bind into the NamespaceException
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.codahale.metrics.TimergetStat(String statKey)SortedMap<String,com.codahale.metrics.Timer>getStats()longgetTimeLimitMillis()Get the default time limit in millisvoidlogStats(org.slf4j.Logger loggerArg)static ResourceWatcherlookup()Lookup the default ResourceWatcher in the Namespacevoidquit()Safely stop the monitoring ThreadvoidresetStats()voidrun()Runnable interface where we get to monitor stuffvoidsetTimeLimitMillis(long limit)Set the default time limit in millisTimedResourcestarting(IMobileAgent agent, IServiceProviderPlace place)Register an agent to start tracking itStringtoString()
-
-
-
Field Detail
-
LOG
protected static final org.slf4j.Logger LOG
-
DEFAULT_NAMESPACE_NAME
public static final String DEFAULT_NAMESPACE_NAME
- See Also:
- Constant Field Values
-
timeLimitMillis
protected long timeLimitMillis
-
monitor
@Nullable protected transient Thread monitor
-
timeToQuit
protected boolean timeToQuit
-
metrics
protected com.codahale.metrics.MetricRegistry metrics
-
metricsFormatter
protected MetricsFormatter metricsFormatter
-
tracking
protected Queue<TimedResource> tracking
-
-
Constructor Detail
-
ResourceWatcher
public ResourceWatcher()
-
ResourceWatcher
public ResourceWatcher(MetricsManager metricsManager)
Create a resource watcher set it running and bind into the NamespaceException
-
-
Method Detail
-
starting
public TimedResource starting(IMobileAgent agent, IServiceProviderPlace place)
Register an agent to start tracking it- Parameters:
agent- the agent to trackplace- place executing- Returns:
- TimedResource for the place and agent
-
lookup
public static ResourceWatcher lookup() throws NamespaceException
Lookup the default ResourceWatcher in the Namespace- Returns:
- The registered ResourceWatcher
- Throws:
NamespaceException
-
quit
public void quit()
Safely stop the monitoring Thread
-
setTimeLimitMillis
public void setTimeLimitMillis(long limit)
Set the default time limit in millis- Parameters:
limit- the new value
-
getTimeLimitMillis
public long getTimeLimitMillis()
Get the default time limit in millis- Returns:
- time limit
-
run
public void run()
Runnable interface where we get to monitor stuff
-
logStats
public void logStats(org.slf4j.Logger loggerArg)
-
resetStats
public void resetStats()
-
getStat
public com.codahale.metrics.Timer getStat(String statKey)
-
-