Package

io

reactors

Permalink

package reactors

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. reactors
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. trait Channel[T] extends AnyRef

    Permalink

    Channel is a shareable reference to a writing endpoint of a reactor.

    Channel is a shareable reference to a writing endpoint of a reactor.

    By calling the channel's ! method, an event is sent to the channel. The event is eventually emitted on the channel's corresponding event stream, which is readable only by the reactor that owns that channel.

    T

    type of the events propagated by this channel

  2. class ChannelBuilder extends AnyRef

    Permalink

    Used for building channel objects.

  3. case class ChannelUrl(reactorUrl: ReactorUrl, anchor: String) extends Product with Serializable

    Permalink
  4. trait Configuration extends AnyRef

    Permalink
  5. class Connector[T] extends Identifiable

    Permalink

    A pair of a channel and its event stream.

    A pair of a channel and its event stream.

    Allows closing the channel with its seal operation.

  6. abstract class DebugApi extends Reflectable

    Permalink

    Debugger interface for the reactor system.

  7. class DefaultErrorHandler extends ErrorHandler

    Permalink

    The default handler prints the exception to the standard error stream.

  8. trait ErrorHandler extends PartialFunction[Throwable, Unit] with Reflectable

    Permalink

    Class that describes error handlers that report uncaught reactor-level exceptions.

  9. class EventBuffer[T] extends Push[T] with Events[T] with Proxy

    Permalink

    An event buffer that is simultaneously an event stream.

    An event buffer that is simultaneously an event stream.

    Events are stored into the buffer with the enqueue method. Events are dequeued and simultaneously emitted with the dequeue method. Calling unsubscribe unreacts.

    Note: this class can only be used inside a single reactor, and is not meant to be shared across multiple threads.

    T

    type of the events in this event stream

  10. trait EventQueue[T] extends AnyRef

    Permalink

    A queue that buffers events that arrive on the corresponding channel.

    A queue that buffers events that arrive on the corresponding channel.

    The enqueue method may have FIFO queue, priority queue, or some other semantics, depending on the implementation.

  11. trait Events[T] extends AnyRef

    Permalink

    A basic event stream.

    A basic event stream.

    Event streams are special objects that may produce events of a certain type T. Clients may subscribe side-effecting functions (i.e. callbacks) to these events with onReaction, onEvent, onMatch and on -- each of these methods will invoke the callback when an event is produced, but some may be more suitable depending on the use-case.

    An event stream produces events until it unreacts. After the event stream unreacts, it never produces an event again.

    Event streams can also be manipulated using declarative combinators such as map, filter, until, after and scanPast:

    def positiveSquares(r: Events[Int]) = r.map(x => x * x).filter(_ != 0)

    With the exception of onX family of methods, and unless otherwise specified, operators passed to these declarative combinators should be pure -- they should not have any side-effects.

    The result of applying a declarative combinator on Events[T] is usually another Events[S], possibly with a type parameter S different from T. Event sink combinators, such as onEvent, return a Subscription object used to unsubscribe from their event source.

    Combinators that start with the prefix on, to, pipe or get are called *sink combinators*. Calling these combinators subscribes to the event stream and creates a subscription object. The event source is from there on responsible for propagating events to sink combinators until it either *unreacts*, meaning that it will not emit any other events, or the event sink gets *unsubscribed*. The event sink can be unsubscribed by calling the unsubscribe method of the Subscription object. The client is responsible for unsubscribing from an event source once the events are no longer needed. Failure to do so risks *time leaks*, a form of resource leak in which the program gets slower and slower (because it needs to propagate no longer needed events).

    Event streams are specialized for Int, Long and Double.

    Every event stream is bound to a specific Reactor, the basic unit of concurrency. Within a reactor, at most a single event stream propagates events at a time. An event stream will only produce events during the execution of that reactor -- events are never triggered on a different reactor. It is forbidden to share event streams between reactors.

    T

    type of the events in this event stream

  12. trait Hash[T] extends AnyRef

    Permalink
  13. class IVar[T] extends Signal[T]

    Permalink

    An event stream that can be either completed, or unreacted at most once.

    An event stream that can be either completed, or unreacted at most once.

    Assigning a value propagates an event to all the subscribers, and then propagates an unreaction. To assign a value:

    val iv = new Events.IVar[Int]
    iv := 5
    assert(iv() == 5)

    To unreact (i.e. seal, or close) an ivar without assigning a value:

    val iv = new Events.IVar[Int]
    iv.unreact()
    assert(iv.isUnreacted)
    T

    type of the value in the IVar

  14. trait Identifiable extends AnyRef

    Permalink

    Any object that contains a unique id within some scope.

  15. trait Observer[T] extends AnyRef

    Permalink

    An object that can act upon an event or be signalled that there will be no more events.

    An object that can act upon an event or be signalled that there will be no more events.

    T

    type of events the observer responds to

  16. final class Proto[+I <: Reactor[_]] extends AnyRef

    Permalink

    A prototype for instantiating a reactor that takes specific parameters.

    A prototype for instantiating a reactor that takes specific parameters.

    I

    type of the reactor

  17. trait Protocol extends AnyRef

    Permalink

    An encapsulation of a set of event streams and channels.

  18. class RCell[T] extends Signal[T] with Observer[T]

    Permalink

    The reactive cell abstraction represents a mutable memory location whose changes may produce events.

    The reactive cell abstraction represents a mutable memory location whose changes may produce events.

    An RCell is conceptually similar to a reactive emitter lifted into a signal. An RCell can be created full, or empty. If empty, retrieving its value throws an exception. Once assigned, the RCell is no longer empty, until clear gets called.

    T

    the type of the values it stores

  19. trait Reactor[T] extends Reflectable

    Permalink

    A reactor is a basic unit of concurrency.

    A reactor is a basic unit of concurrency.

    A concurrent program in the Reactors framework is composed of multiple reactors, which execute concurrently, and in isolation. The only way they can communicate is by exchanging events using entities called *channels*.

    A Reactor[T] object accepts events of type T on its input channel. One reactor can propagate events concurrently to other reactors. Event streams cannot be shared between reactors -- it is an error to use an event stream originating in one reactor in some different reactor.

    Reactors are defined by extending the Reactor trait. The events passed to reactors can be subscribed to using their main.events stream. Here is an example:

    class MyPrinter extends Reactor[String] {
      main.events onEvent {
        e => println(e)
      }
    }

    Separate reactor instances that exist at runtime are created using reactor systems. Each reactor belongs to a specific reactor system. Usually there is a single reactor system within a single program instance. Here is an example:

    val reactorSystem = ReactorSystem.default("MyReactorSystem")
    val channel = reactorSystem.spawn(Proto[MyPrinter])

    Creating a reactor returns its channel. Events can be sent to a channel using the ! method:

    channel ! "Hi!" // eventually, this is printed by `MyPrinter`

    To stop, a reactor must seal its main channel. The following reactor seals its main channel after receiving the first event:

    class MyPrinter extends Reactor[String] {
      main.events onEvent {
        e =>
        println(e)
        main.seal()
      }
    }

    Reactors also receive special SysEvent events on the sysEvents stream.

    T

    the type of events, which this reactor produces

  20. case class ReactorDied(t: Throwable) extends SysEvent with Product with Serializable

    Permalink

    Denotes that the reactor died due to an exception.

    Denotes that the reactor died due to an exception.

    This event is sent after ReactorStarted. This event is sent before ReactorTerminated, *unless* the exception is thrown while ReactorTerminated is being processed, in which case the ReactorDied is not sent.

    Note that, if the exception is thrown during the reactor constructor invocation and before the appropriate event handler is created, this event cannot be sent to that event handler.

    t

    the exception that the reactor threw

  21. case class ReactorError(msg: String, cause: Throwable) extends Error with Product with Serializable

    Permalink

    Thrown when an error in reactor execution occurs.

  22. class ReactorSystem extends Services

    Permalink

    A system used to create, track and identify reactors.

    A system used to create, track and identify reactors.

    A reactor system is composed of a set of reactors that have a common configuration.

  23. case class ReactorUrl(systemUrl: SystemUrl, name: String) extends Product with Serializable

    Permalink
  24. class Remote extends Service

    Permalink

    Service that tracks different transports for remote communication.

    Service that tracks different transports for remote communication.

    The most important method is resolve, which creates a channel from a channel URL. This allows communication with reactors in non-local reactor systems, e.g. in another process, or on another machine.

  25. trait Scheduler extends AnyRef

    Permalink

    An object that schedules reactors for execution.

    An object that schedules reactors for execution.

    After a reactor is instantiated, its reactor frame is assigned a scheduler by the reactor system. A reactor that is assigned a specific scheduler will always be executed on that same scheduler.

    After creating a reactor, every reactor system will first call the initSchedule method on the reactor frame. Then, the reactor system will call the schedule method every time there are events ready for the reactor.

    Note: Clients never invoke Scheduler operations directly, but can implement their own scheduler if necessary.

    See also

    org.reactors.ReactorSystem

  26. trait Signal[T] extends Events[T] with Subscription

    Permalink

    A special type of an event stream that caches the last emitted event.

    A special type of an event stream that caches the last emitted event.

    This last event is called the signal's value. It can be read using the Signal's apply method.

    T

    the type of the events in this signal

  27. class SilentErrorHandler extends ErrorHandler

    Permalink

    Silent handler ignores exceptions.

  28. class Spec[T] extends AnyRef

    Permalink

    Evidence value for specialized type parameters.

    Evidence value for specialized type parameters.

    Used to artificially insert the type into a type signature.

  29. trait Subscription extends AnyRef

    Permalink

    A subscription to a certain kind of event, event processing or computation.

    A subscription to a certain kind of event, event processing or computation.

    Calling unsubscribe on the subscription causes the events to no longer be propagated to this subscription, or some computation to cease.

    Unsubscribing is idempotent -- calling unsubscribe second time does nothing.

  30. sealed abstract class SysEvent extends AnyRef

    Permalink

    System events are a special kind of internal events that can be observed by reactors.

  31. case class SystemUrl(schema: String, host: String, port: Int) extends Product with Serializable

    Permalink
  32. case class TestControlException(msg: String) extends Throwable with NoStackTrace with Product with Serializable

    Permalink
  33. case class UnhandledException(cause: Throwable) extends Exception with Product with Serializable

    Permalink

    Thrown when an exception is propagated to an event handler, such as onEvent.

  34. type spec = specialized

    Permalink

