public class SimpleDeadlineManager extends AbstractDeadlineManager
DeadlineManager which uses Java's ScheduledExecutorService as scheduling and
triggering mechanism.
Note that this mechanism is non-persistent. Scheduled tasks will be lost then the JVM is shut down, unless special
measures have been taken to prevent that. For more flexible and powerful scheduling options, see QuartzDeadlineManager.
| Constructor and Description |
|---|
SimpleDeadlineManager(ScopeAwareProvider scopeAwareProvider)
Initializes SimpleDeadlineManager with
scopeAwareProvider which will load and send messages to
Scope implementing components. |
SimpleDeadlineManager(ScopeAwareProvider scopeAwareProvider,
ScheduledExecutorService scheduledExecutorService,
TransactionManager transactionManager)
Initializes a SimpleDeadlineManager to handle the process around scheduling and triggering a
DeadlineMessage |
SimpleDeadlineManager(ScopeAwareProvider scopeAwareProvider,
TransactionManager transactionManager)
Initializes SimpleDeadlineManager with
transactionManager and scopeAwareProvider which will
load and send messages to Scope implementing components. |
| Modifier and Type | Method and Description |
|---|---|
void |
cancelAll(String deadlineName)
Cancels all the deadlines corresponding to the given
deadlineName. |
void |
cancelSchedule(String deadlineName,
String scheduleId)
Cancels the deadline corresponding to the given
deadlineName / scheduleId combination. |
void |
schedule(Duration triggerDuration,
String deadlineName,
Object messageOrPayload,
ScopeDescriptor deadlineScope,
String scheduleId)
Schedules a deadline after the given
triggerDuration with provided context. |
runOnPrepareCommitOrNowclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgenerateScheduleId, schedule, schedule, schedule, schedule, schedule, schedule, schedulepublic SimpleDeadlineManager(ScopeAwareProvider scopeAwareProvider)
scopeAwareProvider which will load and send messages to
Scope implementing components. NoTransactionManager is used as
transaction manager and Executors.newSingleThreadScheduledExecutor() with AxonThreadFactory is
used as scheduled executor service.scopeAwareProvider - a List of ScopeAware components which are able to load and send
Messages to components which implement Scopepublic SimpleDeadlineManager(ScopeAwareProvider scopeAwareProvider, TransactionManager transactionManager)
transactionManager and scopeAwareProvider which will
load and send messages to Scope implementing components.
Executors.newSingleThreadScheduledExecutor() with AxonThreadFactory is used as scheduled executor
service.scopeAwareProvider - a List of ScopeAware components which are able to load and send
Messages to components which implement ScopetransactionManager - The transaction manager used to manage transaction during processing of DeadlineMessage when deadline is not metpublic SimpleDeadlineManager(ScopeAwareProvider scopeAwareProvider, ScheduledExecutorService scheduledExecutorService, TransactionManager transactionManager)
DeadlineMessagescopeAwareProvider - a List of ScopeAware components which are able to load and send
Messages to components which implement ScopescheduledExecutorService - Java's service used for scheduling and triggering deadlinestransactionManager - The transaction manager used to manage transaction during processing of DeadlineMessage when deadline is not metpublic void schedule(Duration triggerDuration, String deadlineName, Object messageOrPayload, ScopeDescriptor deadlineScope, String scheduleId)
DeadlineManagertriggerDuration with provided context. The provided
deadlineName / scheduleId combination can be used to cancel the scheduled deadline.
The given messageOrPayload may be any object, as well as a DeadlineMessage. In the latter case, the
instance provided is the donor for the payload and MetaData of the actual
deadline being used. In the former case, the given messageOrPayload will be wrapped as the payload of a
DeadlineMessage.
Scheduling a deadline with the same deadlineName and scheduleId will replace the previous
schedule with the new one.
triggerDuration - A Duration describing the waiting period before handling the deadlinedeadlineName - A String representing the name of the deadline to schedulemessageOrPayload - A Message or payload for a message as an
ObjectdeadlineScope - A ScopeDescriptor describing the scope within which the deadline was scheduledscheduleId - A String schedule id to use when cancelling the schedulepublic void cancelSchedule(String deadlineName, String scheduleId)
DeadlineManagerdeadlineName / scheduleId combination.
This method has no impact on deadlines which have already been triggered.public void cancelAll(String deadlineName)
DeadlineManagerdeadlineName.
This method has no impact on deadlines which have already been triggered.deadlineName - A String representing the name of the deadlines to cancelCopyright © 2010–2018. All rights reserved.