Package

molecule

channel

Permalink

package channel

This package contains standard channels to interact with standard input/output and connect Molecule processes. These channels implement the interfaces defined in the package syschan.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. channel
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Type Members

  1. case class ChannelOverflowSignal(id: String, capacity: Int) extends Signal with Product with Serializable

    Permalink

    Signal sent when the capacity of an asynchronous channel is exceeded and all other fallback mechanisms have been exhausted.

  2. final class ConcurrentReadException extends Error

    Permalink
  3. final class ConcurrentWriteException extends Error

    Permalink

    Standard exceptions that might be thrown by system-level channels.

  4. trait GetChan[+A] extends AnyRef

    Permalink

    Trait for blocking system-level input channels with blocking and message-at-a-time semantics.

    Trait for blocking system-level input channels with blocking and message-at-a-time semantics.

    This interface assumes that get_! and poison methods are invoked sequentially.

    This trait is useful to wrap legacy blocking input interfaces and can easily be wrapped in a non-blocking IChan using the wrap method in the companion object (see the implementation of molecule.channel.Console for examples).

    Note that the pattern captured by this trait is safer than the observer pattern in multi-threaded settings because objects inheriting this class can maintain state in an immutable manner by returning their next state together with the next message.

    A

    The type of messages.

  5. trait IChan[+A] extends AnyRef

    Permalink

    Trait for non-blocking system-level input channels.

    Trait for non-blocking system-level input channels.

    A

    The type of messages.

  6. trait NativeConsumer[+A] extends AnyRef

    Permalink

    A NativeConsumer interface permits to consume messages in a blocking manner from a native thread.

    A NativeConsumer interface permits to consume messages in a blocking manner from a native thread. This interface is typically used to wrap a system-level input channel interface into an interface that can be manipulated easily from a native Java thread.

    A

    the type of the messages transported by this channel.

  7. abstract class NativeProducer[-A] extends AnyRef

    Permalink

    A NativeProducer interfaces permits to produce messages in a blocking manner from a native thread.

    A NativeProducer interfaces permits to produce messages in a blocking manner from a native thread. This interface is typically used to wrap a cooperative system-level output channel interface into an interface that can be manipulated easily from a native Java thread.

    It is also common to wrap a Buffer channel of a sufficient large size inside this interface to produce messages asynchronously and in a non-blocking manner from a cooperative process. This works as long as the maximum number buffer size required in order to not block is guaranteed by the application protocol (i.e. request-ack).

    A

    the type of the messages carried by this channel.

    See also

    ConsumerInterface to receive messages from an external thread.

  8. trait OChan[-A] extends AnyRef

    Permalink

    Trait for non-blocking system-level output channels.

    Trait for non-blocking system-level output channels.

    A

    The type of messages.

  9. class OChanFactory[-A] extends () ⇒ OChan[A]

    Permalink

    A factory for output channels.

  10. trait Predefs extends AnyRef

    Permalink
  11. trait PutChan[-A] extends AnyRef

    Permalink

    Trait for blocking system-level output channels.

    Trait for blocking system-level output channels.

    This interface assumes that put_! and close methods are invoked sequentially.

    This trait is useful to wrap legacy blocking output interfaces and can easily be wrapped in a non-blocking OChan using the wrap method in the companion object (see the implementation of molecule.channel.Console for examples).

    A

    The type of messages.

  12. abstract class RIChan[+A] extends IChan[A]

    Permalink

    "Result", "reply" or "response" input channel interface.

    "Result", "reply" or "response" input channel interface.

    Result channels are system-level input channels that deliver only a single message followed by the EOS. They obey channel semantics in that they cannot be read concurrently and they deliver messages only once - a result channel that is read a second time will deliver the EOS signal.

    The computations associated to a result channel, and hence transformations like map or flatMap, are only fired lazyliy when a process attempts to read the result from the channel. Transformations featuring side-effects can be executed even if no one is interested in the result by calling the fire() method. This method returns a new result channel that consumes the result after the transformations have been applied and then stores it internally in an intermediate buffer such that it can still be consumed later.

    In all situations, the continuations or the transformation functions applied to a result channel are carried by default inside the thread that produces the result. To improve reactiveness and/or isolate concurrent computations from each other, it is prefereable to free as soon as possible the thread that produces results and offload the computation of transformations to the thread that consumes the result. The dispatchTo method, if it is called immediately after a future is created, will dipatch any subsequent continuation or transformation to the standard juc.Executor that it is passed as parameter. For example, this could be either a molecule.platform.Platform or a molecule.platform.UThread, which both inherit from the Executor interface. In the first case, continuations will be carried inside a new user-level thread created by the target platform. In the second case, the continuations will be pinned down to an existing user-level thread.

    Note that in case a message is pure, the result of a result channel can be cached for multiple (sequential) reads using the cache() method. Alternatively, for interoperability with Java, a result can also be wrapped inside a standard juc.Future by invoking the future() method on result channels (this method is provided via an implicit conversion to RIChanWithFuture in the companion object).

    A

    the type of the message returned by the channel

  13. abstract class ROChan[-A] extends AnyRef

    Permalink

    "Result", "reply" or "response" output channel interface.

    "Result", "reply" or "response" output channel interface.

    As opposed to a generic OChan, this channel interface can output only a single message, which is either success or failure.

    A

    the type of the message returned by the channel

Value Members

  1. object Buffer

    Permalink

    Factory for cooperative buffered channels.

    Factory for cooperative buffered channels.

    A user-level thread writing to this channel will become suspended if the size of the segment it writes to the channel plus the sum of the sizes of the segments already buffered by the channel exceed the size specified at creation time. In case the reader is slower than the producer, multiple segments buffered by the channel will be aggregated together into a single segment, which will be delivered the next time a user-level thread reads on the channel.

  2. object Chan

    Permalink

    Factory for in-memory cooperative (aka rendez-vous) channels

  3. object Clock

    Permalink
  4. object Console

    Permalink
  5. object GetChan

    Permalink
  6. object IChan

    Permalink
  7. object ManyToOne

    Permalink

    Factory for multiple-producers, single-consumer cooperative channels

    Factory for multiple-producers, single-consumer cooperative channels

    This channel is cooperative and bounded. After it has written a segment, a (producer) user-level thread becomes suspended when it writes its next segment until the previous segment has been entirely delivered to the (consumer) user-level reading on the input interface of this channel.

    This channel can only be poisoned from the input side. In other words, any attempt to close an output channel interface associated to a many-to-one channel will be ignored.

  8. object NativeConsumer

    Permalink
  9. object NativeProducer

    Permalink
  10. object OChan

    Permalink
  11. object OChanFactory

    Permalink

    Factory object for output channel factories.

  12. object PutChan

    Permalink
  13. object RChan

    Permalink

    Companion factory object for RChan

  14. object RIChan

    Permalink

    Factory methods for RIChan and extra DSL support like callcc and parl (see ChameneosRedux example in molecule-core-examples).

  15. object ROChan

    Permalink

    Companion object for ROChan

  16. object Timer

    Permalink

    A timer channel schedules time events on its output using the platform's internal timers facilities.

    A timer channel schedules time events on its output using the platform's internal timers facilities. Each time event generated contains the number of ticks generated since the channel was created (2038 bug ready).

Inherited from AnyRef

Inherited from Any

Ungrouped