Top Description Fields Constructors Methods
com.google.common.util.concurrent

pack-priv abstract Class WrappingScheduledExecutorService

extends WrappingExecutorService
implements ScheduledExecutorService
Class Inheritance
All Implemented Interfaces
java.util.concurrent.ScheduledExecutorService, java.util.concurrent.ExecutorService, java.lang.AutoCloseable, java.util.concurrent.Executor
Annotations
@J2ktIncompatible
@GwtIncompatible
@ElementTypesAreNonnullByDefault
Imports
com.google.common.annotations.GwtIncompatible, .J2ktIncompatible, java.util.concurrent.Callable, .ScheduledExecutorService, .ScheduledFuture, .TimeUnit, org.checkerframework.checker.nullness.qual.Nullable

An abstract ScheduledExecutorService that allows subclasses to wrap tasks before they are submitted to the underlying executor.

Note that task wrapping may occur even if the task is never executed.

Author
Luke Sandberg

Field Summary

Modifier and TypeField and Description
pack-priv final ScheduledExecutorService

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public final ScheduledFuture<?>
schedule(Runnable
the task to execute
command
,
long
the time from now to delay execution
delay
,
TimeUnit
the time unit of the delay parameter
unit
)

Implements java.util.concurrent.ScheduledExecutorService.schedule.

Submits a one-shot task that becomes enabled after the given delay.
public final <V extends @Nullable Object> ScheduledFuture<V>
schedule(Callable<V>
the function to execute
task
,
long
the time from now to delay execution
delay
,
TimeUnit
the time unit of the delay parameter
unit
)

Implements java.util.concurrent.ScheduledExecutorService.schedule.

Submits a value-returning one-shot task that becomes enabled after the given delay.
public final ScheduledFuture<?>
scheduleAtFixedRate(Runnable
the task to execute
command
,
long
the time to delay first execution
initialDelay
,
long
the period between successive executions
period
,
TimeUnit
the time unit of the initialDelay and period parameters
unit
)

Implements java.util.concurrent.ScheduledExecutorService.scheduleAtFixedRate.

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.
public final ScheduledFuture<?>
scheduleWithFixedDelay(Runnable
the task to execute
command
,
long
the time to delay first execution
initialDelay
,
long
the delay between the termination of one execution and the commencement of the next
delay
,
TimeUnit
the time unit of the initialDelay and delay parameters
unit
)

Implements java.util.concurrent.ScheduledExecutorService.scheduleWithFixedDelay.

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.
Inherited from com.google.common.util.concurrent.WrappingExecutorService:
awaitTerminationexecuteinvokeAllinvokeAllinvokeAnyinvokeAnyisShutdownisTerminatedshutdownshutdownNowsubmitsubmitsubmitwrapTaskwrapTask

Field Detail

delegateback to summary
pack-priv final ScheduledExecutorService delegate

Hides com.google.common.util.concurrent.WrappingExecutorService.delegate.

Constructor Detail

WrappingScheduledExecutorServiceback to summary
protected WrappingScheduledExecutorService(ScheduledExecutorService delegate)

Method Detail

scheduleback to summary
public final ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit)

Implements java.util.concurrent.ScheduledExecutorService.schedule.

Doc from java.util.concurrent.ScheduledExecutorService.schedule.

Submits a one-shot task that becomes enabled after the given delay.

Parameters
command:Runnable

the task to execute

delay:long

the time from now to delay execution

unit:TimeUnit

the time unit of the delay parameter

Returns:ScheduledFuture<?>

a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion

Annotations
@Override
scheduleback to summary
public final <V extends @Nullable Object> ScheduledFuture<V> schedule(Callable<V> task, long delay, TimeUnit unit)

Implements java.util.concurrent.ScheduledExecutorService.schedule.

Doc from java.util.concurrent.ScheduledExecutorService.schedule.

Submits a value-returning one-shot task that becomes enabled after the given delay.

Parameters
<V>
the type of the callable's result
task:Callable<V>

the function to execute

delay:long

the time from now to delay execution

unit:TimeUnit

the time unit of the delay parameter

Returns:ScheduledFuture<V>

a ScheduledFuture that can be used to extract result or cancel

Annotations
@Override
scheduleAtFixedRateback to summary
public final ScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit)

Implements java.util.concurrent.ScheduledExecutorService.scheduleAtFixedRate.

Doc from java.util.concurrent.ScheduledExecutorService.scheduleAtFixedRate.

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 explicitly cancelled via the returned future.
  • The executor terminates, also resulting in task cancellation.
  • An execution of the task throws an exception. In this case calling get on the returned future will throw ExecutionException, holding the exception as its cause.
Subsequent executions are suppressed. Subsequent calls to isDone() 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.

Parameters
command:Runnable

the task to execute

initialDelay:long

the time to delay first execution

period:long

the period between successive executions

unit:TimeUnit

the time unit of the initialDelay and period parameters

Returns:ScheduledFuture<?>

a ScheduledFuture representing pending completion of the series of repeated tasks. The future's get() method will never return normally, and will throw an exception upon task cancellation or abnormal termination of a task execution.

Annotations
@Override
scheduleWithFixedDelayback to summary
public final ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit)

Implements java.util.concurrent.ScheduledExecutorService.scheduleWithFixedDelay.

Doc from java.util.concurrent.ScheduledExecutorService.scheduleWithFixedDelay.

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 explicitly cancelled via the returned future.
  • The executor terminates, also resulting in task cancellation.
  • An execution of the task throws an exception. In this case calling get on the returned future will throw ExecutionException, holding the exception as its cause.
Subsequent executions are suppressed. Subsequent calls to isDone() on the returned future will return true.
Parameters
command:Runnable

the task to execute

initialDelay:long

the time to delay first execution

delay:long

the delay between the termination of one execution and the commencement of the next

unit:TimeUnit

the time unit of the initialDelay and delay parameters

Returns:ScheduledFuture<?>

a ScheduledFuture representing pending completion of the series of repeated tasks. The future's get() method will never return normally, and will throw an exception upon task cancellation or abnormal termination of a task execution.

Annotations
@Override