akka.dispatch

Type members

Classlikes

@nowarn("msg=deprecated")

Configurator for creating akka.dispatch.BalancingDispatcher. Returns the same dispatcher instance for each invocation of the dispatcher() method.

Configurator for creating akka.dispatch.BalancingDispatcher. Returns the same dispatcher instance for each invocation of the dispatcher() method.

Source:
Dispatchers.scala
final case class BoundedControlAwareMailbox(capacity: Int, pushTimeOut: FiniteDuration) extends MailboxType with ProducesMessageQueue[MessageQueue] with ProducesPushTimeoutSemanticsMailbox

BoundedControlAwareMailbox is a bounded MailboxType, that maintains two queues to allow messages that extend akka.dispatch.ControlMessage to be delivered with priority.

BoundedControlAwareMailbox is a bounded MailboxType, that maintains two queues to allow messages that extend akka.dispatch.ControlMessage to be delivered with priority.

Companion:
object
Source:
Mailbox.scala
case class BoundedDequeBasedMailbox(capacity: Int, pushTimeOut: FiniteDuration) extends MailboxType with ProducesMessageQueue[MessageQueue] with ProducesPushTimeoutSemanticsMailbox

BoundedDequeBasedMailbox is an bounded MailboxType, backed by a Deque.

BoundedDequeBasedMailbox is an bounded MailboxType, backed by a Deque.

Companion:
object
Source:
Mailbox.scala

BoundedMessageQueueSemantics adds bounded semantics to a DequeBasedMessageQueue, i.e. blocking enqueue with timeout.

BoundedMessageQueueSemantics adds bounded semantics to a DequeBasedMessageQueue, i.e. blocking enqueue with timeout.

Source:
Mailbox.scala
final case class BoundedMailbox(capacity: Int, pushTimeOut: FiniteDuration) extends MailboxType with ProducesMessageQueue[MessageQueue] with ProducesPushTimeoutSemanticsMailbox

BoundedMailbox is the default bounded MailboxType used by Akka Actors.

BoundedMailbox is the default bounded MailboxType used by Akka Actors.

Companion:
object
Source:
Mailbox.scala
Companion:
class
Source:
Mailbox.scala

BoundedMessageQueueSemantics adds bounded semantics to a QueueBasedMessageQueue, i.e. blocking enqueue with timeout.

BoundedMessageQueueSemantics adds bounded semantics to a QueueBasedMessageQueue, i.e. blocking enqueue with timeout.

Source:
Mailbox.scala
class BoundedNodeMessageQueue(capacity: Int) extends AbstractBoundedNodeQueue[Envelope] with MessageQueue with BoundedMessageQueueSemantics with MultipleConsumerSemantics

Lock-free bounded non-blocking multiple-producer single-consumer queue. Discards overflowing messages into DeadLetters.

Lock-free bounded non-blocking multiple-producer single-consumer queue. Discards overflowing messages into DeadLetters.

Source:
Mailbox.scala
class BoundedPriorityMailbox(val cmp: Comparator[Envelope], val capacity: Int, val pushTimeOut: Duration) extends MailboxType with ProducesMessageQueue[MessageQueue] with ProducesPushTimeoutSemanticsMailbox

BoundedPriorityMailbox is a bounded mailbox that allows for prioritization of its contents. Extend this class and provide the Comparator in the constructor.

BoundedPriorityMailbox is a bounded mailbox that allows for prioritization of its contents. Extend this class and provide the Comparator in the constructor.

Companion:
object
Source:
Mailbox.scala
class BoundedStablePriorityMailbox(val cmp: Comparator[Envelope], val capacity: Int, val pushTimeOut: Duration) extends MailboxType with ProducesMessageQueue[MessageQueue] with ProducesPushTimeoutSemanticsMailbox

BoundedStablePriorityMailbox is a bounded mailbox that allows for prioritization of its contents. Unlike the BoundedPriorityMailbox it preserves ordering for messages of equal priority. Extend this class and provide the Comparator in the constructor.

BoundedStablePriorityMailbox is a bounded mailbox that allows for prioritization of its contents. Unlike the BoundedPriorityMailbox it preserves ordering for messages of equal priority. Extend this class and provide the Comparator in the constructor.

