Package emissary.core

Class ResourceWatcher

  • All Implemented Interfaces:
    Runnable

    public class ResourceWatcher
    extends Object
    implements Runnable
    Track mobile agents and make them obey resource limitations
    • Field Detail

      • LOG

        protected static final org.slf4j.Logger LOG
      • timeLimitMillis

        protected long timeLimitMillis
      • monitor

        @Nullable
        protected transient Thread monitor
      • timeToQuit

        protected boolean timeToQuit
      • metrics

        protected com.codahale.metrics.MetricRegistry metrics
    • 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 track
        place - place executing
        Returns:
        TimedResource for the place and agent
      • 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
        Specified by:
        run in interface Runnable
      • logStats

        public void logStats​(org.slf4j.Logger loggerArg)
      • resetStats

        public void resetStats()
      • getStats

        public SortedMap<String,​com.codahale.metrics.Timer> getStats()
      • getStat

        public com.codahale.metrics.Timer getStat​(String statKey)