Search in sources :

Example 1 with ExecutionTimedOutException

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;
}
Also used : ManagedQueueExecutorService(org.jboss.as.threads.ManagedQueueExecutorService) ExecutionTimedOutException(org.jboss.threads.ExecutionTimedOutException) RejectedExecutionException(java.util.concurrent.RejectedExecutionException) RejectedExecutionException(java.util.concurrent.RejectedExecutionException) ExecutionTimedOutException(org.jboss.threads.ExecutionTimedOutException) StartException(org.jboss.msc.service.StartException)

Aggregations

RejectedExecutionException (java.util.concurrent.RejectedExecutionException)1 ManagedQueueExecutorService (org.jboss.as.threads.ManagedQueueExecutorService)1 StartException (org.jboss.msc.service.StartException)1 ExecutionTimedOutException (org.jboss.threads.ExecutionTimedOutException)1