Packages

package util

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. All

Type Members

  1. class AtomicFSM [S] extends AtomicReference[S]

    A class for a finite state machine whose state may be transitioned atomically by any number of concurrent threads.

    A class for a finite state machine whose state may be transitioned atomically by any number of concurrent threads.

    During the time it takes to compute a new state for the FSM, another thread may change the FSMs state, invalidating the newly computed state. To deal with this issue, AtomicFSM stores the state of the FSM using AtomicReference and after computing a new state, uses AtomicReference CAS to atomically compare the current state to the one originally used to compute the new state. If the current state does not match the original state used to compute the new state, then CAS update fails and the new state is discarded. The whole process is repeated using the updated current state. This will repeat until a new computed state successfully changes the current state. Because states may be discarded and transition functions invoked multiple times during this process, states and transition functions should never create side effects themselves. Instead all transition side effects should be placed in the onTransition function. When a state is successfully transitioned, onTransition is called with both the original and new state. This method can be used to safely create state transition side effects.

    S

    the type of state

  2. trait Barrier extends AnyRef

    A trait for a barrier that can be used by callers to synchronize on an event by waiting for the barrier to be set.

  3. trait ConcurrentTestContext extends ExecutionContext with ScheduledExecutionContext

    A context for testing concurrent code that provides: 1) an ExecutionContext that keeps track of the number of active and completed Runnables 2) a Timer for tracking elapsed duration since start of test 3) a SerializationSchedule for detecting order of execution of events 4) a precision delay function that accumulates any delay error

  4. trait DelegatedFuture [A] extends Future[A]

    A base trait for a future that delegates its implementation to another delegate future

  5. trait Latch extends Barrier

    A trait for a latch that can be set once to synchronize events that are waiting on the barrier.

  6. trait Lock extends AnyRef

    A trait for a non-blocking lock that ensures a synchronous execution schedule for all callers.

    A trait for a non-blocking lock that ensures a synchronous execution schedule for all callers. A caller calls the lock method to execute a task synchronously once the lock is available. Simultaneous tasks are placed in a FIFO queue while awaiting execution.

    Note1: Because Lock accepts a function to the task to run, it is not possible for callers to double lock, double release or forget to release the lock. Note2: Lock is NOT reentrant Note3: Lock should never be used when other locking options make more sense. Lock is designed for synchronizing many tasks (100+) and/or long running tasks (10ms+). Unlike other locking options, Lock does not block and consume a thread while waiting for the lock to become available. However, Lock is not the most performant option.

  7. trait PeriodicProgressReporter extends TaskEventListener

    A trait for a progress reporter that reports progress only at the specified report interval

  8. case class Progress (completed: Int, optTotal: Option[Int], startTime_ns: Long) extends Product with Serializable

    A case class to report progress in a computation

    A case class to report progress in a computation

    completed

    the count of iterations completed so far

    optTotal

    Some(total iterations in computation) or None if the computation has an unknown size

    startTime_ns

    the time in nanoseconds returned by System.nanoTime when the computation was started

  9. trait RetryDecider extends AnyRef

    A trait to decide whether to retry a failure in a task.

    A trait to decide whether to retry a failure in a task. Tasks are identified by their sequence number.

    Note: implementations must be thread safe.

  10. trait Semaphore extends AnyRef

    A trait for a non-blocking semaphore that ensures limiting concurrent execution to tasks that have been granted the requested number of permits from a limited pool of permits.

    A trait for a non-blocking semaphore that ensures limiting concurrent execution to tasks that have been granted the requested number of permits from a limited pool of permits. The acquire method is used to request the execution of a task once the requested number of permits become available. If the permits are not immediately available, the request is placed into a FIFO queue while waiting for permits to become available. The permit pool size is typically static with permits released back to the pool upon completion of tasks. However, some implementations may have dynamic sized pools that expend permits instead of releasing them, replenishing permits through some other mechanism.

    Note1: Because Semaphore accepts a function to the task to run, it is not possible for callers to double lock, double release or forget to release permits. Note2: Semaphore is NOT reentrant Note3: Semaphore should never be used when other options make more sense. Semaphore is designed for synchronizing many tasks (100+) and/or long running tasks (10ms+). Unlike other options, Semaphore does not block and consume a thread while waiting for permits to become available. However, Semaphore is not the most performant option.

  11. trait Sequencer extends AnyRef

    A trait used to guarantee a series of unordered tasks occur sequentially.

    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.

  12. class SerializationSchedule [ID] extends AnyRef

    A case class for determining the ordering of instantaneous and time-spanning real-time events

    A case class for determining the ordering of instantaneous and time-spanning real-time events

    ID

    event identifier type

  13. trait SimpleProgressReporter extends TaskEventListener

    A trait for a simple progress reporter that accumulates total progress from completed reports and makes a report each time there is progress during a task.

  14. trait TaskEventListener extends AnyRef

    A trait for listening to the progress of a task that consists of one or more discrete steps.

    A trait for listening to the progress of a task that consists of one or more discrete steps. Each step is identified by a sequence number.

    Note: implementations must be thread safe

  15. trait ThrottleControl extends AnyRef

    A trait for controlling the throttle value of some operation

  16. trait Throttler extends ThrottleControl

    A trait that ensures a series of tasks run no faster than the throttle setting.

    A trait that ensures a series of tasks run no faster than the throttle setting. Callers schedule tasks by calling the run method. If at least throttle setting nanoseconds have passed since the last task completed, the supplied function is immediately executed, otherwise it is scheduled for execution once throttle nanoseconds have expired. Tasks scheduled at the same time for later execution will be executed in a FIFO manner. Throttler guarantees that all tasks will have at least throttle nanoseconds separating their completion. However, it can not guarantee that the elapsed time between tasks will not be greater than the throttle setting.

Ungrouped