Interface IHeartBeatManager

  • All Known Implementing Classes:
    HeartBeatManager

    public interface IHeartBeatManager
    The Java ExecutorService is a construct that allows you to pass a task to be executed by a thread asynchronously. The executor service creates and maintains a reusable pool of threads for executing submitted tasks. This class helps you create and manage your HeartBeats. See: AbstractHeartBeat
    Author:
    kong
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void clear()
      Destroy all heart-beats and clear all references.
      boolean contains​(java.lang.String id)
      Check if a heart-beat is existed or not.
      void create​(java.lang.String id, AbstractHeartBeat heartbeat)
      Create a new heart-beat.
      void dispose​(java.lang.String id)
      Dispose a heart-beat.
      void initialize​(int maxHeartbeat)
      The number of maximum heart-beats that the server can handle.
      void initialize​(BaseConfiguration configuration)
      The number of maximum heart-beats that the server can handle.
      void sendMessage​(java.lang.String id, TObject message)
      Send a message to a particular heart-beat with no delay time
      void sendMessage​(java.lang.String id, TObject message, double delayTime)
      Send a message to a particular heart-beat with a delay time
    • Method Detail

      • initialize

        void initialize​(BaseConfiguration configuration)
        The number of maximum heart-beats that the server can handle.
        Parameters:
        configuration - see BaseConfiguration
      • initialize

        void initialize​(int maxHeartbeat)
        The number of maximum heart-beats that the server can handle.
        Parameters:
        maxHeartbeat - the number of maximum heart-beats that the server can handle
      • dispose

        void dispose​(java.lang.String id)
        Dispose a heart-beat.
        Parameters:
        id - the unique id
      • contains

        boolean contains​(java.lang.String id)
        Check if a heart-beat is existed or not.
        Parameters:
        id - the unique id
        Returns:
        true if the corresponding heart-beat has existed
      • clear

        void clear()
        Destroy all heart-beats and clear all references.
      • sendMessage

        void sendMessage​(java.lang.String id,
                         TObject message,
                         double delayTime)
        Send a message to a particular heart-beat with a delay time
        Parameters:
        id - the unique id
        message - the message content, see TObject
        delayTime - the delay time in seconds
      • sendMessage

        void sendMessage​(java.lang.String id,
                         TObject message)
        Send a message to a particular heart-beat with no delay time
        Parameters:
        id - the unique id
        message - the message content, see TObject