1ssqq1lxr commented on issue #10907:
URL: https://github.com/apache/ignite/issues/10907#issuecomment-1702061588
public class IgniteExecutor implements JobExecutor {
private final IgniteCompute igniteCompute;
public IgniteExecutor(IgniteCompute igniteCompute) {
this.igniteCompute = igniteCompute;
}
@Override
public void execute(Job job) {
try {
IgniteRunnable runnable = job::run;
if (job.isBroadcast()) {
igniteCompute.broadcast(runnable);
} else {
igniteCompute.run(runnable);
}
} catch (Exception e) {
ContextHolder.getReceiveContext()
.getLogManager()
.printError(null, LogEvent.CLUSTER, job.getJobName()+"
execute error "+e.getMessage());
}
}
@Override
public <R> Collection<R> callBroadcast(JobCaller<R> callable) {
try {
IgniteCallable<R> igniteCallable = callable::call;
return igniteCompute.broadcast(igniteCallable);
} catch (Exception e) {
ContextHolder.getReceiveContext()
.getLogManager()
.printError(null, LogEvent.CLUSTER,
callable.getJobName()+" callBroadcast error "+e.getMessage());
return Collections.emptySet();
}
}
@Override
public <INPUT, OUT> Collection<OUT> callBroadcast(JobClosure<INPUT, OUT>
callable, INPUT input) {
try {
return this.igniteCompute.broadcast(callable, input);
} catch (Exception e) {
ContextHolder.getReceiveContext()
.getLogManager()
.printError(null, LogEvent.CLUSTER,
callable.getJobName()+" callBroadcast error "+e.getMessage());
return Collections.emptySet();
}
}
@Override
public <R> R call(JobCaller<R> callable) {
try {
IgniteCallable<R> igniteCallable = callable::call;
return igniteCompute.call(igniteCallable);
} catch (Exception e) {
ContextHolder.getReceiveContext()
.getLogManager()
.printError(null, LogEvent.CLUSTER,
callable.getJobName()+" call error "+e.getMessage());
return null;
}
}
}
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]