Class BaseHandler

java.lang.Object
java.lang.Thread
org.kobe.xbot.JClient.BaseHandler
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
ConcurrentPushHandler, ConcurrentRequestHandler, SubscribeHandler

public abstract class BaseHandler extends Thread
BaseThread - A general base class for threads with common setup and cleanup functionality.

This class provides a standardized way to handle thread initialization, resource cleanup, and logging for threads used in the XTABLES project.

Author: Kobe Lei Version: 1.0

  • Field Details

    • logger

      protected static final XTablesLogger logger
    • socket

      protected org.zeromq.ZMQ.Socket socket
  • Constructor Details

    • BaseHandler

      public BaseHandler(String threadName, boolean isDaemon, org.zeromq.ZMQ.Socket socket)
      Constructor to initialize the thread with a custom name, daemon status, and socket.
      Parameters:
      threadName - The name of the thread
      isDaemon - Whether the thread should run as a daemon
      socket - The ZMQ.Socket instance to manage
  • Method Details

    • cleanUp

      protected void cleanUp()
      Performs cleanup by closing the ZMQ.Socket.
    • interrupt

      public void interrupt()
      Logs exceptions and handles cleanup when the thread is interrupted.
      Overrides:
      interrupt in class Thread
    • handleException

      protected void handleException(Exception exception)
      Logs exceptions that occur during thread execution.