public class TargetPartialReceiver extends TargetReceiver
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.Integer,byte[]> |
barriers
The barriers for each source
|
protected <any> |
sourceStates
Keep state
|
protected boolean |
stateCleared
State is cleared
|
protected <any> |
syncSent
Keep track what are the targets we've sent syncs to
|
destination, groupingSize, highWaterMark, lock, messages, operation, representSource, syncState, targets, thisDestinations, thisSources, workerId
Constructor and Description |
---|
TargetPartialReceiver() |
Modifier and Type | Method and Description |
---|---|
protected void |
addMessage(int target,
java.util.List<java.lang.Object> msgQueue,
java.lang.Object value) |
protected void |
addSyncMessage(int source,
int target)
Add a sync message
|
protected void |
addSyncMessageBarrier(int source,
int target,
byte[] barrier)
Add a sync message
|
protected boolean |
canAcceptMessage(int source,
int target)
Check weather we can accept a message
|
void |
clean()
Clean any state associated with the receiver and go to initial state
|
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
|
boolean |
isComplete()
Weather we are complete a set of messages
|
protected boolean |
isFilledToSend(int target)
Return true if we are filled to send
|
protected void |
merge(int dest,
java.util.List<java.lang.Object> dests)
Swap the messages to the ready queue
|
protected boolean |
onSyncEvent(int target,
byte[] value)
This method is called when there is a sync event on the operation
|
boolean |
progress()
This method will be called by the communicationProgress
|
protected boolean |
sendToTarget(int source,
int target)
This gets called with a represented source
|
boolean |
sync()
Handle the sync
|
clearTarget, onMessage
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, onMessage
protected <any> sourceStates
protected <any> syncSent
protected java.util.Map<java.lang.Integer,byte[]> barriers
protected boolean stateCleared
public void init(Config cfg, DataFlowOperation op, java.util.Map<java.lang.Integer,java.util.List<java.lang.Integer>> expectedIds)
MessageReceiver
target -> source tasks
init
in interface MessageReceiver
init
in class TargetReceiver
expectedIds
- expected task idsprotected void merge(int dest, java.util.List<java.lang.Object> dests)
merge
in class TargetReceiver
dest
- the targetdests
- message queue to switch to readyprotected boolean sendToTarget(int source, int target)
sendToTarget
in class TargetReceiver
source
- the sources the represented sourcetarget
- the target the true targetprotected boolean isFilledToSend(int target)
TargetReceiver
isFilledToSend
in class TargetReceiver
protected void addSyncMessage(int source, int target)
TargetReceiver
addSyncMessage
in class TargetReceiver
source
- sourcetarget
- targetprotected void addSyncMessageBarrier(int source, int target, byte[] barrier)
TargetReceiver
addSyncMessageBarrier
in class TargetReceiver
source
- sourcetarget
- targetbarrier
- the barrier messageprotected void addMessage(int target, java.util.List<java.lang.Object> msgQueue, java.lang.Object value)
addMessage
in class TargetReceiver
protected boolean canAcceptMessage(int source, int target)
TargetReceiver
canAcceptMessage
in class TargetReceiver
source
- sourcetarget
- targetpublic boolean progress()
MessageReceiver
public boolean isComplete()
MessageReceiver
public boolean sync()
public void clean()
MessageReceiver
protected boolean onSyncEvent(int target, byte[] value)
TargetReceiver
onSyncEvent
in class TargetReceiver
target
- the target to which the sync event belongvalue
- the byte value, can be null