Class DistributedReceiver

  • All Implemented Interfaces:
    Receiver

    public class DistributedReceiver
    extends AbstractReceiver
    An implementation of the Receiver interface for distributed environments. Basically, its task is to forward tokens to distributed services whenever the put method is called.
    Since:
    Ptolemy II 5.1
    Version:
    $Id$
    Author:
    Daniel Lazaro Cuadrado (kapokasa@kom.aau.dk)
    See Also:
    AbstractReceiver
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (kapokasa)
    • Constructor Detail

      • DistributedReceiver

        public DistributedReceiver()
    • Method Detail

      • hasRoom

        public boolean hasRoom()
        Empty implementation of the inherited abstract method.
        Specified by:
        hasRoom in interface Receiver
        Specified by:
        hasRoom in class AbstractReceiver
        Returns:
        True if the next call to put() will not result in a NoRoomException.
      • hasRoom

        public boolean hasRoom​(int numberOfTokens)
        Empty implementation of the inherited abstract method.
        Specified by:
        hasRoom in interface Receiver
        Specified by:
        hasRoom in class AbstractReceiver
        Parameters:
        numberOfTokens - The number of tokens to put into this receiver.
        Returns:
        True if the next numberOfTokens calls to put() will not result in a NoRoomException.
      • hasToken

        public boolean hasToken()
        Empty implementation of the inherited abstract method.
        Specified by:
        hasToken in interface Receiver
        Specified by:
        hasToken in class AbstractReceiver
        Returns:
        True if the next call to get() will not result in a NoTokenException.
      • hasToken

        public boolean hasToken​(int numberOfTokens)
        Empty implementation of the inherited abstract method.
        Specified by:
        hasToken in interface Receiver
        Specified by:
        hasToken in class AbstractReceiver
        Parameters:
        numberOfTokens - The number of tokens desired.
        Returns:
        True if the next numberOfTokens calls to get() will not result in a NoTokenException.
      • put

        public void put​(Token token)
                 throws IllegalActionException
        Forward copies of the token to the distributed services specified in the servicesReceiversListMap. //TODO:This could be done in parallel. Is it worth the effort?
        Specified by:
        put in interface Receiver
        Specified by:
        put in class AbstractReceiver
        Parameters:
        token - The token to be forwarded, or null to forward no token.
        Throws:
        IllegalActionException - If the put fails (e.g. because of incompatible types).
      • setServicesReceiversListMap

        public void setServicesReceiversListMap​(java.util.HashMap servRecListMap)
        Specify the servicesReceiversListMap that contains a sequence of services and IDs of receivers in the service.
        Parameters:
        servRecListMap - The map that contains a sequence of services and IDs of receivers.