Class DelayedEventHandlerThread
java.lang.Object
java.lang.Thread
marauroa.server.game.messagehandler.DelayedEventHandlerThread
- All Implemented Interfaces:
Runnable
Thread that handles delayed events like disconnecting players.
It has to be done this way because we can't run it on the main loop of GameServerManager,
because it locks waiting for new messages to arrive. This way the events are handles as
they are requested to be.
- Author:
- miguel, hendrik
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
ConstructorDescriptionCreates a new DelayedEventHandlerThread -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDelayedEvent(DelayedEventHandler handler, Object data)
adds a delayed event for processing.static DelayedEventHandlerThread
get()
gets the last instantiated DelayedEventHandlerThreadvoid
run()
void
setKeepRunning(boolean keepRunning)
Should the thread be kept running?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, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
Constructor Details
-
DelayedEventHandlerThread
Creates a new DelayedEventHandlerThread- Parameters:
rpMan
- RPServerManager
-
-
Method Details
-
get
gets the last instantiated DelayedEventHandlerThread- Returns:
- DelayedEventHandlerThread or
null
if it has never been instantiated
-
addDelayedEvent
adds a delayed event for processing.- Parameters:
handler
- DelayedEventHandlerdata
- data for the handler
-
run
public void run() -
setKeepRunning
public void setKeepRunning(boolean keepRunning)Should the thread be kept running?- Parameters:
keepRunning
- set to false to stop it.
-