Class Daemon.RunnableDelegate

  • All Implemented Interfaces:
    java.lang.Runnable
    Enclosing class:
    Daemon

    private class Daemon.RunnableDelegate
    extends java.lang.Object
    implements java.lang.Runnable
    The RunnableDelegate object is used to actually invoke the run method. A delegate is used to ensure that once the task has finished it is inactive so that it can be started again with a new thread.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.Runnable task
      This is the runnable that is to be executed.
    • Constructor Summary

      Constructors 
      Constructor Description
      RunnableDelegate​(java.lang.Runnable task)
      Constructor for the RunnableDelegate object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void run()
      This is used to execute the task.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • task

        private final java.lang.Runnable task
        This is the runnable that is to be executed.
    • Constructor Detail

      • RunnableDelegate

        public RunnableDelegate​(java.lang.Runnable task)
        Constructor for the RunnableDelegate object. The delegate requires the actual runnable that is to be executed. As soon as the task has finished the runner becomes inactive.
        Parameters:
        task - this is the task to be executed
    • Method Detail

      • run

        public void run()
        This is used to execute the task. Once the task has finished the runner becomes inactive and any reference to the internal thread is set to null. This ensures the runner can be started again at a later time if desired.
        Specified by:
        run in interface java.lang.Runnable