use of com.hazelcast.jet.impl.execution.ReceiverTasklet in project hazelcast by hazelcast.
the class ExecutionPlan method createIfAbsentReceiverTasklet.
private void createIfAbsentReceiverTasklet(EdgeDef edge, String jobPrefix, int[][] ptionsPerProcessor, int totalPtionCount, InternalSerializationService jobSerializationService) {
final ConcurrentConveyor<Object>[] localConveyors = localConveyorMap.get(edge.edgeId());
receiverMap.computeIfAbsent(edge.destVertex().vertexId(), x -> new HashMap<>()).computeIfAbsent(edge.destOrdinal(), x -> {
Map<Address, ReceiverTasklet> addrToTasklet = new HashMap<>();
// create a receiver per address
int offset = 0;
for (Address addr : ptionArrgmt.getRemotePartitionAssignment().keySet()) {
final OutboundCollector[] collectors = new OutboundCollector[ptionsPerProcessor.length];
// assign the queues starting from end
final int queueOffset = --offset;
Arrays.setAll(collectors, n -> new ConveyorCollector(localConveyors[n], localConveyors[n].queueCount() + queueOffset, ptionsPerProcessor[n]));
final OutboundCollector collector = compositeCollector(collectors, edge, totalPtionCount, true);
ReceiverTasklet receiverTasklet = new ReceiverTasklet(collector, jobSerializationService, edge.getConfig().getReceiveWindowMultiplier(), getJetConfig().getFlowControlPeriodMs(), nodeEngine.getLoggingService(), addr, edge.destOrdinal(), edge.destVertex().name(), memberConnections.get(addr), jobPrefix);
addrToTasklet.put(addr, receiverTasklet);
}
return addrToTasklet;
});
}
Aggregations