本文整理汇总了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);
}
};
}
示例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);
}
};
}
示例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);
}
};
}