Package org.jcsp.net2

Class LinkManager

java.lang.Object
org.jcsp.net2.LinkManager

final class LinkManager extends Object
Class for managing Links. Ensures that only one Link is only ever created for each individual Node that the hosting Node may be connected to. This is an internal management class of JCSP. For information on how to create Links, see LinkFactory.
See Also:
  • Field Details

    • eventChans

      private static ArrayList eventChans
      These event channels are used by the LinkManager to inform any process that may be interested in Link Lost events.
    • instance

      private static LinkManager instance
      Singleton instance of the LinkManager.
  • Constructor Details

    • LinkManager

      private LinkManager()
      Private default constructor for singleton instance.
  • Method Details

    • getInstance

      static LinkManager getInstance()
      Gets the singleton instance of the LinkManager
      Returns:
      The singleton instance of the LinkManager
    • lostLink

      void lostLink(Link link)
      Handles a Link Lost event. This is done by sending messages over the event channels registered in the eventChans ArrayList. This is possible in the current thread as each event channel is infinitely buffered, so no blocking can occur.
      Parameters:
      link - The Link that has been lost.
    • registerLink

      boolean registerLink(Link link)
      Registers a new Link with the LinkManager.
      Parameters:
      link - The Link to register.
      Returns:
      True if a Link to the Node does not yet exist, false otherwise.
    • requestLink

      Link requestLink(NodeID id)
      Returns the Link for the given NodeID
      Parameters:
      id - The NodeID of the remote node
      Returns:
      The Link for the given NodeID
    • getLinkLostEventChannel

      AltingChannelInput getLinkLostEventChannel()
      Gets a channel input end for receiving Link Lost events.
      Returns:
      A input end for receiving Link Lost Events.