/** * Notify the task it has started * * @return true when the notification succeeds, false otherwise */ protected boolean taskStarted() { try { task.started(getElapsedTime()); return true; } catch (Throwable t) { log.warn("Unexpected error during 'started' for task: " + taskString, t); return false; } }
/** * Notify the task it has been accepted * * @return true when the notification succeeds, false otherwise */ protected boolean taskAccepted() { try { task.accepted(getElapsedTime()); return true; } catch (Throwable t) { log.warn("Unexpected error during 'accepted' for task: " + taskString, t); return false; } }
/** * Notify the task it has been rejected * * @param e any error associated with the rejection * @return true when the notification succeeds, false otherwise */ protected boolean taskRejected(RuntimeException e) { try { task.rejected(getElapsedTime(), e); return true; } catch (Throwable t) { log.warn("Unexpected error during 'rejected' for task: " + taskString, t); if (e != null) log.warn("Original reason for rejection of task: " + taskString, e); return false; } }
/** * Notify the task it has completed * * @param throwable any throwable associated with the completion * @return true when the notification succeeds, false otherwise */ protected boolean taskCompleted(Throwable throwable) { try { task.completed(getElapsedTime(), throwable); return true; } catch (Throwable t) { log.warn("Unexpected error during 'completed' for task: " + taskString, t); if (throwable != null) log.warn("Original error during 'run' for task: " + taskString, throwable); return false; } }
long runTime = getElapsedTime(); if (startTimeout > 0l && runTime >= startTimeout)