Companion:
object
Source:
Mailbox.scala

ControlAwareMessageQueue handles messages that extend akka.dispatch.ControlMessage with priority.

ControlAwareMessageQueue handles messages that extend akka.dispatch.ControlMessage with priority.

Source:
Mailbox.scala

Messages that extend this trait will be handled with priority by control aware mailboxes.

Messages that extend this trait will be handled with priority by control aware mailboxes.

Source:
Mailbox.scala

DequeBasedMessageQueue refines QueueBasedMessageQueue to be backed by a java.util.Deque.

DequeBasedMessageQueue refines QueueBasedMessageQueue to be backed by a java.util.Deque.

Source:
Mailbox.scala
class Dispatcher(_configurator: MessageDispatcherConfigurator, val id: String, val throughput: Int, val throughputDeadlineTime: Duration, executorServiceFactoryProvider: ExecutorServiceFactoryProvider, val shutdownTimeout: FiniteDuration) extends MessageDispatcher

The event-based Dispatcher binds a set of Actors to a thread pool backed up by a BlockingQueue.

The event-based Dispatcher binds a set of Actors to a thread pool backed up by a BlockingQueue.

The preferred way of creating dispatchers is to define configuration of it and use the the lookup method in akka.dispatch.Dispatchers.

Value parameters:
throughput

positive integer indicates the dispatcher will only process so much messages at a time from the mailbox, without checking the mailboxes of other actors. Zero or negative means the dispatcher always continues until the mailbox is empty. Larger values (or zero or negative) increase throughput, smaller values increase fairness

Source:
Dispatcher.scala

Configurator for creating akka.dispatch.Dispatcher. Returns the same dispatcher instance for each invocation of the dispatcher() method.

Configurator for creating akka.dispatch.Dispatcher. Returns the same dispatcher instance for each invocation of the dispatcher() method.

Source:
Dispatchers.scala

DispatcherPrerequisites represents useful contextual pieces when constructing a MessageDispatcher

DispatcherPrerequisites represents useful contextual pieces when constructing a MessageDispatcher

Source:
Dispatchers.scala
Companion:
class
Source:
Dispatchers.scala
@DoNotInherit

Dispatchers are to be defined in configuration to allow for tuning for different environments. Use the lookup method to create a dispatcher as specified in configuration.

Dispatchers are to be defined in configuration to allow for tuning for different environments. Use the lookup method to create a dispatcher as specified in configuration.

A dispatcher config can also be an alias, in that case it is a config string value pointing to the actual dispatcher config.

Look in akka.actor.default-dispatcher section of the reference.conf for documentation of dispatcher options.

Not for user instantiation or extension

Companion:
object
Source:
Dispatchers.scala
final case class Envelope

ExecutionContexts is the Java API for ExecutionContexts

ExecutionContexts is the Java API for ExecutionContexts

Source:
Future.scala
abstract class ExecutorServiceConfigurator(@unused config: Config, @unused prerequisites: DispatcherPrerequisites) extends ExecutorServiceFactoryProvider

An ExecutorServiceConfigurator is a class that given some prerequisites and a configuration can create instances of ExecutorService

An ExecutorServiceConfigurator is a class that given some prerequisites and a configuration can create instances of ExecutorService

Source:
AbstractDispatcher.scala
trait ExecutorServiceDelegate extends ExecutorService

As the name says

As the name says

Source:
ThreadPoolBuilder.scala

Function0 without the fun stuff (mostly for the sake of the Java API side of things)

Function0 without the fun stuff (mostly for the sake of the Java API side of things)

Source:
ThreadPoolBuilder.scala

Generic way to specify an ExecutorService to a Dispatcher, create it with the given name if desired

Generic way to specify an ExecutorService to a Dispatcher, create it with the given name if desired

Source:
ThreadPoolBuilder.scala
object Filter

Java API (not recommended): Callback for the Future.filter operation that creates a new Future which will conditionally contain the success of another Future.

Java API (not recommended): Callback for the Future.filter operation that creates a new Future which will conditionally contain the success of another Future.