Value Members

  1. object Channel

    Permalink

    Default channel implementations.

  2. object Configuration

    Permalink
  3. object DebugApi

    Permalink
  4. object EventQueue

    Permalink

    Contains default event queue implementations.

  5. object Events

    Permalink

    Contains useful Events implementations and factory methods.

  6. object IVar

    Permalink
  7. object JvmScheduler

    Permalink
  8. object Lethal

    Permalink

    Matches lethal throwables.

  9. object NonLethal

    Permalink

    Matches non-lethal throwables.

  10. object Observer

    Permalink
  11. object Platform

    Permalink
  12. object Proto

    Permalink
  13. object Protocol

    Permalink
  14. object RCell

    Permalink
  15. object Reactor

    Permalink
  16. object ReactorPreempted extends SysEvent with Product with Serializable

    Permalink

    Denotes that the reactor was preempted by the scheduler.

    Denotes that the reactor was preempted by the scheduler.

    Always sent after ReactorStarted and before ReactorTerminated.

    When the reactor is preempted, it loses control of the execution thread, until the scheduler schedules it again on some (possibly the same) thread. This event is typically used to send another message back to the reactor, indicating that he should be scheduled again later.

  17. object ReactorScheduled extends SysEvent with Product with Serializable

    Permalink

    Denotes that the reactor was scheduled for execution by the scheduler.

    Denotes that the reactor was scheduled for execution by the scheduler.

    Always sent after ReactorStarted and before ReactorTerminated.

    This event usually occurs when reactor is woken up to process incoming events, but may be invoked even if there are no pending events. This event is typically used in conjunction with a scheduler that periodically wakes up the reactor.

  18. object ReactorStarted extends SysEvent with Product with Serializable

    Permalink

    Denotes start of a reactor.

    Denotes start of a reactor.

    Produced before any other event.

  19. object ReactorSystem

    Permalink

    Contains factory methods for creating reactor systems.

  20. object ReactorTerminated extends SysEvent with Product with Serializable

    Permalink

    Denotes the termination of a reactor.

    Denotes the termination of a reactor.

    Called after all other events.

  21. object Remote

    Permalink

    Types and methods related to the Remote service.

  22. object Scheduler

    Permalink

    Companion object for creating standard reactor schedulers.

  23. object Signal

    Permalink
  24. object Subscription

    Permalink

    Default subscription implementations.

  25. implicit def anySpec[T]: Spec[T]

    Permalink
  26. package concurrent

    Permalink
  27. package debugger

    Permalink
  28. implicit val doubleHash: Hash[Double]

    Permalink
  29. implicit val doubleSpec: Spec[Double]

    Permalink
  30. object exception

    Permalink
  31. val ignoreNonLethal: PartialFunction[Throwable, Unit]

    Permalink

    Partial function ignores non-lethal throwables.

    Partial function ignores non-lethal throwables.

    This is useful in composition with other exception handlers.

  32. implicit val intHash: Hash[Int]

    Permalink
  33. implicit val intSpec: Spec[Int]

    Permalink
  34. def isLethal(t: Throwable): Boolean

    Permalink

    Determines if the throwable is lethal, i.e.

    Determines if the throwable is lethal, i.e. should the program immediately stop.

  35. def isNonLethal(t: Throwable): Boolean

    Permalink

    Determines if the throwable is not lethal.

  36. package japi

    Permalink
  37. implicit val longHash: Hash[Long]

    Permalink
  38. implicit val longSpec: Spec[Long]

    Permalink
  39. package pickle

    Permalink
  40. implicit def refHash[T <: AnyRef]: Hash[T]

    Permalink
  41. package services

    Permalink
  42. package transport

    Permalink

Inherited from AnyRef

Inherited from Any

Ungrouped