Interface ListeningScheduledExecutorService

    • Method Detail

      • schedule

         command,
                                              long delay,
                                               unit)
        Description copied from interface: 
        Submits a one-shot task that becomes enabled after the given delay.
        Specified by:
         in interface 
        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 task and whose get() method will return null upon completion
        Since:
        15.0 (previously returned ScheduledFuture)
      • schedule

        <V> <V> callable,
                                                  long delay,
                                                   unit)
        Description copied from interface: 
        Submits a value-returning one-shot task that becomes enabled after the given delay.
        Specified by:
         in interface 
        Type Parameters:
        V - the type of the callable's result
        Parameters:
        callable - the function to execute
        delay - the time from now to delay execution
        unit - the time unit of the delay parameter
        Returns:
        a ScheduledFuture that can be used to extract result or cancel
        Since:
        15.0 (previously returned ScheduledFuture)
      • scheduleAtFixedRate

         command,
                                                         long initialDelay,
                                                         long period,
                                                          unit)
        Description copied from interface: 
        Submits a periodic action that becomes enabled first after the given initial delay, and subsequently with the given period; that is, executions will commence after initialDelay, then initialDelay + period, then initialDelay + 2 * period, and so on.

        The sequence of task executions continues indefinitely until one of the following exceptional completions occur:

        • The task is via the returned future.
        • The executor terminates, also resulting in task cancellation.
        • An execution of the task throws an exception. In this case calling on the returned future will throw , holding the exception as its cause.
        Subsequent executions are suppressed. Subsequent calls to on the returned future will return true.

        If any execution of this task takes longer than its period, then subsequent executions may start late, but will not concurrently execute.

        Specified by:
         in interface 
        Parameters:
        command - the task to execute
        initialDelay - the time to delay first execution
        period - the period between successive executions
        unit - the time unit of the initialDelay and period parameters
        Returns:
        a ScheduledFuture representing pending completion of the series of repeated tasks. The future's method will never return normally, and will throw an exception upon task cancellation or abnormal termination of a task execution.
        Since:
        15.0 (previously returned ScheduledFuture)
      • scheduleWithFixedDelay

         command,
                                                            long initialDelay,
                                                            long delay,
                                                             unit)
        Description copied from interface: 
        Submits a periodic action that becomes enabled first after the given initial delay, and subsequently with the given delay between the termination of one execution and the commencement of the next.

        The sequence of task executions continues indefinitely until one of the following exceptional completions occur:

        • The task is via the returned future.
        • The executor terminates, also resulting in task cancellation.
        • An execution of the task throws an exception. In this case calling on the returned future will throw , holding the exception as its cause.
        Subsequent executions are suppressed. Subsequent calls to on the returned future will return true.
        Specified by:
         in interface 
        Parameters:
        command - the task to execute
        initialDelay - the time to delay first execution
        delay - the delay between the termination of one execution and the commencement of the next
        unit - the time unit of the initialDelay and delay parameters
        Returns:
        a ScheduledFuture representing pending completion of the series of repeated tasks. The future's method will never return normally, and will throw an exception upon task cancellation or abnormal termination of a task execution.
        Since:
        15.0 (previously returned ScheduledFuture)