本文整理汇总了Java中org.reactivestreams.Subscriber.onComplete方法的典型用法代码示例。如果您正苦于以下问题:Java Subscriber.onComplete方法的具体用法?Java Subscriber.onComplete怎么用?Java Subscriber.onComplete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.reactivestreams.Subscriber
的用法示例。
在下文中一共展示了Subscriber.onComplete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: succeed
import org.reactivestreams.Subscriber; //导入方法依赖的package包/类
protected void succeed() {
synchronized (this) {
state = State.COMPLETING;
}
Subscriber<? super T> subscriber = subscriber();
if (subscriber != null) {
boolean complete = false;
synchronized (this) {
if (state == State.COMPLETING) {
state = State.TERMINATED;
complete = true;
}
}
if (complete) {
subscriber.onComplete();
}
}
}
示例2: fastPath
import org.reactivestreams.Subscriber; //导入方法依赖的package包/类
@Override
void fastPath() {
T[] arr = array;
int f = arr.length;
Subscriber<? super T> a = actual;
for (int i = index; i != f; i++) {
if (cancelled) {
return;
}
T t = arr[i];
if (t == null) {
a.onError(new NullPointerException("array element is null"));
return;
} else {
a.onNext(t);
}
}
if (cancelled) {
return;
}
a.onComplete();
}
示例3: fastPath
import org.reactivestreams.Subscriber; //导入方法依赖的package包/类
@Override
void fastPath() {
int f = end;
Subscriber<? super Integer> a = actual;
for (int i = index; i != f; i++) {
if (cancelled) {
return;
}
a.onNext(i);
}
if (cancelled) {
return;
}
a.onComplete();
}
示例4: fastPath
import org.reactivestreams.Subscriber; //导入方法依赖的package包/类
@Override
void fastPath() {
long f = end;
Subscriber<? super Long> a = actual;
for (long i = index; i != f; i++) {
if (cancelled) {
return;
}
a.onNext(i);
}
if (cancelled) {
return;
}
a.onComplete();
}
示例5: doOnEmpty
import org.reactivestreams.Subscriber; //导入方法依赖的package包/类
public static <T> FlowableOperator<T, T> doOnEmpty(Action
action) {
return new FlowableOperator<T, T>() {
@Override
public Subscriber<? super T> apply(Subscriber<? super
T> subscriber) throws Exception {
return new DisposableSubscriber<T>() {
boolean isEmpty = true;
@Override
public void onNext(T value) {
isEmpty = false;
subscriber.onNext(value);
}
@Override
public void onError(Throwable t) {
subscriber.onError(t);
}
@Override
public void onComplete() {
if (isEmpty) {
try {
action.run();
} catch (Exception e) {
onError(e);
return;
}
}
subscriber.onComplete();
}
};
}
};
}
示例6: apply
import org.reactivestreams.Subscriber; //导入方法依赖的package包/类
@Override
public Subscriber<? super T> apply(final Subscriber<? super T> observer) {
return new Subscriber<T>() {
@Override
public void onSubscribe(Subscription subscription) {
if (subscribedOnce.getAndSet(true)) {
throw new NullPointerException("You cannot directly subscribe to a gRPC service multiple times " +
"concurrently. Use Flowable.share() instead.");
} else {
observer.onSubscribe(subscription);
}
}
@Override
public void onNext(T t) {
observer.onNext(t);
}
@Override
public void onError(Throwable throwable) {
observer.onError(throwable);
}
@Override
public void onComplete() {
observer.onComplete();
}
};
}
示例7: onRequest
import org.reactivestreams.Subscriber; //导入方法依赖的package包/类
@Override
protected void onRequest(long n) {
if (!complete) {
complete = true;
Subscriber<? super ContentChunk> subscriber = subscriber();
subscriber.onNext(new ContentChunk(ByteBuffer.wrap(bytes), Callback.NOOP));
subscriber.onComplete();
}
}
示例8: wrapSubscriber
import org.reactivestreams.Subscriber; //导入方法依赖的package包/类
public static <T> Subscriber<T> wrapSubscriber(Subscriber<T> subscriber, IRxBusQueue isResumedProvider)
{
return new Subscriber<T>()
{
@Override
public void onSubscribe(Subscription s) {
subscriber.onSubscribe(s);
}
@Override
public void onComplete()
{
subscriber.onComplete();
}
@Override
public void onError(Throwable e)
{
subscriber.onError(e);
}
@Override
public void onNext(T t)
{
if (RxUtil.safetyQueueCheck(t, isResumedProvider))
subscriber.onNext(t);
}
};
}
示例9: wrapSubscriber
import org.reactivestreams.Subscriber; //导入方法依赖的package包/类
public static <T> Subscriber<T> wrapSubscriber(Subscriber<T> subscriber, IRxBusQueue isResumedProvider)
{
return new Subscriber<T>()
{
@Override
public void onSubscribe(Subscription s) {
subscriber.onSubscribe(s);
}
@Override
public void onComplete()
{
subscriber.onComplete();
}
@Override
public void onError(Throwable e)
{
subscriber.onError(e);
}
@Override
public void onNext(T t)
{
if (RxUtil.safetyQueueCheck(t, isResumedProvider))
subscriber.onNext(t);
}
};
}
示例10: onNext
import org.reactivestreams.Subscriber; //导入方法依赖的package包/类
/**
* Emits the given value if possible and terminates if there was an onComplete or onError
* while emitting, drops the value otherwise.
* @param <T> the value type
* @param subscriber the target Subscriber to emit to
* @param value the value to emit
* @param wip the serialization work-in-progress counter/indicator
* @param error the holder of Throwables
*/
public static <T> void onNext(Subscriber<? super T> subscriber, T value,
AtomicInteger wip, AtomicThrowable error) {
if (wip.get() == 0 && wip.compareAndSet(0, 1)) {
subscriber.onNext(value);
if (wip.decrementAndGet() != 0) {
Throwable ex = error.terminate();
if (ex != null) {
subscriber.onError(ex);
} else {
subscriber.onComplete();
}
}
}
}
示例11: onComplete
import org.reactivestreams.Subscriber; //导入方法依赖的package包/类
/**
* Emits an onComplete signal or an onError signal with the given error or indicates
* the concurrently running onNext should do that.
* @param subscriber the target Subscriber to emit to
* @param wip the serialization work-in-progress counter/indicator
* @param error the holder of Throwables
*/
public static void onComplete(Subscriber<?> subscriber, AtomicInteger wip, AtomicThrowable error) {
if (wip.getAndIncrement() == 0) {
Throwable ex = error.terminate();
if (ex != null) {
subscriber.onError(ex);
} else {
subscriber.onComplete();
}
}
}
示例12: request
import org.reactivestreams.Subscriber; //导入方法依赖的package包/类
@Override
public void request(long n) {
if (!SubscriptionHelper.validate(n)) {
return;
}
if (compareAndSet(NO_REQUEST, REQUESTED)) {
Subscriber<? super T> s = subscriber;
s.onNext(value);
if (get() != CANCELLED) {
s.onComplete();
}
}
}
示例13: request
import org.reactivestreams.Subscriber; //导入方法依赖的package包/类
@Override
public final void request(long n) {
if (SubscriptionHelper.validate(n)) {
for (;;) {
int state = get();
// if the any bits 1-31 are set, we are either in fusion mode (FUSED_*)
// or request has been called (HAS_REQUEST_*)
if ((state & ~NO_REQUEST_HAS_VALUE) != 0) {
return;
}
if (state == NO_REQUEST_HAS_VALUE) {
if (compareAndSet(NO_REQUEST_HAS_VALUE, HAS_REQUEST_HAS_VALUE)) {
T v = value;
if (v != null) {
value = null;
Subscriber<? super T> a = actual;
a.onNext(v);
if (get() != CANCELLED) {
a.onComplete();
}
}
}
return;
}
if (compareAndSet(NO_REQUEST_NO_VALUE, HAS_REQUEST_NO_VALUE)) {
return;
}
}
}
}
示例14: slowPath
import org.reactivestreams.Subscriber; //导入方法依赖的package包/类
@Override
void slowPath(long r) {
long e = 0;
int f = end;
int i = index;
Subscriber<? super Integer> a = actual;
for (;;) {
while (e != r && i != f) {
if (cancelled) {
return;
}
a.onNext(i);
e++;
i++;
}
if (i == f) {
if (!cancelled) {
a.onComplete();
}
return;
}
r = get();
if (e == r) {
index = i;
r = addAndGet(-e);
if (r == 0L) {
return;
}
e = 0L;
}
}
}
示例15: slowPath
import org.reactivestreams.Subscriber; //导入方法依赖的package包/类
@Override
void slowPath(long r) {
long e = 0;
long f = end;
long i = index;
Subscriber<? super Long> a = actual;
for (;;) {
while (e != r && i != f) {
if (cancelled) {
return;
}
a.onNext(i);
e++;
i++;
}
if (i == f) {
if (!cancelled) {
a.onComplete();
}
return;
}
r = get();
if (e == r) {
index = i;
r = addAndGet(-e);
if (r == 0L) {
return;
}
e = 0L;
}
}
}