Interface SimpleScheduledExecutor

    • Method Detail

      • submit

        Future<?> submit​(Runnable task)
        Submits a Runnable task for execution and returns a Future representing that task.
        Parameters:
        task - the task to submit
        Returns:
        a Future representing pending completion of the task
        Throws:
        RejectedExecutionException - if the task cannot be scheduled for execution
      • schedule

        ScheduledFuture<?> schedule​(Runnable command,
                                    long delay,
                                    TimeUnit unit)
        Submits a task that becomes enabled after the given delay.
        Parameters:
        command - the task to execute
        delay - the time from now to delay execution
        unit - the time unit of the delay parameter
        Returns:
        a ScheduledFuture representing pending completion of the submitted task.
        Throws:
        RejectedExecutionException - if the task cannot be scheduled for execution
      • offer

        default Future<?> offer​(Runnable task)
        Makes an attempt to submit a task for execution. If the attempt is successful - returns a Future representing that task. Otherwise, in case submitting a task would result in blocking - task is not submitted and an exception is thrown.
        Parameters:
        task - the task to submit
        Returns:
        a Future representing pending completion of the task
        Throws:
        RejectedExecutionException - if the task cannot be scheduled for execution, or doing so would result in blocking the tread.
      • shutdownNow

        void shutdownNow()
        Attempts to stop all actively executing tasks, halts the processing of waiting tasks.
      • isBlocking

        boolean isBlocking()
        Returns:
        true if this executor may block when a task is submitted to it; false if it never block (e.g. throws an RejectedExecutionException).