trait Sequencer extends AnyRef
A trait used to guarantee a series of unordered tasks occur sequentially. By associating a sequence number with each task, the sequencer can determine whether to immediately run a task or queue the task for later. When a task has been queued and the sequence number for that task has been reached, the task is removed from the queue and executed. The sequence number is only advanced after the task completes.
Note: it is assumed each task has a unique sequence number. A request to execute a task with a sequence number that is less than the current sequence number causes an IllegalArgumentException to be thrown.
- Alphabetic
- By Inheritance
- Sequencer
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
next: Int
- returns
the next sequence number to be executed
-
abstract
def
when[X](sequenceNumber: Int)(task: ⇒ Future[X])(implicit ec: ExecutionContext): DeferredFuture[X]
- returns
a Future that completes once the sequence number has been reached and the task has completed
- Exceptions thrown
java.lang.IllegalArgumentException
if sequenceNumber is less than next