use of com.hazelcast.jet.impl.execution.init.VertexDef in project hazelcast by hazelcast.
the class ExecutionContext method completeExecution.
/**
* Complete local execution. If local execution was started, it should be
* called after execution has completed.
*/
public void completeExecution(Throwable error) {
assert executionFuture == null || executionFuture.isDone() : "If execution was begun, then completeExecution() should not be called before execution is done.";
if (!executionCompleted.compareAndSet(false, true)) {
return;
}
for (Tasklet tasklet : tasklets) {
try {
tasklet.close();
} catch (Throwable e) {
logger.severe(jobNameAndExecutionId() + " encountered an exception in Processor.close(), ignoring it", e);
}
}
JobClassLoaderService jobClassloaderService = jetServiceBackend.getJobClassLoaderService();
ClassLoader classLoader = jobClassloaderService.getClassLoader(jobId);
doWithClassLoader(classLoader, () -> {
for (VertexDef vertex : vertices) {
try {
ClassLoader processorCl = isLightJob ? null : jobClassloaderService.getProcessorClassLoader(jobId, vertex.name());
doWithClassLoader(processorCl, () -> vertex.processorSupplier().close(error));
} catch (Throwable e) {
logger.severe(jobNameAndExecutionId() + " encountered an exception in ProcessorSupplier.close(), ignoring it", e);
}
}
});
tempDirectories.forEach((k, dir) -> {
try {
IOUtil.delete(dir);
} catch (Exception e) {
logger.warning("Failed to delete temporary directory " + dir);
}
});
if (serializationService != null) {
serializationService.dispose();
}
}
Aggregations