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


Java SerialSubscription类代码示例

本文整理汇总了Java中rx.subscriptions.SerialSubscription的典型用法代码示例。如果您正苦于以下问题:Java SerialSubscription类的具体用法?Java SerialSubscription怎么用?Java SerialSubscription使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: execute

import rx.subscriptions.SerialSubscription; //导入依赖的package包/类
/**
 * Executes the interceptor chain for the passed request and response.
 *
 * @param request Request to be executed.
 * @param response Response to be populated.
 * @param keyEvaluationContext The context for {@link InterceptorKey} evaluation.
 *
 * @return The final result of execution after executing all the inbound and outbound interceptors and the router.
 */
public Observable<Void> execute(final I request, final O response, C keyEvaluationContext) {
    final ExecutionContext context = new ExecutionContext(request, keyEvaluationContext);
    InboundInterceptor<I, O> nextIn = context.nextIn(request);
    Observable<Void> startingPoint;

    if (null != nextIn) {
        startingPoint = nextIn.in(request, response);
    } else if (context.invokeRouter()){
        startingPoint = router.handle(request, response);
    } else {
        return Observable.error(new IllegalStateException("No router defined.")); // No router defined.
    }

    return startingPoint.lift(new Observable.Operator<Void, Void>() {
        @Override
        public Subscriber<? super Void> call(Subscriber<? super Void> child) {
            SerialSubscription subscription = new SerialSubscription();
            ChainSubscriber chainSubscriber = new ChainSubscriber(subscription, context, request, response, child);
            subscription.set(chainSubscriber);
            child.add(subscription);
            return chainSubscriber;
        }
    });
}
 
开发者ID:Netflix,项目名称:karyon,代码行数:34,代码来源:InterceptorExecutor.java

示例2: SourceSubscriber

import rx.subscriptions.SerialSubscription; //导入依赖的package包/类
public SourceSubscriber(Subscriber<? super T> child, Func2<Integer, Throwable, Boolean> predicate, Worker inner, SerialSubscription serialSubscription, ProducerArbiter pa) {
    this.child = child;
    this.predicate = predicate;
    this.inner = inner;
    this.serialSubscription = serialSubscription;
    this.pa = pa;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:8,代码来源:OperatorRetryWithPredicate.java

示例3: call

import rx.subscriptions.SerialSubscription; //导入依赖的package包/类
public Subscriber<? super Observable<T>> call(Subscriber<? super T> child) {
    Worker inner = Schedulers.trampoline().createWorker();
    child.add(inner);
    SerialSubscription serialSubscription = new SerialSubscription();
    child.add(serialSubscription);
    ProducerArbiter pa = new ProducerArbiter();
    child.setProducer(pa);
    return new SourceSubscriber(child, this.predicate, inner, serialSubscription, pa);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:10,代码来源:OperatorRetryWithPredicate.java

示例4: onNext

import rx.subscriptions.SerialSubscription; //导入依赖的package包/类
public void onNext(TRight args) {
    synchronized (ResultSink.this.guard) {
        ResultSink resultSink = ResultSink.this;
        int id = resultSink.rightId;
        resultSink.rightId = id + 1;
        ResultSink.this.rightMap.put(Integer.valueOf(id), args);
        int highLeftId = ResultSink.this.leftId;
    }
    ResultSink.this.group.add(new SerialSubscription());
    try {
        Observable<TRightDuration> duration = (Observable) OnSubscribeJoin.this.rightDurationSelector.call(args);
        Subscriber<TRightDuration> d2 = new RightDurationSubscriber(id);
        ResultSink.this.group.add(d2);
        duration.unsafeSubscribe(d2);
        List<TLeft> leftValues = new ArrayList();
        synchronized (ResultSink.this.guard) {
            for (Entry<Integer, TLeft> entry : ResultSink.this.leftMap.entrySet()) {
                if (((Integer) entry.getKey()).intValue() < highLeftId) {
                    leftValues.add(entry.getValue());
                }
            }
        }
        for (TLeft lv : leftValues) {
            ResultSink.this.subscriber.onNext(OnSubscribeJoin.this.resultSelector.call(lv, args));
        }
    } catch (Throwable t) {
        Exceptions.throwOrReport(t, this);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:30,代码来源:OnSubscribeJoin.java

示例5: TimeoutSubscriber

import rx.subscriptions.SerialSubscription; //导入依赖的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;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:12,代码来源:OperatorTimeoutBase.java

示例6: call

import rx.subscriptions.SerialSubscription; //导入依赖的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;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:10,代码来源:OperatorTimeoutBase.java

示例7: SwitchSubscriber

import rx.subscriptions.SerialSubscription; //导入依赖的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);
            }
        }
    });
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:14,代码来源:OperatorSwitch.java

