Top Description Fields Constructors Methods
org.springframework.scheduling.support

public Class SimpleTriggerContext

extends Object
implements TriggerContext
Class Inheritance
All Implemented Interfaces
org.springframework.scheduling.TriggerContext
Imports
java.time.Clock, .Instant, java.util.Date, org.springframework.lang.Nullable, org.springframework.scheduling.TriggerContext

Simple data holder implementation of the TriggerContext interface.
Author
Juergen Hoeller
Since
3.0

Field Summary

Modifier and TypeField and Description
private final Clock
private volatile Instant
private volatile Instant
private volatile Instant

Constructor Summary

AccessConstructor and Description
public
SimpleTriggerContext()

Create a SimpleTriggerContext with all time values set to null, exposing the system clock for the default time zone.

public
SimpleTriggerContext(Date
last scheduled execution time
lastScheduledExecutionTime
,
Date
last actual execution time
lastActualExecutionTime
,
Date
last completion time
lastCompletionTime
)

Deprecated since 6.0. as of 6.0, in favor of SimpleTriggerContext(Instant, Instant, Instant)
Create a SimpleTriggerContext with the given time values, exposing the system clock for the default time zone.
public
SimpleTriggerContext(Instant
last scheduled execution time
lastScheduledExecution
,
Instant
last actual execution time
lastActualExecution
,
Instant
last completion time
lastCompletion
)

Create a SimpleTriggerContext with the given time values, exposing the system clock for the default time zone.

public
SimpleTriggerContext(Clock
the clock to use for trigger calculation
clock
)

Create a SimpleTriggerContext with all time values set to null, exposing the given clock.

Method Summary

Modifier and TypeMethod and Description
public Clock
getClock()

Overrides default org.springframework.scheduling.TriggerContext.getClock.

Return the clock to use for trigger calculation.
public Instant
lastActualExecution()

Implements org.springframework.scheduling.TriggerContext.lastActualExecution.

Return the last actual execution time of the task, or null if not scheduled before.
public Instant
lastCompletion()

Implements org.springframework.scheduling.TriggerContext.lastCompletion.

Return the last completion time of the task, or null if not scheduled before.
public Instant
lastScheduledExecution()

Implements org.springframework.scheduling.TriggerContext.lastScheduledExecution.

Return the last scheduled execution time of the task, or null if not scheduled before.
private static Instant
public void
update(Date
last scheduled execution time
lastScheduledExecutionTime
,
Date
last actual execution time
lastActualExecutionTime
,
Date
last completion time
lastCompletionTime
)

Deprecated since 6.0. as of 6.0, in favor of update(Instant, Instant, Instant)
Update this holder's state with the latest time values.
public void
update(Instant
last scheduled execution time
lastScheduledExecution
,
Instant
last actual execution time
lastActualExecution
,
Instant
last completion time
lastCompletion
)

Update this holder's state with the latest time values.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

clockback to summary
private final Clock clock
lastActualExecutionback to summary
private volatile Instant lastActualExecution
Annotations
@Nullable
lastCompletionback to summary
private volatile Instant lastCompletion
Annotations
@Nullable
lastScheduledExecutionback to summary
private volatile Instant lastScheduledExecution
Annotations
@Nullable

Constructor Detail

SimpleTriggerContextback to summary
public SimpleTriggerContext()

Create a SimpleTriggerContext with all time values set to null, exposing the system clock for the default time zone.

SimpleTriggerContextback to summary
public SimpleTriggerContext(Date lastScheduledExecutionTime, Date lastActualExecutionTime, Date lastCompletionTime)

Deprecated

since 6.0.

as of 6.0, in favor of SimpleTriggerContext(Instant, Instant, Instant)

Create a SimpleTriggerContext with the given time values, exposing the system clock for the default time zone.

Parameters
lastScheduledExecutionTime:Date

last scheduled execution time

lastActualExecutionTime:Date

last actual execution time

lastCompletionTime:Date

last completion time

Annotations
@Deprecated
since:6.0
SimpleTriggerContextback to summary
public SimpleTriggerContext(Instant lastScheduledExecution, Instant lastActualExecution, Instant lastCompletion)

Create a SimpleTriggerContext with the given time values, exposing the system clock for the default time zone.

Parameters
lastScheduledExecution:Instant

last scheduled execution time

lastActualExecution:Instant

last actual execution time

lastCompletion:Instant

last completion time

SimpleTriggerContextback to summary
public SimpleTriggerContext(Clock clock)

Create a SimpleTriggerContext with all time values set to null, exposing the given clock.

Parameters
clock:Clock

the clock to use for trigger calculation

Since
5.3
See Also
update(Instant, Instant, Instant)

Method Detail

getClockback to summary
public Clock getClock()

Overrides default org.springframework.scheduling.TriggerContext.getClock.

Doc from org.springframework.scheduling.TriggerContext.getClock.

Return the clock to use for trigger calculation.

Defaults to Clock#systemDefaultZone().

Annotations
@Override
lastActualExecutionback to summary
public Instant lastActualExecution()

Implements org.springframework.scheduling.TriggerContext.lastActualExecution.

Doc from org.springframework.scheduling.TriggerContext.lastActualExecution.

Return the last actual execution time of the task, or null if not scheduled before.

Annotations
@Override
@Nullable
lastCompletionback to summary
public Instant lastCompletion()

Implements org.springframework.scheduling.TriggerContext.lastCompletion.

Doc from org.springframework.scheduling.TriggerContext.lastCompletion.

Return the last completion time of the task, or null if not scheduled before.

Annotations
@Override
@Nullable
lastScheduledExecutionback to summary
public Instant lastScheduledExecution()

Implements org.springframework.scheduling.TriggerContext.lastScheduledExecution.

Doc from org.springframework.scheduling.TriggerContext.lastScheduledExecution.

Return the last scheduled execution time of the task, or null if not scheduled before.

Annotations
@Override
@Nullable
toInstantback to summary
private static Instant toInstant(Date date)
Annotations
@Nullable
updateback to summary
public void update(Date lastScheduledExecutionTime, Date lastActualExecutionTime, Date lastCompletionTime)

Deprecated

since 6.0.

as of 6.0, in favor of update(Instant, Instant, Instant)

Update this holder's state with the latest time values.

Parameters
lastScheduledExecutionTime:Date

last scheduled execution time

lastActualExecutionTime:Date

last actual execution time

lastCompletionTime:Date

last completion time

Annotations
@Deprecated
since:6.0
updateback to summary
public void update(Instant lastScheduledExecution, Instant lastActualExecution, Instant lastCompletion)

Update this holder's state with the latest time values.

Parameters
lastScheduledExecution:Instant

last scheduled execution time

lastActualExecution:Instant

last actual execution time

lastCompletion:Instant

last completion time