当前位置: 首页>>代码示例>>Java>>正文


Java Subscribers.wrap方法代码示例

本文整理汇总了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;
}
 
开发者ID:davidmoten,项目名称:rxjava-extras,代码行数:38,代码来源:OperatorBufferToFile.java

示例2: call

import rx.observers.Subscribers; //导入方法依赖的package包/类
public Subscriber<? super T> call(Subscriber<? super T> child) {
    this.subscribe.call();
    return Subscribers.wrap(child);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:5,代码来源:OperatorDoOnSubscribe.java

示例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);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:5,代码来源:OperatorDoOnUnsubscribe.java

示例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;
}
 
开发者ID:davidmoten,项目名称:rxjava-extras,代码行数:7,代码来源:TransformerDelayFinalUnsubscribe.java


注:本文中的rx.observers.Subscribers.wrap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。