Package org.kobe.xbot.JClient
Class BaseHandler
java.lang.Object
java.lang.Thread
org.kobe.xbot.JClient.BaseHandler
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
ConcurrentPushHandler
,ConcurrentRequestHandler
,SubscribeHandler
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
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final XTablesLogger
protected org.zeromq.ZMQ.Socket
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
ConstructorsConstructorDescriptionBaseHandler
(String threadName, boolean isDaemon, org.zeromq.ZMQ.Socket socket) Constructor to initialize the thread with a custom name, daemon status, and socket. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
cleanUp()
Performs cleanup by closing the ZMQ.Socket.protected void
handleException
(Exception exception) Logs exceptions that occur during thread execution.void
Logs exceptions and handles cleanup when the thread is interrupted.Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
Field Details
-
logger
-
socket
protected org.zeromq.ZMQ.Socket socket
-
-
Constructor Details
-
BaseHandler
Constructor to initialize the thread with a custom name, daemon status, and socket.- Parameters:
threadName
- The name of the threadisDaemon
- Whether the thread should run as a daemonsocket
- The ZMQ.Socket instance to manage
-
-
Method Details