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


Java SerializedSubscriber.add方法代码示例

本文整理汇总了Java中rx.observers.SerializedSubscriber.add方法的典型用法代码示例。如果您正苦于以下问题:Java SerializedSubscriber.add方法的具体用法?Java SerializedSubscriber.add怎么用?Java SerializedSubscriber.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rx.observers.SerializedSubscriber的用法示例。


在下文中一共展示了SerializedSubscriber.add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: call

import rx.observers.SerializedSubscriber; //导入方法依赖的package包/类
public Subscriber<? super T> call(Subscriber<? super T> child) {
    final Worker worker = this.scheduler.createWorker();
    final SerializedSubscriber<T> s = new SerializedSubscriber(child);
    final SerialSubscription ssub = new SerialSubscription();
    s.add(worker);
    s.add(ssub);
    return new Subscriber<T>(child) {
        final Subscriber<?> self = this;
        final DebounceState<T> state = new DebounceState();

        public void onStart() {
            request(Long.MAX_VALUE);
        }

        public void onNext(T t) {
            final int index = this.state.next(t);
            ssub.set(worker.schedule(new Action0() {
                public void call() {
                    AnonymousClass1.this.state.emit(index, s, AnonymousClass1.this.self);
                }
            }, OperatorDebounceWithTime.this.timeout, OperatorDebounceWithTime.this.unit));
        }

        public void onError(Throwable e) {
            s.onError(e);
            unsubscribe();
            this.state.clear();
        }

        public void onCompleted() {
            this.state.emitAndComplete(s, this);
        }
    };
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:35,代码来源:OperatorDebounceWithTime.java

示例2: call

import rx.observers.SerializedSubscriber; //导入方法依赖的package包/类
@Override
public Subscriber<? super T> call(final Subscriber<? super T> child) {
    final Worker worker = scheduler.createWorker();
    final SerializedSubscriber<T> s = new SerializedSubscriber<T>(child);
    final SerialSubscription ssub = new SerialSubscription();
    
    s.add(worker);
    s.add(ssub);
    
    return new Subscriber<T>(child) {
        final DebounceState<T> state = new DebounceState<T>();
        final Subscriber<?> self = this;
        @Override
        public void onNext(final T t) {
            
            final int index = state.next(t);
            ssub.set(worker.schedule(new Action0() {
                @Override
                public void call() {
                    state.emit(index, s, self);
                }
            }, timeout, unit));
        }
        
        @Override
        public void onError(Throwable e) {
            s.onError(e);
            unsubscribe();
            state.clear();
        }
        
        @Override
        public void onComplete() {
            state.emitAndComplete(s, this);
        }
    };
}
 
开发者ID:akarnokd,项目名称:RxJavaFlow,代码行数:38,代码来源:OperatorDebounceWithTime.java

示例3: call

import rx.observers.SerializedSubscriber; //导入方法依赖的package包/类
@Override
public Subscriber<? super T> call(final Subscriber<? super T> child) {
    final Worker worker = scheduler.createWorker();
    final SerializedSubscriber<T> s = new SerializedSubscriber<T>(child);
    final SerialSubscription ssub = new SerialSubscription();
    
    s.add(worker);
    s.add(ssub);
    
    return new Subscriber<T>(child) {
        final DebounceState<T> state = new DebounceState<T>();
        final Subscriber<?> self = this;
        @Override
        public void onNext(final T t) {
            
            final int index = state.next(t);
            ssub.set(worker.schedule(new Action0() {
                @Override
                public void call() {
                    state.emit(index, s, self);
                }
            }, timeout, unit));
        }
        
        @Override
        public void onError(Throwable e) {
            s.onError(e);
            unsubscribe();
            state.clear();
        }
        
        @Override
        public void onCompleted() {
            state.emitAndComplete(s, this);
        }
    };
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:38,代码来源:OperatorDebounceWithTime.java


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