Class SimpleHandleThread<T>

java.lang.Object
java.lang.Thread
com.example.server.handler.SimpleHandleThread<T>
All Implemented Interfaces:
HandleThread, Runnable

public class SimpleHandleThread<T> extends Thread implements HandleThread
Class - implementation of message processing as a usual Thread.
  • Constructor Details

    • SimpleHandleThread

      public SimpleHandleThread(MessageQueue<T> messageQueue, MessageHandler<T> messageHandler)
      Constructor for SimpleHandleThread.
      Parameters:
      messageQueue - The message queue for storing incoming messages.
      messageHandler - The message handler to process the messages.
  • Method Details

    • isProcessing

      public boolean isProcessing()
      Check if the thread is currently processing messages.
      Specified by:
      isProcessing in interface HandleThread
      Returns:
      true if the thread is actively processing messages.
    • killThread

      public void killThread()
      Stop the execution of the current thread.
      Specified by:
      killThread in interface HandleThread
    • run

      public void run()
      Main processing loop of the thread. It continuously retrieves and processes messages from the message queue until interrupted.
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread