Search in sources :

Example 1 with XCallable

use of org.apache.oozie.util.XCallable in project oozie by apache.

the class XCommand method executeInterrupts.

/**
 * Check for the existence of interrupts for the same lock key
 * Execute them if exist.
 */
protected void executeInterrupts() {
    CallableQueueService callableQueueService = Services.get().get(CallableQueueService.class);
    // getting all the list of interrupts to be executed
    Set<XCallable<?>> callables = callableQueueService.checkInterrupts(this.getEntityKey());
    if (callables != null) {
        // in the list
        for (XCallable<?> callable : callables) {
            LOG.trace("executing interrupt callable [{0}]", callable.getName());
            try {
                // executing the callable in interrupt mode
                callable.setInterruptMode(true);
                callable.call();
                LOG.trace("executed interrupt callable [{0}]", callable.getName());
            } catch (Exception ex) {
                LOG.warn("exception interrupt callable [{0}], {1}", callable.getName(), ex.getMessage(), ex);
            } finally {
                // reseting the interrupt mode to false after the command is
                // executed
                callable.setInterruptMode(false);
            }
        }
    }
}
Also used : CallableQueueService(org.apache.oozie.service.CallableQueueService) XCallable(org.apache.oozie.util.XCallable) XException(org.apache.oozie.XException)

Aggregations

XException (org.apache.oozie.XException)1 CallableQueueService (org.apache.oozie.service.CallableQueueService)1 XCallable (org.apache.oozie.util.XCallable)1