Package emissary.core

Class Pausable

    • Field Detail

      • DEFAULT_PAUSE_INTERVAL

        public static final long DEFAULT_PAUSE_INTERVAL
      • pauseInterval

        protected long pauseInterval
    • Constructor Detail

      • Pausable

        public Pausable​(String name)
      • Pausable

        public Pausable​(String name,
                        long pauseInterval)
    • Method Detail

      • pause

        public void pause()
        Stop taking work
        Specified by:
        pause in interface IPausable
      • unpause

        public void unpause()
        Resume taking work
        Specified by:
        unpause in interface IPausable
      • isPaused

        public boolean isPaused()
        Check to see if the current thread is paused
        Specified by:
        isPaused in interface IPausable
        Returns:
        true if work is paused, false otherwise
      • getPauseInterval

        public long getPauseInterval()
        Get the time to sleep before checking if the thread has been unpaused
        Returns:
        the pause check interval
      • checkPaused

        public boolean checkPaused()
        Check to see if we are currently paused. If paused, sleep for the configured interval and return true.
        Returns:
        true if paused, false otherwise
      • run

        public abstract void run()
        Specified by:
        run in interface Runnable
        Overrides:
        run in class Thread