Unfortunately it is not possible to express the type of a Scala filter in Java: Function1[T, Boolean], where “Boolean” is the primitive type. It is possible to use Future.filter by constructing such a function indirectly:

import static akka.dispatch.Filter.filterOf;
Future<String> f = ...;
f.filter(filterOf(new Function<String, Boolean>() {
 @Override
 public Boolean apply(String s) {
   ...
 }
}));

However, Future.filter exists mainly to support Scala’s for-comprehensions, thus Java users should prefer Future.map, translating non-matching values to failure cases.

Source:
Future.scala
@nowarn("msg=deprecated")
abstract class Foreach[-T] extends UnitFunctionBridge[T]

Callback for the Future.foreach operation that will be invoked if the Future that this callback is registered on becomes completed with a success. This method is essentially the same operation as onSuccess.

Callback for the Future.foreach operation that will be invoked if the Future that this callback is registered on becomes completed with a success. This method is essentially the same operation as onSuccess.

SAM (Single Abstract Method) class Java API

Source:
Future.scala
object Futures

Futures is the Java API for Futures and Promises

Futures is the Java API for Futures and Promises

Source:
Future.scala

MailboxType is a factory to create MessageQueues for an optionally provided ActorContext.

MailboxType is a factory to create MessageQueues for an optionally provided ActorContext.

Possibly Important Notice

When implementing a custom mailbox type, be aware that there is special semantics attached to system.actorOf() in that sending to the returned ActorRef may—for a short period of time—enqueue the messages first in a dummy queue. Top-level actors are created in two steps, and only after the guardian actor has performed that second step will all previously sent messages be transferred from the dummy queue into the real mailbox.

Source:
Mailbox.scala
abstract class Mapper[-T, +R] extends AbstractFunction1[T, R]

Callback for the Future.map and Future.flatMap operations that will be invoked if the Future that this callback is registered on becomes completed with a success. This callback is the equivalent of an akka.japi.Function

Callback for the Future.map and Future.flatMap operations that will be invoked if the Future that this callback is registered on becomes completed with a success. This callback is the equivalent of an akka.japi.Function

Override "apply" normally, or "checkedApply" if you need to throw checked exceptions.

SAM (Single Abstract Method) class

Java API

Source:
Future.scala
abstract class MessageDispatcher(val configurator: MessageDispatcherConfigurator) extends AbstractMessageDispatcher with BatchingExecutor with ExecutionContextExecutor
abstract class MessageDispatcherConfigurator(_config: Config, val prerequisites: DispatcherPrerequisites)

Base class to be used for hooking in new dispatchers into Dispatchers.

Base class to be used for hooking in new dispatchers into Dispatchers.

Source:
AbstractDispatcher.scala

A MessageQueue is one of the core components in forming an Akka Mailbox. The MessageQueue is where the normal messages that are sent to Actors will be enqueued (and subsequently dequeued) It needs to at least support N producers and 1 consumer thread-safely.

A MessageQueue is one of the core components in forming an Akka Mailbox. The MessageQueue is where the normal messages that are sent to Actors will be enqueued (and subsequently dequeued) It needs to at least support N producers and 1 consumer thread-safely.

Source:
Mailbox.scala
final case class MonitorableThreadFactory(name: String, daemonic: Boolean, contextClassLoader: Option[ClassLoader], exceptionHandler: UncaughtExceptionHandler, counter: AtomicLong) extends ThreadFactory with ForkJoinWorkerThreadFactory

This is a marker trait for message queues which support multiple consumers, as is required by the BalancingDispatcher.

This is a marker trait for message queues which support multiple consumers, as is required by the BalancingDispatcher.

Source:
Mailbox.scala
class NodeMessageQueue extends AbstractNodeQueue[Envelope] with MessageQueue with UnboundedMessageQueueSemantics

NonBlockingBoundedMailbox is a high-performance, multiple-producer single-consumer, bounded MailboxType, Noteworthy is that it discards overflow as DeadLetters.

NonBlockingBoundedMailbox is a high-performance, multiple-producer single-consumer, bounded MailboxType, Noteworthy is that it discards overflow as DeadLetters.

It can't have multiple consumers, which rules out using it with BalancingPool (BalancingDispatcher) for instance.

