Signal sent when the capacity of an asynchronous channel is exceeded and all other fallback mechanisms have been exhausted.
Standard exceptions that might be thrown by system-level channels.
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.
The type of messages.
Trait for non-blocking system-level input channels.
Trait for non-blocking system-level input channels.
The type of messages.
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.
the type of the messages transported by this channel.
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).
the type of the messages carried by this channel.
ConsumerInterface to receive messages from an external thread.
Trait for non-blocking system-level output channels.
Trait for non-blocking system-level output channels.
The type of messages.
A factory for output channels.
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).
The type of messages.
"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).
the type of the message returned by the channel
"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.
the type of the message returned by the channel
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.
Factory for in-memory cooperative (aka rendez-vous) channels
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.
Factory object for output channel factories.
Companion factory object for RChan
Factory methods for RIChan and extra DSL support like callcc
and parl
(see ChameneosRedux
example in molecule-core-examples
).
Companion object for ROChan
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).
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.