use of com.hazelcast.internal.serialization.SerializationServiceAware in project hazelcast by hazelcast.
the class TestSupport method initProcessor.
private void initProcessor(Processor processor, TestOutbox outbox) {
SerializationService serializationService;
if (hazelcastInstance != null && hazelcastInstance instanceof SerializationServiceSupport) {
SerializationServiceSupport impl = (SerializationServiceSupport) hazelcastInstance;
serializationService = impl.getSerializationService();
} else {
serializationService = new DefaultSerializationServiceBuilder().setManagedContext(e -> e).build();
}
TestProcessorContext context = new TestProcessorContext().setLogger(getLogger(processor.getClass().getName())).setManagedContext(serializationService.getManagedContext()).setLocalProcessorIndex(localProcessorIndex).setGlobalProcessorIndex(globalProcessorIndex).setLocalParallelism(localParallelism).setTotalParallelism(totalParallelism);
if (hazelcastInstance != null) {
context.setHazelcastInstance(hazelcastInstance);
}
if (jobConfig != null) {
context.setJobConfig(jobConfig);
}
if (processor instanceof SerializationServiceAware) {
((SerializationServiceAware) processor).setSerializationService(serializationService);
}
try {
processor.init(outbox, context);
} catch (Exception e) {
throw sneakyThrow(e);
}
}
use of com.hazelcast.internal.serialization.SerializationServiceAware in project hazelcast by hazelcast.
the class ExecutionPlan method initDag.
private void initDag(InternalSerializationService jobSerializationService) {
final Map<Integer, VertexDef> vMap = vertices.stream().collect(toMap(VertexDef::vertexId, v -> v));
for (VertexDef v : vertices) {
v.inboundEdges().forEach(e -> e.initTransientFields(vMap, v, false));
v.outboundEdges().forEach(e -> e.initTransientFields(vMap, v, true));
}
final IPartitionService partitionService = nodeEngine.getPartitionService();
vertices.stream().map(VertexDef::outboundEdges).flatMap(List::stream).map(EdgeDef::partitioner).filter(Objects::nonNull).forEach(partitioner -> {
if (partitioner instanceof SerializationServiceAware) {
((SerializationServiceAware) partitioner).setSerializationService(jobSerializationService);
}
partitioner.init(object -> partitionService.getPartitionId(jobSerializationService.toData(object)));
});
}
Aggregations