use of com.hazelcast.jet.impl.processor.ProcessorWrapper in project hazelcast by hazelcast.
the class ProcessorTasklet method init.
@Override
public void init() {
ManagedContext managedContext = serializationService.getManagedContext();
if (managedContext != null) {
Processor toInit = processor instanceof ProcessorWrapper ? ((ProcessorWrapper) processor).getWrapped() : processor;
Object initialized = null;
try {
initialized = managedContext.initialize(toInit);
toInit = (Processor) initialized;
} catch (ClassCastException e) {
throw new IllegalArgumentException(String.format("The initialized object(%s) should be an instance of %s", initialized, Processor.class), e);
}
if (processor instanceof ProcessorWrapper) {
((ProcessorWrapper) processor).setWrapped(toInit);
} else {
processor = toInit;
}
}
try {
doWithClassLoader(context.classLoader(), () -> processor.init(outbox, context));
} catch (Exception e) {
throw sneakyThrow(e);
}
}
Aggregations