Class Runner

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, java.lang.Runnable

    public class Runner
    extends java.lang.Object
    implements java.lang.Runnable, java.io.Closeable
    Runs a given function in a loop (in a separate thread) until it is stopped
    Since:
    4.0
    Author:
    Bela Ban
    • Field Detail

      • thread_name

        protected java.lang.String thread_name
      • function

        protected final java.lang.Runnable function
      • stop_function

        protected final java.lang.Runnable stop_function
      • running

        protected volatile boolean running
      • thread

        protected java.lang.Thread thread
      • daemon

        protected boolean daemon
      • join_timeout

        protected long join_timeout
    • Constructor Detail

      • Runner

        public Runner​(java.lang.String name,
                      java.lang.Runnable function,
                      java.lang.Runnable stop_function)
      • Runner

        public Runner​(ThreadFactory factory,
                      java.lang.String thread_name,
                      java.lang.Runnable function,
                      java.lang.Runnable stop_function)
    • Method Detail

      • getThread

        public java.lang.Thread getThread()
      • isRunning

        public boolean isRunning()
      • daemon

        public boolean daemon()
      • daemon

        public Runner daemon​(boolean d)
      • threadName

        public java.lang.String threadName()
      • threadName

        public Runner threadName​(java.lang.String n)
      • getJoinTimeout

        public long getJoinTimeout()
      • setJoinTimeout

        public Runner setJoinTimeout​(long t)
      • start

        public Runner start()
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable