Class DelayedEventHandlerThread

java.lang.Object
java.lang.Thread
marauroa.server.game.messagehandler.DelayedEventHandlerThread
All Implemented Interfaces:
Runnable

public class DelayedEventHandlerThread extends Thread
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
  • Constructor Details

    • DelayedEventHandlerThread

      public DelayedEventHandlerThread(RPServerManager rpMan)
      Creates a new DelayedEventHandlerThread
      Parameters:
      rpMan - RPServerManager
  • Method Details

    • get

      public static DelayedEventHandlerThread get()
      gets the last instantiated DelayedEventHandlerThread
      Returns:
      DelayedEventHandlerThread or null if it has never been instantiated
    • addDelayedEvent

      public void addDelayedEvent(DelayedEventHandler handler, Object data)
      adds a delayed event for processing.
      Parameters:
      handler - DelayedEventHandler
      data - data for the handler
    • run

      public void run()
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread
    • setKeepRunning

      public void setKeepRunning(boolean keepRunning)
      Should the thread be kept running?
      Parameters:
      keepRunning - set to false to stop it.