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


Java MissingBackpressureException类代码示例

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


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

示例1: queueScalar

import rx.exceptions.MissingBackpressureException; //导入依赖的package包/类
protected void queueScalar(InnerSubscriber<T> subscriber, T value) {
    RxRingBuffer q = subscriber.queue;
    if (q == null) {
        q = RxRingBuffer.getSpscInstance();
        subscriber.add(q);
        subscriber.queue = q;
    }
    try {
        q.onNext(this.nl.next(value));
        emit();
    } catch (MissingBackpressureException ex) {
        subscriber.unsubscribe();
        subscriber.onError(ex);
    } catch (IllegalStateException ex2) {
        if (!subscriber.isUnsubscribed()) {
            subscriber.unsubscribe();
            subscriber.onError(ex2);
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:21,代码来源:OperatorMerge.java

示例2: assertCapacity

import rx.exceptions.MissingBackpressureException; //导入依赖的package包/类
private boolean assertCapacity() {
    if (this.capacity == null) {
        return true;
    }
    long currCapacity;
    do {
        currCapacity = this.capacity.get();
        if (currCapacity <= 0) {
            if (this.saturated.compareAndSet(false, true)) {
                unsubscribe();
                this.child.onError(new MissingBackpressureException("Overflowed buffer of " + this.baseCapacity));
                if (this.onOverflow != null) {
                    this.onOverflow.call();
                }
            }
            return false;
        }
    } while (!this.capacity.compareAndSet(currCapacity, currCapacity - 1));
    return true;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:21,代码来源:OperatorOnBackpressureBuffer.java

示例3: onNext

import rx.exceptions.MissingBackpressureException; //导入依赖的package包/类
public boolean onNext(int index, T t) {
    synchronized (this) {
        if (!this.haveValues.get(index)) {
            this.haveValues.set(index);
            this.haveValuesCount++;
        }
        this.collectedValues[index] = t;
        if (this.haveValuesCount != this.collectedValues.length) {
            return false;
        }
        try {
            this.buffer.onNext(this.combinator.call(this.collectedValues));
        } catch (MissingBackpressureException e) {
            onError(e);
        } catch (Throwable e2) {
            Exceptions.throwOrReport(e2, this.child);
        }
        tick();
        return true;
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:22,代码来源:OnSubscribeCombineLatest.java

示例4: onNext

import rx.exceptions.MissingBackpressureException; //导入依赖的package包/类
public void onNext(Object o) throws MissingBackpressureException {
    boolean iae = false;
    boolean mbe = false;
    synchronized (this) {
        Queue<Object> q = this.queue;
        if (q != null) {
            mbe = !q.offer(on.next(o));
        } else {
            iae = true;
        }
    }
    if (iae) {
        throw new IllegalStateException("This instance has been unsubscribed and the queue is no longer usable.");
    } else if (mbe) {
        throw new MissingBackpressureException();
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:18,代码来源:RxRingBuffer.java

示例5: assertCapacity

import rx.exceptions.MissingBackpressureException; //导入依赖的package包/类
private boolean assertCapacity() {
    if (capacity == null) {
        return true;
    }

    long currCapacity;
    do {
        currCapacity = capacity.get();
        if (currCapacity <= 0) {
            if (saturated.compareAndSet(false, true)) {
                unsubscribe();
                child.onError(new MissingBackpressureException(
                        "Overflowed buffer of "
                                + baseCapacity));
                if (onOverflow != null) {
                    onOverflow.call();
                }
            }
            return false;
        }
        // ensure no other thread stole our slot, or retry
    } while (!capacity.compareAndSet(currCapacity, currCapacity - 1));
    return true;
}
 
开发者ID:akarnokd,项目名称:RxJavaFlow,代码行数:25,代码来源:OperatorOnBackpressureBuffer.java

示例6: testHotOperatorBackpressure

import rx.exceptions.MissingBackpressureException; //导入依赖的package包/类
/**
 * Make sure we get a MissingBackpressureException propagated through when we have a fast temporal (hot) producer.
 */
@Test
public void testHotOperatorBackpressure() {
    TestSubscriber<String> ts = new TestSubscriber<String>();
    Observable.timer(0, 1, TimeUnit.MICROSECONDS)
            .observeOn(Schedulers.computation())
            .map(new Function<Long, String>() {

                @Override
                public String call(Long t1) {
                    System.out.println(t1);
                    try {
                        Thread.sleep(100);
                    } catch (InterruptedException e) {
                    }
                    return t1 + " slow value";
                }

            }).subscribe(ts);

    ts.awaitTerminalEvent();
    System.out.println("Errors: " + ts.getOnErrorEvents());
    assertEquals(1, ts.getOnErrorEvents().size());
    assertEquals(MissingBackpressureException.class, ts.getOnErrorEvents().get(0).getClass());
}
 
开发者ID:akarnokd,项目名称:RxJavaFlow,代码行数:28,代码来源:OperatorObserveOnTest.java

示例7: missingBackpressureException

import rx.exceptions.MissingBackpressureException; //导入依赖的package包/类
@Test
public void missingBackpressureException() throws MissingBackpressureException {
    RxRingBuffer b = createRingBuffer();
    TestSubscriber<Object> s = new TestSubscriber<Object>();
    s.requestMore(Flow.defaultBufferSize());
    for (int i = 0; i < Flow.defaultBufferSize(); i++) {
        b.onNext("one");
    }
    try {
        b.onNext("o");
        fail("expected failure adding beyond size");
    } catch (Exception e) {
        // expecting failure
        assertTrue(e instanceof MissingBackpressureException);
    }
}
 
开发者ID:akarnokd,项目名称:RxJavaFlow,代码行数:17,代码来源:RxRingBufferBase.java

示例8: roomForError

import rx.exceptions.MissingBackpressureException; //导入依赖的package包/类
@Test
public void roomForError() throws MissingBackpressureException {
    RxRingBuffer b = createRingBuffer();
    TestSubscriber<Object> s = new TestSubscriber<Object>();
    s.requestMore(Flow.defaultBufferSize());
    for (int i = 0; i < Flow.defaultBufferSize(); i++) {
        b.onNext("one");
    }
    // should act full now
    try {
        b.onNext("should-fail");
        fail("expected error");
    } catch (Exception e) {
        // we want this
        b.onError(new MissingBackpressureException());
    }
}
 
开发者ID:akarnokd,项目名称:RxJavaFlow,代码行数:18,代码来源:RxRingBufferBase.java

示例9: multipleTerminalEventsOnComplete

import rx.exceptions.MissingBackpressureException; //导入依赖的package包/类
@Test
public void multipleTerminalEventsOnComplete() throws MissingBackpressureException {
    RxRingBuffer b = createRingBuffer();
    TestSubscriber<Object> s = new TestSubscriber<Object>();
    s.requestMore(Flow.defaultBufferSize());
    for (int i = 0; i < Flow.defaultBufferSize(); i++) {
        b.onNext("one");
    }
    // queue is now full
    b.onError(new RuntimeException("an error"));
    try {
        b.onComplete();
        // we ignore duplicate terminal events
    } catch (IllegalStateException e) {
        fail("we will ignore duplicate terminal events");
    }
}
 
开发者ID:akarnokd,项目名称:RxJavaFlow,代码行数:18,代码来源:RxRingBufferBase.java

示例10: multipleTerminalEventsOnError

import rx.exceptions.MissingBackpressureException; //导入依赖的package包/类
@Test
public void multipleTerminalEventsOnError() throws MissingBackpressureException {
    RxRingBuffer b = createRingBuffer();
    TestSubscriber<Object> s = new TestSubscriber<Object>();
    s.requestMore(Flow.defaultBufferSize());
    for (int i = 0; i < Flow.defaultBufferSize(); i++) {
        b.onNext("one");
    }
    // queue is now full
    b.onComplete();
    try {
        b.onError(new RuntimeException("an error"));
        // we ignore duplicate terminal events
    } catch (IllegalStateException e) {
        fail("we will ignore duplicate terminal events");
    }
}
 
开发者ID:akarnokd,项目名称:RxJavaFlow,代码行数:18,代码来源:RxRingBufferBase.java

示例11: testPollingTerminalState

import rx.exceptions.MissingBackpressureException; //导入依赖的package包/类
@Test(timeout = 500)
public void testPollingTerminalState() throws MissingBackpressureException {
    RxRingBuffer b = createRingBuffer();
    b.onNext(1);
    b.onComplete();
    TestSubscriber<Object> s = new TestSubscriber<Object>();
    Object o = null;
    while ((o = b.poll()) != null) {
        if (b.isCompleted(o)) {
            s.onComplete();
        } else {
            s.onNext(o);
        }
    }

    s.awaitTerminalEvent();
    s.assertReceivedOnNext(Arrays.<Object> asList(1));
}
 
开发者ID:akarnokd,项目名称:RxJavaFlow,代码行数:19,代码来源:RxRingBufferBase.java

示例12: onNext

import rx.exceptions.MissingBackpressureException; //导入依赖的package包/类
@Override
public void onNext(T t) {
    if (done) {
        return;
    }
    try {
        queue.onNext(NotificationLite.next(t));
    } catch (MissingBackpressureException mbe) {
        try {
            onError(mbe);
        } finally {
            unsubscribe();
        }
        return;
    } catch (IllegalStateException ex) {
        if (!isUnsubscribed()) {
            try {
                onError(ex);
            } finally {
                unsubscribe();
            }
        }
        return;
    }
    parent.emit();
}
 
开发者ID:davidmoten,项目名称:rxjava-extras,代码行数:27,代码来源:OrderedMerge.java

示例13: onNext

import rx.exceptions.MissingBackpressureException; //导入依赖的package包/类
@Override
public void onNext(T t) {
    try {
        queue.onNext(NotificationLite.next(t));
    } catch (MissingBackpressureException mbe) {
        try {
            onError(mbe);
        } finally {
            unsubscribe();
        }
        return;
    } catch (IllegalStateException ex) {
        if (!isUnsubscribed()) {
            try {
                onError(ex);
            } finally {
                unsubscribe();
            }
        }
        return;
    }
    parent.emit();
}
 
开发者ID:hawkular,项目名称:hawkular-metrics,代码行数:24,代码来源:SortedMerge.java

示例14: handleScalarSynchronousObservableWithoutRequestLimits

import rx.exceptions.MissingBackpressureException; //导入依赖的package包/类
private void handleScalarSynchronousObservableWithoutRequestLimits(ScalarSynchronousObservable<? extends T> t) {
    T value = t.get();
    if (getEmitLock()) {
        try {
            actual.onNext(value);
            return;
        } finally {
            if (releaseEmitLock()) {
                drainQueuesIfNeeded();
            }
            request(1);
        }
    } else {
        initScalarValueQueueIfNeeded();
        try {
            scalarValueQueue.onNext(value);
        } catch (MissingBackpressureException e) {
            onError(e);
        }
        return;
    }
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:23,代码来源:OperatorMerge.java

示例15: onNext

import rx.exceptions.MissingBackpressureException; //导入依赖的package包/类
@Override
public void onNext(T t) {
    long r = get();
    if (r != Long.MIN_VALUE) {
        long p = produced;
        if (r != p) {
            produced = p + 1;
            actual.onNext(t);
        } else {
            unsubscribe();
            actual.onError(new MissingBackpressureException("PublishSubject: could not emit value due to lack of requests"));
        }
    }
}
 
开发者ID:josesamuel,项目名称:RxRemote,代码行数:15,代码来源:RemoteSubject.java


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