use of com.hazelcast.jet.impl.execution.Tasklet in project hazelcast by hazelcast.
the class ExecutionPlan method memberToSenderConveyorMap.
/**
* Creates (if absent) for the given edge one sender tasklet per remote member,
* each with a single conveyor with a number of producer queues feeding it.
* Populates the {@link #senderMap} and {@link #tasklets} fields.
*/
private Map<Address, ConcurrentConveyor<Object>> memberToSenderConveyorMap(Map<String, Map<Address, ConcurrentConveyor<Object>>> edgeSenderConveyorMap, EdgeDef edge, String jobPrefix, InternalSerializationService jobSerializationService) {
assert !edge.isLocal() : "Edge is not distributed";
return edgeSenderConveyorMap.computeIfAbsent(edge.edgeId(), x -> {
final Map<Address, ConcurrentConveyor<Object>> addrToConveyor = new HashMap<>();
for (Address destAddr : remoteMembers.get()) {
final ConcurrentConveyor<Object> conveyor = createConveyorArray(1, edge.sourceVertex().localParallelism(), edge.getConfig().getQueueSize())[0];
@SuppressWarnings("unchecked") ComparatorEx<Object> origComparator = (ComparatorEx<Object>) edge.getOrderComparator();
ComparatorEx<ObjectWithPartitionId> adaptedComparator = origComparator == null ? null : (l, r) -> origComparator.compare(l.getItem(), r.getItem());
final InboundEdgeStream inboundEdgeStream = newEdgeStream(edge, conveyor, jobPrefix + "/toVertex:" + edge.destVertex().name() + "-toMember:" + destAddr, adaptedComparator);
final int destVertexId = edge.destVertex().vertexId();
final SenderTasklet t = new SenderTasklet(inboundEdgeStream, nodeEngine, destAddr, memberConnections.get(destAddr), destVertexId, edge.getConfig().getPacketSizeLimit(), executionId, edge.sourceVertex().name(), edge.sourceOrdinal(), jobSerializationService);
senderMap.computeIfAbsent(destVertexId, xx -> new HashMap<>()).computeIfAbsent(edge.destOrdinal(), xx -> new HashMap<>()).put(destAddr, t);
tasklets.add(t);
addrToConveyor.put(destAddr, conveyor);
}
return addrToConveyor;
});
}
use of com.hazelcast.jet.impl.execution.Tasklet in project hazelcast-jet by hazelcast.
the class ExecutionPlan method memberToSenderConveyorMap.
/**
* Creates (if absent) for the given edge one sender tasklet per remote member,
* each with a single conveyor with a number of producer queues feeding it.
* Populates the {@link #senderMap} and {@link #tasklets} fields.
*/
private Map<Address, ConcurrentConveyor<Object>> memberToSenderConveyorMap(Map<String, Map<Address, ConcurrentConveyor<Object>>> edgeSenderConveyorMap, EdgeDef edge) {
assert edge.isDistributed() : "Edge is not distributed";
return edgeSenderConveyorMap.computeIfAbsent(edge.edgeId(), x -> {
final Map<Address, ConcurrentConveyor<Object>> addrToConveyor = new HashMap<>();
for (Address destAddr : remoteMembers.get()) {
final ConcurrentConveyor<Object> conveyor = createConveyorArray(1, edge.sourceVertex().localParallelism(), edge.getConfig().getQueueSize())[0];
final ConcurrentInboundEdgeStream inboundEdgeStream = newEdgeStream(edge, conveyor, "sender-toVertex:" + edge.destVertex().name() + "-toMember:" + destAddr.toString().replace('.', '-'));
final int destVertexId = edge.destVertex().vertexId();
final SenderTasklet t = new SenderTasklet(inboundEdgeStream, nodeEngine, destAddr, executionId, destVertexId, edge.getConfig().getPacketSizeLimit());
senderMap.computeIfAbsent(destVertexId, xx -> new HashMap<>()).computeIfAbsent(edge.destOrdinal(), xx -> new HashMap<>()).put(destAddr, t);
tasklets.add(t);
addrToConveyor.put(destAddr, conveyor);
}
return addrToConveyor;
});
}
Aggregations