Class WorkerThread

  • All Implemented Interfaces:
    java.lang.Runnable

    public class WorkerThread
    extends java.lang.Object
    implements java.lang.Runnable
    A worker thread class for the server.
    Author:
    Christopher Mindus
    • Constructor Summary

      Constructors 
      ConstructorDescription
      WorkerThread​(Worker worker, java.lang.Runnable disposeRunnable)
      Constructs the worker thread.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidawaitExit()
      Waits max 30 seconds for worker thread to exit.
      booleanisRunning()
      Verifies if the thread is running.
      voidrun()
      The worker thread runnable.
      • Methods inherited from class java.lang.Object

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

      • WorkerThread

        public WorkerThread​(Worker worker,
                            java.lang.Runnable disposeRunnable)
        Constructs the worker thread.
        Parameters:
        worker - The worker.
        disposeRunnable - Runnable that is called when the thread exits dur to failure.
    • Method Detail

      • isRunning

        public boolean isRunning()
        Verifies if the thread is running.
      • awaitExit

        public void awaitExit()
        Waits max 30 seconds for worker thread to exit.
      • run

        public void run()
        The worker thread runnable.
        Specified by:
        run in interface java.lang.Runnable