NOTE: NonBlockingBoundedMailbox does not use mailbox-push-timeout-time as it is non-blocking.

Source:
Mailbox.scala
@nowarn("msg=deprecated")
abstract class OnComplete[-T] extends CallbackBridge[Try[T]]

Callback for when a Future is completed with either failure or a success SAM (Single Abstract Method) class

Callback for when a Future is completed with either failure or a success SAM (Single Abstract Method) class

Java API

Source:
Future.scala
@nowarn("msg=deprecated")
abstract class OnFailure extends CallbackBridge[Throwable]

Callback for when a Future is completed with a failure SAM (Single Abstract Method) class

Callback for when a Future is completed with a failure SAM (Single Abstract Method) class

Java API

Source:
Future.scala
@nowarn("msg=deprecated")
abstract class OnSuccess[-T] extends CallbackBridge[T]

Callback for when a Future is completed successfully SAM (Single Abstract Method) class

Callback for when a Future is completed successfully SAM (Single Abstract Method) class

Java API

Source:
Future.scala
class PinnedDispatcher(_configurator: MessageDispatcherConfigurator, _actor: ActorCell, _id: String, _shutdownTimeout: FiniteDuration, _threadPoolConfig: ThreadPoolConfig) extends Dispatcher

Dedicates a unique thread for each actor passed in as reference. Served through its messageQueue.

Dedicates a unique thread for each actor passed in as reference. Served through its messageQueue.

The preferred way of creating dispatchers is to define configuration of it and use the the lookup method in akka.dispatch.Dispatchers.

Source:
PinnedDispatcher.scala

Configurator for creating akka.dispatch.PinnedDispatcher. Returns new dispatcher instance for each invocation of the dispatcher() method.

Configurator for creating akka.dispatch.PinnedDispatcher. Returns new dispatcher instance for each invocation of the dispatcher() method.

Source:
Dispatchers.scala
abstract class PriorityGenerator extends Comparator[Envelope]

A PriorityGenerator is a convenience API to create a Comparator that orders the messages of a PriorityDispatcher

A PriorityGenerator is a convenience API to create a Comparator that orders the messages of a PriorityDispatcher

Companion:
object
Source:
Dispatcher.scala

A QueueBasedMessageQueue is a MessageQueue backed by a java.util.Queue.

A QueueBasedMessageQueue is a MessageQueue backed by a java.util.Queue.

Source:
Mailbox.scala
@nowarn("msg=deprecated")
abstract class Recover[+T] extends RecoverBridge[T]

Callback for the Future.recover operation that conditionally turns failures into successes.

Callback for the Future.recover operation that conditionally turns failures into successes.

SAM (Single Abstract Method) class

Java API

Source:
Future.scala

Trait to signal that an Actor requires a certain type of message queue semantics.

Trait to signal that an Actor requires a certain type of message queue semantics.

The mailbox type will be looked up by mapping the type T via akka.actor.mailbox.requirements in the config, to a mailbox configuration. If no mailbox is assigned on Props or in deployment config then this one will be used.

The queue type of the created mailbox will be checked against the type T and actor creation will fail if it doesn't fulfill the requirements.

Source:
Mailbox.scala
class SaneRejectedExecutionHandler extends RejectedExecutionHandler

The RejectedExecutionHandler used by Akka, it improves on CallerRunsPolicy by throwing a RejectedExecutionException if the executor isShutdown. (CallerRunsPolicy silently discards the runnable in this case, which is arguably broken)

The RejectedExecutionHandler used by Akka, it improves on CallerRunsPolicy by throwing a RejectedExecutionException if the executor isShutdown. (CallerRunsPolicy silently discards the runnable in this case, which is arguably broken)

Source:
ThreadPoolBuilder.scala

SingleConsumerOnlyUnboundedMailbox is a high-performance, multiple producer—single consumer, unbounded MailboxType, with the drawback that you can't have multiple consumers, which rules out using it with BalancingPool (BalancingDispatcher) for instance.

SingleConsumerOnlyUnboundedMailbox is a high-performance, multiple producer—single consumer, unbounded MailboxType, with the drawback that you can't have multiple consumers, which rules out using it with BalancingPool (BalancingDispatcher) for instance.

