class ScheduledRunnable implements Runnable, Cancellable {

    @Override
    public void run() {
        try {
            runInternal();
        } catch (TerminateSubsequentExecutionsException e) {
            // cancel this scheduled runnable
            // log exception at debug level
            logger.debug(e.getMessage(), e);
            throw e;
        } catch (Throwable t) {
            // log and return successfully so it will continue to run
            logger.error(t.getMessage(), t);
        }
    }

}