public class KGatherBatchFinalReceiver extends TargetFinalReceiver
| Modifier and Type | Field and Description |
|---|---|
protected <any> |
gathered
The reduced values for each target and key
|
barriers, stateCleared, syncReceived, targetStatesdestination, groupingSize, highWaterMark, lock, messages, operation, representSource, syncState, targets, thisDestinations, thisSources, workerId| Constructor and Description |
|---|
KGatherBatchFinalReceiver(BulkReceiver receiver,
boolean groupByKey)
Create a receiver without sorting
|
KGatherBatchFinalReceiver(BulkReceiver receiver,
boolean groupByKey,
java.util.Comparator<java.lang.Object> keyComparator)
Create a receiver with sorting
|
| Modifier and Type | Method and Description |
|---|---|
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 boolean |
isAllEmpty(int target) |
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
|
boolean |
onSyncEvent(int target,
byte[] value)
This method is called when there is a sync event on the operation
|
protected boolean |
sendToTarget(int source,
int target)
Send the values to a target
|
addSyncMessage, addSyncMessageBarrier, canAcceptMessage, clean, isComplete, progress, syncaddMessage, clearTarget, onMessageclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclose, onMessagepublic KGatherBatchFinalReceiver(BulkReceiver receiver, boolean groupByKey)
receiver - the receivergroupByKey - weather to group return values according to keypublic KGatherBatchFinalReceiver(BulkReceiver receiver, boolean groupByKey, java.util.Comparator<java.lang.Object> keyComparator)
receiver - the receivergroupByKey - weather to group return values according to keypublic 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 MessageReceiverinit in class TargetFinalReceiverexpectedIds - expected task idsprotected void merge(int dest,
java.util.List<java.lang.Object> dests)
TargetReceivermerge in class TargetReceiverdest - the targetdests - message queue to switch to readyprotected boolean sendToTarget(int source,
int target)
TargetReceiversendToTarget in class TargetReceiversource - the sourcestarget - the targetprotected boolean isAllEmpty(int target)
isAllEmpty in class TargetFinalReceiverprotected boolean isFilledToSend(int target)
TargetReceiverisFilledToSend in class TargetReceiverpublic boolean onSyncEvent(int target,
byte[] value)
TargetReceiveronSyncEvent in class TargetReceivertarget - the target to which the sync event belongvalue - the byte value, can be null