示例8: call

import rx.subscriptions.SerialSubscription; //导入依赖的package包/类
public Subscriber<? super T> call(Subscriber<? super T> child) {
    SerialSubscription ssub = new SerialSubscription();
    ProducerArbiter arbiter = new ProducerArbiter();
    ParentSubscriber<T> parent = new ParentSubscriber(child, ssub, arbiter, this.alternate);
    ssub.set(parent);
    child.add(ssub);
    child.setProducer(arbiter);
    return parent;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:10,代码来源:OperatorSwitchIfEmpty.java

示例9: ConcatSubscriber

import rx.subscriptions.SerialSubscription; //导入依赖的package包/类
public ConcatSubscriber(Subscriber<T> s, SerialSubscription current) {
    super(s);
    this.child = s;
    this.current = current;
    this.arbiter = new ProducerArbiter();
    this.queue = new ConcurrentLinkedQueue();
    add(Subscriptions.create(new Action0() {
        public void call() {
            ConcatSubscriber.this.queue.clear();
        }
    }));
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:13,代码来源:OperatorConcat.java

示例10: call

import rx.subscriptions.SerialSubscription; //导入依赖的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;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:9,代码来源:OperatorConcat.java

示例11: call

import rx.subscriptions.SerialSubscription; //导入依赖的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

示例12: CompletableConcatSubscriber

import rx.subscriptions.SerialSubscription; //导入依赖的package包/类
public CompletableConcatSubscriber(CompletableSubscriber actual, int prefetch) {
    this.actual = actual;
    this.prefetch = prefetch;
    this.queue = new SpscArrayQueue<Completable>(prefetch);
    this.sr = new SerialSubscription();
    this.inner = new ConcatInnerSubscriber();
    this.wip = new AtomicInteger();
    add(sr);
    request(prefetch);
}
 
开发者ID:cowthan,项目名称:JavaAyo,代码行数:11,代码来源:CompletableOnSubscribeConcat.java

示例13: call

import rx.subscriptions.SerialSubscription; //导入依赖的package包/类
@Override
public Subscriber<? super Observable<T>> call(final Subscriber<? super T> child) {
    final Scheduler.Worker inner = Schedulers.trampoline().createWorker();
    child.add(inner);
    
    final SerialSubscription serialSubscription = new SerialSubscription();
    // add serialSubscription so it gets unsubscribed if child is unsubscribed
    child.add(serialSubscription);
    
    return new SourceSubscriber<T>(child, predicate, inner, serialSubscription);
}
 
开发者ID:akarnokd,项目名称:RxJavaFlow,代码行数:12,代码来源:OperatorRetryWithPredicate.java

示例14: SourceSubscriber

import rx.subscriptions.SerialSubscription; //导入依赖的package包/类
public SourceSubscriber(Subscriber<? super T> child, final BiFunction<Integer, Throwable, Boolean> predicate, Scheduler.Worker inner, 
        SerialSubscription serialSubscription) {
    this.child = child;
    this.predicate = predicate;
    this.inner = inner;
    this.serialSubscription = serialSubscription;
}
 
开发者ID:akarnokd,项目名称:RxJavaFlow,代码行数:8,代码来源:OperatorRetryWithPredicate.java

示例15: onNext

import rx.subscriptions.SerialSubscription; //导入依赖的package包/类
@Override
public void onNext(TRight args) {
    int id; 
    int highLeftId;
    synchronized (guard) {
        id = rightId++;
        rightMap.put(id, args);
        highLeftId = leftId;
    }
    SerialSubscription md = new SerialSubscription();
    group.add(md);

    Observable<TRightDuration> duration;
    try {
        duration = rightDurationSelector.call(args);

        Subscriber<TRightDuration> d2 = new RightDurationSubscriber(id);
        group.add(d2);
        
        duration.unsafeSubscribe(d2);
        

        List<TLeft> leftValues = new ArrayList<TLeft>();
        synchronized (guard) {
            for (Map.Entry<Integer, TLeft> entry : leftMap.entrySet()) {
                if (entry.getKey() < highLeftId) {
                    leftValues.add(entry.getValue());
                }
            }
        }
        
        for (TLeft lv : leftValues) {
            R result = resultSelector.call(lv, args);
            subscriber.onNext(result);
        }
        
    } catch (Throwable t) {
        onError(t);
    }
}
 
开发者ID:akarnokd,项目名称:RxJavaFlow,代码行数:41,代码来源:OnSubscribeJoin.java


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