use of org.jboss.threads.ExecutionTimedOutException in project camunda-bpm-platform by camunda.
the class MscExecutorService method scheduleLongRunningWork.
protected boolean scheduleLongRunningWork(Runnable runnable) {
final ManagedQueueExecutorService managedQueueExecutorService = managedQueueInjector.getValue();
boolean rejected = false;
try {
// wait for 2 seconds for the job to be accepted by the pool.
managedQueueExecutorService.executeBlocking(runnable, 2, TimeUnit.SECONDS);
} catch (InterruptedException e) {
// the acquisition thread is interrupted, this probably means the app server is turning the lights off -> ignore
} catch (ExecutionTimedOutException e) {
rejected = true;
} catch (RejectedExecutionException e) {
rejected = true;
} catch (Exception e) {
// if it fails for some other reason, log a warning message
long now = System.currentTimeMillis();
// only log every 60 seconds to prevent log flooding
if ((now - lastWarningLogged) >= (60 * 1000)) {
log.log(Level.WARNING, "Unexpected Exception while submitting job to executor pool.", e);
} else {
log.log(Level.FINE, "Unexpected Exception while submitting job to executor pool.", e);
}
}
return !rejected;
}
Aggregations