本文整理汇总了Java中rx.observers.Subscribers.wrap方法的典型用法代码示例。如果您正苦于以下问题:Java Subscribers.wrap方法的具体用法?Java Subscribers.wrap怎么用?Java Subscribers.wrap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rx.observers.Subscribers
的用法示例。
在下文中一共展示了Subscribers.wrap方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: call
import rx.observers.Subscribers; //导入方法依赖的package包/类
@Override
public Subscriber<? super T> call(Subscriber<? super T> child) {
// create the file based queue
final QueueWithSubscription<T> queue = createFileBasedQueue(dataSerializer, options);
// hold a reference to the queueProducer which will be set on
// subscription to `source`
final AtomicReference<QueueProducer<T>> queueProducer = new AtomicReference<QueueProducer<T>>();
// emissions will propagate to downstream via this worker
final Worker worker = scheduler.createWorker();
// set up the observable to read from the file based queue
Observable<T> source = Observable
.create(new OnSubscribeFromQueue<T>(queueProducer, queue, worker, options));
// create the parent subscriber
Subscriber<T> parentSubscriber = new ParentSubscriber<T>(queueProducer);
// link unsubscription
child.add(parentSubscriber);
// close and delete file based queues in RollingQueue on unsubscription
child.add(queue);
// ensure onStart not called twice
Subscriber<T> wrappedChild = Subscribers.wrap(child);
// ensure worker gets unsubscribed (last)
child.add(worker);
// subscribe to queue
source.unsafeSubscribe(wrappedChild);
return parentSubscriber;
}
示例2: call
import rx.observers.Subscribers; //导入方法依赖的package包/类
public Subscriber<? super T> call(Subscriber<? super T> child) {
this.subscribe.call();
return Subscribers.wrap(child);
}
示例3: call
import rx.observers.Subscribers; //导入方法依赖的package包/类
public Subscriber<? super T> call(Subscriber<? super T> child) {
child.add(Subscriptions.create(this.unsubscribe));
return Subscribers.wrap(child);
}
示例4: call
import rx.observers.Subscribers; //导入方法依赖的package包/类
@Override
public Subscriber<? super T> call(Subscriber<? super T> child) {
Subscriber<T> parent = Subscribers.wrap(child);
child.add(Subscriptions.create(action));
return parent;
}