Top Inners Fields Constructors Methods
io.github.resilience4j.core

public Class ContextAwareScheduledThreadPoolExecutor

extends ScheduledThreadPoolExecutor
Class Inheritance
Imports
io.github.resilience4j.core.lang.Nullable, org.slf4j.MDC, java.util.*, java.util.concurrent.Callable, .ScheduledFuture, .ScheduledThreadPoolExecutor, .TimeUnit

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private final List<ContextPropagator<T>>
private static final String

Constructor Summary

AccessConstructor and Description
private
ContextAwareScheduledThreadPoolExecutor(int corePoolSize, List<ContextPropagator<T>> contextPropagators)

Method Summary

Modifier and TypeMethod and Description
public List<ContextPropagator<T>>
private Map<String, String>
public static ContextAwareScheduledThreadPoolExecutor.Builder
public 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
)

Overrides java.util.concurrent.ScheduledThreadPoolExecutor.schedule.

Implements java.util.concurrent.ScheduledExecutorService.schedule.

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

public <V> ScheduledFuture<V>
schedule(Callable<V>
the function to execute
callable
,
long
the time from now to delay execution
delay
,
TimeUnit
the time unit of the delay parameter
unit
)

Overrides java.util.concurrent.ScheduledThreadPoolExecutor.schedule.

Implements java.util.concurrent.ScheduledExecutorService.schedule.

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

public 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
)

Overrides java.util.concurrent.ScheduledThreadPoolExecutor.scheduleAtFixedRate.

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 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
)

Overrides java.util.concurrent.ScheduledThreadPoolExecutor.scheduleWithFixedDelay.

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.

private void
Inherited from java.util.concurrent.ScheduledThreadPoolExecutor:
decorateTaskdecorateTaskexecutegetContinueExistingPeriodicTasksAfterShutdownPolicygetExecuteExistingDelayedTasksAfterShutdownPolicygetQueuegetRemoveOnCancelPolicysetContinueExistingPeriodicTasksAfterShutdownPolicysetExecuteExistingDelayedTasksAfterShutdownPolicysetRemoveOnCancelPolicyshutdownshutdownNowsubmitsubmitsubmit

Field Detail

contextPropagatorsback to summary
private final List<ContextPropagator<T>> contextPropagators
THREAD_PREFIXback to summary
private static final String THREAD_PREFIX

Constructor Detail

ContextAwareScheduledThreadPoolExecutorback to summary
private ContextAwareScheduledThreadPoolExecutor(int corePoolSize, List<ContextPropagator<T>> contextPropagators)

Method Detail

getContextPropagatorsback to summary
public List<ContextPropagator<T>> getContextPropagators()
getMdcContextMapback to summary
private Map<String, String> getMdcContextMap()
newScheduledThreadPoolback to summary
public static ContextAwareScheduledThreadPoolExecutor.Builder newScheduledThreadPool()
scheduleback to summary
public ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit)

Overrides java.util.concurrent.ScheduledThreadPoolExecutor.schedule.

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 <V> ScheduledFuture<V> schedule(Callable<V> callable, long delay, TimeUnit unit)

Overrides java.util.concurrent.ScheduledThreadPoolExecutor.schedule.

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
callable: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 ScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit)

Overrides java.util.concurrent.ScheduledThreadPoolExecutor.scheduleAtFixedRate.

Implements java.util.concurrent.ScheduledExecutorService.scheduleAtFixedRate.

Doc from java.util.concurrent.ScheduledThreadPoolExecutor.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:

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

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

the task to execute

initialDelay:long

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

the time to delay first execution

period:long

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

the period between successive executions

unit:TimeUnit

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

the time unit of the initialDelay and period parameters

Returns:ScheduledFuture<?>

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

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 ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit)

Overrides java.util.concurrent.ScheduledThreadPoolExecutor.scheduleWithFixedDelay.

Implements java.util.concurrent.ScheduledExecutorService.scheduleWithFixedDelay.

Doc from java.util.concurrent.ScheduledThreadPoolExecutor.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:

Subsequent executions are suppressed. Subsequent calls to isDone() on the returned future will return true.
Parameters
command:Runnable

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

the task to execute

initialDelay:long

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

the time to delay first execution

delay:long

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

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

unit:TimeUnit

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

the time unit of the initialDelay and delay parameters

Returns:ScheduledFuture<?>

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

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
setMDCContextback to summary
private void setMDCContext(Map<String, String> contextMap)
io.github.resilience4j.core back to summary

public Class ContextAwareScheduledThreadPoolExecutor.Builder

extends Object
Class Inheritance
  • java.lang.Object
  • io.github.resilience4j.core.ContextAwareScheduledThreadPoolExecutor.Builder

Field Summary

Modifier and TypeField and Description
private List<ContextPropagator<T>>
private int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public ContextAwareScheduledThreadPoolExecutor
public ContextAwareScheduledThreadPoolExecutor.Builder
contextPropagators(ContextPropagator<T>... contextPropagators)

public ContextAwareScheduledThreadPoolExecutor.Builder
corePoolSize(int corePoolSize)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contextPropagatorsback to summary
private List<ContextPropagator<T>> contextPropagators
corePoolSizeback to summary
private int corePoolSize

Constructor Detail

Builderback to summary
public Builder()

Method Detail

buildback to summary
public ContextAwareScheduledThreadPoolExecutor build()
contextPropagatorsback to summary
public ContextAwareScheduledThreadPoolExecutor.Builder contextPropagators(ContextPropagator<T>... contextPropagators)
corePoolSizeback to summary
public ContextAwareScheduledThreadPoolExecutor.Builder corePoolSize(int corePoolSize)