Class AsynchMessageManager

java.lang.Object
utils.communication.communicationHandler.AsynchMessageManager
All Implemented Interfaces:
CommunicationManager

public class AsynchMessageManager extends Object implements CommunicationManager
  • Constructor Details

  • Method Details

    • getRegistration

      public Subscription getRegistration(Collection<Byte> acceptableTypes)
      Description copied from interface: CommunicationManager
      Register a new group of types of messages that this manager should keep track of. If any of the types are already registered, then no valid registration is made.
      Specified by:
      getRegistration in interface CommunicationManager
      Parameters:
      acceptableTypes - Set containing the wanted message types.
      Returns:
      New registration. If no valid registration was made, then it should return NULL.
    • getRegistration

      public Subscription getRegistration(Collection<Byte> acceptableTypes, InstanceID instanceID)
      Description copied from interface: CommunicationManager
      Register a new group of types of messages that this manager shoudl keep track of, associated to a specific InstanceID. If this instanceID already has a registration, then no new registration is made. If any of the new message types are present in a previous registration, as long as the instanceID is new, then a new valid registration must be produced.
      Specified by:
      getRegistration in interface CommunicationManager
      Parameters:
      acceptableTypes - Set containing the wanted message types
      instanceID - Object defining a unique identifier for the insterested subscriber.
      Returns:
      New registration. If no valid registration was made, then it should return NULL.
    • open

      public void open()
    • dequeue

      public org.javatuples.Triplet<AddressInterface,byte[],Byte> dequeue(Subscription acceptableTypesSubscription)
      Description copied from interface: CommunicationManager
      Dequeue a message tagged with any of the wanted types. If no such message exists, the method should block until one is available.
      Specified by:
      dequeue in interface CommunicationManager
      Parameters:
      acceptableTypesSubscription - Subscription defining the wanted types
      Returns:
      Triplet containing the address of the sender, the payload of the message, and the actual type of the message
    • addToGroup

      public void addToGroup(AddressInterface address, ProcessInterface process)
      Description copied from interface: CommunicationManager
      Add a new process to the group, identified by its address
      Specified by:
      addToGroup in interface CommunicationManager
      Parameters:
      address - Address of the process
      process - Actual process
    • getGroupConstitution

      public GroupConstitution getGroupConstitution()
      Description copied from interface: CommunicationManager
      Get the object that defines the communication group
      Specified by:
      getGroupConstitution in interface CommunicationManager
      Returns:
      the group constitution object