public abstract class TargetReceiver extends java.lang.Object implements MessageReceiver
| Modifier and Type | Field and Description | 
|---|---|
| protected int | destinationThe destination | 
| protected long | groupingSizeThe message grouping size | 
| protected int | highWaterMarkHigh water mark to keep track of objects | 
| protected java.util.concurrent.locks.Lock | lockThe lock | 
| protected <any> | messagesLets keep track of the messages, we need to keep track of the messages for each target
 and source, Map<target, Queue<messages>> | 
| protected DataFlowOperation | operationThe operations | 
| protected int | representSourceThe source task connected to this partial receiver | 
| protected SyncState | syncStateThe sync state | 
| protected int[] | targetsThe targets | 
| protected java.util.Set<java.lang.Integer> | thisDestinationsThe destinations we are sending messages to | 
| protected java.util.Set<java.lang.Integer> | thisSourcesSources we are expecting messages from | 
| protected int | workerIdThe worker id this receiver is in | 
| Constructor and Description | 
|---|
| TargetReceiver() | 
| Modifier and Type | Method and Description | 
|---|---|
| protected void | addMessage(int target,
          java.util.List<java.lang.Object> msgQueue,
          java.lang.Object value) | 
| protected abstract void | addSyncMessage(int source,
              int target)Add a sync message | 
| protected abstract void | addSyncMessageBarrier(int source,
                     int target,
                     byte[] barrier)Add a sync message | 
| protected abstract boolean | canAcceptMessage(int source,
                int target)Check weather we can accept a message | 
| protected void | clearTarget(int target)Clear all the buffers for the target, to ready for the next | 
| void | init(Config cfg,
    DataFlowOperation op,
    java.util.Map<java.lang.Integer,java.util.List<java.lang.Integer>> expectedIds)Initialize the message receiver with tasks from which messages are expected
 For each sub edge in graph, for each path, gives the expected task ids | 
| protected abstract boolean | isFilledToSend(int target)Return true if we are filled to send | 
| protected abstract void | merge(int dest,
     java.util.List<java.lang.Object> dests)Swap the messages to the ready queue | 
| boolean | onMessage(int source,
         int path,
         int target,
         int flags,
         java.lang.Object object)The actual message callback | 
| protected abstract boolean | onSyncEvent(int target,
           byte[] value)This method is called when there is a sync event on the operation | 
| protected abstract boolean | sendToTarget(int source,
            int target)Send the values to a target | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclean, close, isComplete, onMessage, progressprotected <any> messages
protected int workerId
protected DataFlowOperation operation
protected int destination
protected int representSource
protected int highWaterMark
protected java.util.concurrent.locks.Lock lock
protected java.util.Set<java.lang.Integer> thisSources
protected java.util.Set<java.lang.Integer> thisDestinations
protected SyncState syncState
protected long groupingSize
protected int[] targets
public void init(Config cfg, DataFlowOperation op, java.util.Map<java.lang.Integer,java.util.List<java.lang.Integer>> expectedIds)
MessageReceivertarget -> source tasks
init in interface MessageReceiverexpectedIds - expected task idspublic boolean onMessage(int source,
                         int path,
                         int target,
                         int flags,
                         java.lang.Object object)
MessageReceiveronMessage in interface MessageReceiversource - the source taskpath - the path that is taken by the message, that is intermediate targetstarget - the target of this receiverflags - the communication flagsobject - the actual messageprotected void addMessage(int target,
                          java.util.List<java.lang.Object> msgQueue,
                          java.lang.Object value)
protected abstract void addSyncMessage(int source,
                                       int target)
source - sourcetarget - targetprotected abstract void addSyncMessageBarrier(int source,
                                              int target,
                                              byte[] barrier)
source - sourcetarget - targetbarrier - the barrier messageprotected abstract boolean canAcceptMessage(int source,
                                            int target)
source - sourcetarget - targetprotected abstract void merge(int dest,
                              java.util.List<java.lang.Object> dests)
dest - the targetdests - message queue to switch to readyprotected void clearTarget(int target)
target - targetprotected abstract boolean sendToTarget(int source,
                                        int target)
source - the sourcestarget - the targetprotected abstract boolean onSyncEvent(int target,
                                       byte[] value)
target - the target to which the sync event belongvalue - the byte value, can be nullprotected abstract boolean isFilledToSend(int target)