public final class ChannelObservable
extends java.lang.Object
Observables and Channels.| Modifier and Type | Method and Description |
|---|---|
static <T> rx.Observable<T> |
from(co.paralleluniverse.strands.channels.ReceivePort<T> channel)
Converts an
Iterable sequence into an Observable that emits each message received on the channel. |
static <T> rx.Observable<T> |
from(co.paralleluniverse.strands.channels.ReceivePort<T> channel,
rx.Scheduler scheduler)
Converts an
Iterable sequence into an Observable that operates on the specified
scheduler, emitting each message received on the channel. |
static <T> T |
get(rx.Observable<T> o)
Takes an observable that generates at most one value, blocks until it completes and returns the result.
|
static <T> T |
get(rx.Observable<T> o,
long timeout,
java.util.concurrent.TimeUnit unit)
Takes an observable that generates at most one value, blocks until it completes or the timeout expires, and returns the result.
|
static <T> co.paralleluniverse.strands.channels.ReceivePort<T> |
subscribe(int bufferSize,
co.paralleluniverse.strands.channels.Channels.OverflowPolicy policy,
rx.Observable<? extends T> o)
Creates a
ReceivePort subscribed to an Observable. |
static <T> rx.Observer<T> |
to(co.paralleluniverse.strands.channels.SendPort<T> channel)
Converts a
SendPort channel into an Observer. |
public static <T> rx.Observable<T> from(co.paralleluniverse.strands.channels.ReceivePort<T> channel)
Iterable sequence into an Observable that emits each message received on the channel.
T - the type of messages on the channel and the type of items to be
emitted by the resulting Observablechannel - the source ReceivePortReceivePortpublic static <T> rx.Observable<T> from(co.paralleluniverse.strands.channels.ReceivePort<T> channel,
rx.Scheduler scheduler)
Iterable sequence into an Observable that operates on the specified
scheduler, emitting each message received on the channel.
T - the type of messages on the channel and the type of items to be
emitted by the resulting Observablechannel - the source ReceivePortscheduler - the scheduler on which the Observable is to emit the messages received on the channelReceivePort, on the
specified schedulerpublic static <T> rx.Observer<T> to(co.paralleluniverse.strands.channels.SendPort<T> channel)
SendPort channel into an Observer.
T - the type of messages that can be sent to the channel and the type of items to be
received by the Observerchannel - the target SendPortpublic static <T> co.paralleluniverse.strands.channels.ReceivePort<T> subscribe(int bufferSize,
co.paralleluniverse.strands.channels.Channels.OverflowPolicy policy,
rx.Observable<? extends T> o)
ReceivePort subscribed to an Observable.
T - the type of messages emitted by the observable and received on the channel.bufferSize - the channel's buffer sizepolicy - the channel's Channels.OverflowPolicyo - the observablepublic static <T> T get(rx.Observable<T> o)
throws java.util.concurrent.ExecutionException,
co.paralleluniverse.fibers.SuspendExecution,
java.lang.InterruptedException
null.
It the observable fails, this function throws an ExecutionException that wraps the observable's exception.o - the observablenull if the observable completes before a value is emitted.java.util.concurrent.ExecutionException - if the observable failsco.paralleluniverse.fibers.SuspendExecutionjava.lang.InterruptedExceptionpublic static <T> T get(rx.Observable<T> o,
long timeout,
java.util.concurrent.TimeUnit unit)
throws java.util.concurrent.ExecutionException,
co.paralleluniverse.fibers.SuspendExecution,
java.lang.InterruptedException,
java.util.concurrent.TimeoutException
null.
It the observable fails, this function throws an ExecutionException that wraps the observable's exception.o - the observabletimeout - the maximum time this method will blcokunit - the timeout's time unitnull if the observable completes before a value is emitted.java.util.concurrent.ExecutionException - if the observable failsjava.util.concurrent.TimeoutException - if the timeout expires before the observable completesco.paralleluniverse.fibers.SuspendExecutionjava.lang.InterruptedException