Class BackgroundProcessTask

  • All Implemented Interfaces:
    Callable<Void>

    @Technical
    @Bean
    public class BackgroundProcessTask
    extends AbstractRequestTask<AbstractRequestTask.ProcessContext>
    This task is in charge of processing background processes.
    All services which needs to perform background processes needs to push a AbstractBackgroundProcessRequest to BackgroundProcessTask.

    Each request has an identifier and a lock duration set by the caller (through the AbstractBackgroundProcessRequest implementation). The lock duration is the minimal time the requests are ignored after a first one with a same identifier has been processed.

    Here the rules:

    • If a new request is pushed whereas it does not exist already one into the queue with a same identifier, then the new request is pushed into queue.
    • If a new request is pushed whereas it exists already one into the queue with a same identifier:
      • the lock duration has passed, then the new request is pushed into queue
      • the lock duration nas not passed or the existing request has not yet been performed, then the new request is ignored

    If a request has not yet been processed, it could happen that the lock duration will be greater than the one specified in case a new request with a same identifier is pushed.

    Author:
    silveryocha