Interface Executor


  • public interface Executor
    Core logic of executor is encapsulated by this interface. It allows to operate on request instances of the execution.
    • Method Detail

      • scheduleRequest

        Long scheduleRequest​(String commandName,
                             CommandContext ctx)
        Schedules execution of given command as soon as possible.
        Parameters:
        commandName - - FQCN of the command
        ctx - - contextual data given by executor service
        Returns:
        unique identifier of the request
      • scheduleRequest

        Long scheduleRequest​(String commandName,
                             Date date,
                             CommandContext ctx)
        Schedules execution of given command on defined time.
        Parameters:
        commandName - - FQCN of the command
        date - - date at which given command shall be executed
        ctx - - contextual data given by executor service
        Returns:
        unique identifier of the request
      • cancelRequest

        void cancelRequest​(Long requestId)
        Cancels active (queued, running or retrying) request
        Parameters:
        requestId - - id of the request to cancel
      • getInterval

        int getInterval()
        Returns:
        configured interval at which executor threads are running
      • setInterval

        void setInterval​(int waitTime)
        Sets interval at which executor threads are running. Should not be used after init method has been called.
        Parameters:
        waitTime -
      • getRetries

        int getRetries()
        Returns:
        configured default number of retries that shall be attempted in case of an error
      • setRetries

        void setRetries​(int defaultNroOfRetries)
        Sets default number of retries that shall be attempted in case of an error. Should not be used after init method has been called.
        Parameters:
        defaultNroOfRetries -
      • getThreadPoolSize

        int getThreadPoolSize()
        Returns:
        configured executor thread pool size
      • setThreadPoolSize

        void setThreadPoolSize​(int nroOfThreads)
        Sets default executor thread pool size. Should not be used after init method has been called.
        Parameters:
        nroOfThreads -
      • getTimeunit

        TimeUnit getTimeunit()
        Returns:
        time unit configured for executor intervals
      • setTimeunit

        void setTimeunit​(TimeUnit timeunit)
        Sets time unit for executor intervals
        Parameters:
        timeunit -
      • init

        void init()
        Initialized executor
      • destroy

        void destroy()
        Destroys executor
      • updateRequestData

        void updateRequestData​(Long requestId,
                               Map<String,​Object> data)
        Updates request data by merging existing (if any) with given. Only allowed for not completed requests (including those in error state).
        Parameters:
        requestId - unique id of the request to be updated
        data - data to be set on the job