Currently this queue is slower for some benchmarks than the ConcurrentLinkedQueue from JDK 8 that is used by default, so be sure to measure the performance in your particular setting in order to determine which one to use.

Source:
Mailbox.scala
final case class TaskInvocation(eventStream: EventStream, runnable: Runnable, cleanup: () => Unit) extends Batchable
final case class ThreadPoolConfig(allowCorePoolTimeout: Boolean, corePoolSize: Int, maxPoolSize: Int, threadTimeout: Duration, queueFactory: QueueFactory, rejectionPolicy: RejectedExecutionHandler) extends ExecutorServiceFactoryProvider

A small configuration DSL to create ThreadPoolExecutors that can be provided as an ExecutorServiceFactoryProvider to Dispatcher

A small configuration DSL to create ThreadPoolExecutors that can be provided as an ExecutorServiceFactoryProvider to Dispatcher

Companion:
object
Source:
ThreadPoolBuilder.scala
final case class ThreadPoolConfigBuilder(config: ThreadPoolConfig)

A DSL to configure and create a MessageDispatcher with a ThreadPoolExecutor

A DSL to configure and create a MessageDispatcher with a ThreadPoolExecutor

Source:
ThreadPoolBuilder.scala

UnboundedControlAwareMailbox is an unbounded MailboxType, that maintains two queues to allow messages that extend akka.dispatch.ControlMessage to be delivered with priority.

UnboundedControlAwareMailbox is an unbounded MailboxType, that maintains two queues to allow messages that extend akka.dispatch.ControlMessage to be delivered with priority.

Companion:
object
Source:
Mailbox.scala

UnboundedDequeBasedMailbox is an unbounded MailboxType, backed by a Deque.

UnboundedDequeBasedMailbox is an unbounded MailboxType, backed by a Deque.

Companion:
object
Source:
Mailbox.scala

UnboundedDequeBasedMessageQueueSemantics adds unbounded semantics to a DequeBasedMessageQueue, i.e. a non-blocking enqueue and dequeue.

UnboundedDequeBasedMessageQueueSemantics adds unbounded semantics to a DequeBasedMessageQueue, i.e. a non-blocking enqueue and dequeue.

Source:
Mailbox.scala

UnboundedMailbox is the default unbounded MailboxType used by Akka Actors.

UnboundedMailbox is the default unbounded MailboxType used by Akka Actors.

Companion:
object
Source:
Mailbox.scala
Companion:
class
Source:
Mailbox.scala

UnboundedMessageQueueSemantics adds unbounded semantics to a QueueBasedMessageQueue, i.e. a non-blocking enqueue and dequeue.

UnboundedMessageQueueSemantics adds unbounded semantics to a QueueBasedMessageQueue, i.e. a non-blocking enqueue and dequeue.

Source:
Mailbox.scala
class UnboundedPriorityMailbox(val cmp: Comparator[Envelope], val initialCapacity: Int) extends MailboxType with ProducesMessageQueue[MessageQueue]

UnboundedPriorityMailbox is an unbounded mailbox that allows for prioritization of its contents. Extend this class and provide the Comparator in the constructor.

UnboundedPriorityMailbox is an unbounded mailbox that allows for prioritization of its contents. Extend this class and provide the Comparator in the constructor.

Companion:
object
Source:
Mailbox.scala
class UnboundedStablePriorityMailbox(val cmp: Comparator[Envelope], val initialCapacity: Int) extends MailboxType with ProducesMessageQueue[MessageQueue]

UnboundedStablePriorityMailbox is an unbounded mailbox that allows for prioritization of its contents. Unlike the UnboundedPriorityMailbox it preserves ordering for messages of equal priority. Extend this class and provide the Comparator in the constructor.

UnboundedStablePriorityMailbox is an unbounded mailbox that allows for prioritization of its contents. Unlike the UnboundedPriorityMailbox it preserves ordering for messages of equal priority. Extend this class and provide the Comparator in the constructor.

Companion:
object
Source:
Mailbox.scala
object japi

This class contains bridge classes between Scala and Java. Internal use only.

This class contains bridge classes between Scala and Java. Internal use only.

Source:
Future.scala