本文整理汇总了Java中rx.observers.SerializedSubscriber类的典型用法代码示例。如果您正苦于以下问题:Java SerializedSubscriber类的具体用法?Java SerializedSubscriber怎么用?Java SerializedSubscriber使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SerializedSubscriber类属于rx.observers包,在下文中一共展示了SerializedSubscriber类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: call
import rx.observers.SerializedSubscriber; //导入依赖的package包/类
public Subscriber<? super T> call(Subscriber<? super List<T>> child) {
final BufferingSubscriber bsub = new BufferingSubscriber(new SerializedSubscriber(child));
Subscriber<TOpening> openSubscriber = new Subscriber<TOpening>() {
public void onNext(TOpening t) {
bsub.startBuffer(t);
}
public void onError(Throwable e) {
bsub.onError(e);
}
public void onCompleted() {
bsub.onCompleted();
}
};
child.add(openSubscriber);
child.add(bsub);
this.bufferOpening.unsafeSubscribe(openSubscriber);
return bsub;
}
示例2: call
import rx.observers.SerializedSubscriber; //导入依赖的package包/类
public Subscriber<? super T> call(Subscriber<? super List<T>> child) {
Worker inner = this.scheduler.createWorker();
SerializedSubscriber<List<T>> serialized = new SerializedSubscriber(child);
if (this.timespan == this.timeshift) {
ExactSubscriber bsub = new ExactSubscriber(serialized, inner);
bsub.add(inner);
child.add(bsub);
bsub.scheduleExact();
return bsub;
}
Subscriber bsub2 = new InexactSubscriber(serialized, inner);
bsub2.add(inner);
child.add(bsub2);
bsub2.startNewChunk();
bsub2.scheduleChunk();
return bsub2;
}
示例3: call
import rx.observers.SerializedSubscriber; //导入依赖的package包/类
public Subscriber<? super T> call(Subscriber<? super List<T>> child) {
try {
Observable<? extends TClosing> closing = (Observable) this.bufferClosingSelector.call();
final BufferingSubscriber bsub = new BufferingSubscriber(new SerializedSubscriber(child));
Subscriber<TClosing> closingSubscriber = new Subscriber<TClosing>() {
public void onNext(TClosing tClosing) {
bsub.emit();
}
public void onError(Throwable e) {
bsub.onError(e);
}
public void onCompleted() {
bsub.onCompleted();
}
};
child.add(closingSubscriber);
child.add(bsub);
closing.unsafeSubscribe(closingSubscriber);
return bsub;
} catch (Throwable t) {
Exceptions.throwOrReport(t, child);
return Subscribers.empty();
}
}
示例4: call
import rx.observers.SerializedSubscriber; //导入依赖的package包/类
@Override
public Subscriber<? super T> call(final Subscriber<? super T> s) {
return new SerializedSubscriber<T>(new Subscriber<T>(s) {
@Override
public void onCompleted() {
s.onCompleted();
}
@Override
public void onError(Throwable e) {
s.onError(e);
}
@Override
public void onNext(T t) {
s.onNext(t);
}
});
}
示例5: ExactSubscriber
import rx.observers.SerializedSubscriber; //导入依赖的package包/类
public ExactSubscriber(Subscriber<? super Observable<T>> child, Worker worker) {
this.child = new SerializedSubscriber(child);
this.worker = worker;
child.add(Subscriptions.create(new Action0(OperatorWindowWithTime.this) {
public void call() {
if (ExactSubscriber.this.state.consumer == null) {
ExactSubscriber.this.unsubscribe();
}
}
}));
}
示例6: call
import rx.observers.SerializedSubscriber; //导入依赖的package包/类
public Subscriber<? super T> call(final Subscriber<? super T> s) {
return new SerializedSubscriber(new Subscriber<T>(s) {
public void onCompleted() {
s.onCompleted();
}
public void onError(Throwable e) {
s.onError(e);
}
public void onNext(T t) {
s.onNext(t);
}
});
}
示例7: call
import rx.observers.SerializedSubscriber; //导入依赖的package包/类
public Subscriber<? super T> call(Subscriber<? super T> child) {
SerializedSubscriber<T> s = new SerializedSubscriber(child);
Worker worker = this.scheduler.createWorker();
child.add(worker);
SamplerSubscriber<T> sampler = new SamplerSubscriber(s);
child.add(sampler);
worker.schedulePeriodically(sampler, this.time, this.time, this.unit);
return sampler;
}
示例8: TimeoutSubscriber
import rx.observers.SerializedSubscriber; //导入依赖的package包/类
private TimeoutSubscriber(SerializedSubscriber<T> serializedSubscriber, TimeoutStub<T> timeoutStub, SerialSubscription serial, Observable<? extends T> other, Worker inner) {
super(serializedSubscriber);
this.gate = new Object();
this.terminated = new AtomicInteger();
this.actual = new AtomicLong();
this.serializedSubscriber = serializedSubscriber;
this.timeoutStub = timeoutStub;
this.serial = serial;
this.other = other;
this.inner = inner;
}
示例9: call
import rx.observers.SerializedSubscriber; //导入依赖的package包/类
public Subscriber<? super T> call(Subscriber<? super T> subscriber) {
Worker inner = this.scheduler.createWorker();
subscriber.add(inner);
SerialSubscription serial = new SerialSubscription();
subscriber.add(serial);
TimeoutSubscriber<T> timeoutSubscriber = new TimeoutSubscriber(new SerializedSubscriber(subscriber), this.timeoutStub, serial, this.other, inner);
serial.set((Subscription) this.firstTimeoutStub.call(timeoutSubscriber, Long.valueOf(0), inner));
return timeoutSubscriber;
}
示例10: call
import rx.observers.SerializedSubscriber; //导入依赖的package包/类
public Subscriber<? super T> call(Subscriber<? super T> child) {
Worker worker = this.scheduler.createWorker();
child.add(worker);
TakeSubscriber<T> ts = new TakeSubscriber(new SerializedSubscriber(child));
worker.schedule(ts, this.time, this.unit);
return ts;
}
示例11: SwitchSubscriber
import rx.observers.SerializedSubscriber; //导入依赖的package包/类
SwitchSubscriber(Subscriber<? super T> child) {
this.serializedChild = new SerializedSubscriber(child);
this.arbiter = new ProducerArbiter();
this.ssub = new SerialSubscription();
child.add(this.ssub);
child.setProducer(new Producer() {
public void request(long n) {
if (n > 0) {
SwitchSubscriber.this.arbiter.request(n);
}
}
});
}
示例12: call
import rx.observers.SerializedSubscriber; //导入依赖的package包/类
public Subscriber<? super Observable<? extends T>> call(Subscriber<? super T> child) {
SerializedSubscriber<T> s = new SerializedSubscriber(child);
SerialSubscription current = new SerialSubscription();
child.add(current);
ConcatSubscriber<T> cs = new ConcatSubscriber(s, current);
child.setProducer(new ConcatProducer(cs));
return cs;
}
示例13: 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);
}
};
}
示例14: call
import rx.observers.SerializedSubscriber; //导入依赖的package包/类
@Override
public Subscriber<? super JsonPathEvent> call(Subscriber<? super JsonObjectEvent> s) {
Subscriber<? super JsonObjectEvent> downstream = new SerializedSubscriber<>(s);
PathEventSubscriber upstream = new PathEventSubscriber();
downstream.add(upstream);
downstream.setProducer(new JsonObjectProducer(upstream, downstream));
return upstream;
}
示例15: call
import rx.observers.SerializedSubscriber; //导入依赖的package包/类
@Override
public Subscriber<? super Character> call(Subscriber<? super JsonTokenEvent> s) {
Subscriber<? super JsonTokenEvent> downstream = new SerializedSubscriber<>(s);
JsonParser upstream = new JsonParser(lenient);
downstream.add(upstream);
downstream.setProducer(new ParserProducer(upstream, downstream));
return upstream;
}