Interface SchedulerSessionUnitOfWork<T extends Exception>

  • Type Parameters:
    T - subclass of Exception that is thrown by the performWork method. Note: It is possible to do an unchecked conversion of a raw SchedulerSessionUnitOfWork type to SchedulerSessionUnitOfWork<RuntimeException>. The object of the raw type might throw a checked exception, however when converted to SchedulerSessionUnitOfWork<RuntimeException> this exception is no longer checked. This should be avoided since this will lead to problems with the Exception handling becoming very hard to trace.

    public interface SchedulerSessionUnitOfWork<T extends Exception>
    Unit of work to be performed using a scheduler session.
    • Method Detail

      • performWork

        void performWork​(SchedulerSession session)
                  throws T extends Exception
        This method defines the unit of work to perform. It will be called potentially multiple times, each time with a new SchedulerSession. After the method has returned SchedulerSession.persist() will be called on session. Should this fail with a no rows updated exception then the method will called again after a random delay, with a a new SchedulerSession. Should it fail too many times, the last exception will be rethrown.
        Parameters:
        session - The SchedulerSession to use.
        Throws:
        T - if an error occurs
        T extends Exception