Java Code Examples for reactor.util.retry.Retry#RetrySignal
The following examples show how to use
reactor.util.retry.Retry#RetrySignal .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FluxRetryWhen.java From reactor-core with Apache License 2.0 | 5 votes |
static <T> void subscribe(CoreSubscriber<? super T> s, Retry whenSourceFactory, CorePublisher<? extends T> source) { RetryWhenOtherSubscriber other = new RetryWhenOtherSubscriber(); Subscriber<Retry.RetrySignal> signaller = Operators.serialize(other.completionSignal); signaller.onSubscribe(Operators.emptySubscription()); CoreSubscriber<T> serial = Operators.serialize(s); RetryWhenMainSubscriber<T> main = new RetryWhenMainSubscriber<>(serial, signaller, source); other.main = main; serial.onSubscribe(main); Publisher<?> p; try { p = Objects.requireNonNull(whenSourceFactory.generateCompanion(other), "The whenSourceFactory returned a null Publisher"); } catch (Throwable e) { s.onError(Operators.onOperatorError(e, s.currentContext())); return; } p.subscribe(other); if (!main.cancelled) { source.subscribe(main); } }
Example 2
Source File: FluxRetryWhen.java From reactor-core with Apache License 2.0 | 5 votes |
RetryWhenMainSubscriber(CoreSubscriber<? super T> actual, Subscriber<Retry.RetrySignal> signaller, CorePublisher<? extends T> source) { super(actual); this.signaller = signaller; this.source = source; this.otherArbiter = new Operators.DeferredSubscription(); this.context = actual.currentContext(); }
Example 3
Source File: RSocketReconnectTest.java From rsocket-java with Apache License 2.0 | 5 votes |
@SafeVarargs private final void assertRetries(Class<? extends Throwable>... exceptions) { assertEquals(exceptions.length, retries.size()); int index = 0; for (Iterator<Retry.RetrySignal> it = retries.iterator(); it.hasNext(); ) { Retry.RetrySignal retryContext = it.next(); assertEquals(index, retryContext.totalRetries()); assertEquals(exceptions[index], retryContext.failure().getClass()); index++; } }
Example 4
Source File: ReconnectMonoTests.java From rsocket-java with Apache License 2.0 | 5 votes |
@SafeVarargs private final void assertRetries(Class<? extends Throwable>... exceptions) { assertEquals(exceptions.length, retries.size()); int index = 0; for (Iterator<Retry.RetrySignal> it = retries.iterator(); it.hasNext(); ) { Retry.RetrySignal retryContext = it.next(); assertEquals(index, retryContext.totalRetries()); assertEquals(exceptions[index], retryContext.failure().getClass()); index++; } }
Example 5
Source File: FluxRetryWhen.java From reactor-core with Apache License 2.0 | 4 votes |
@Override public void subscribe(CoreSubscriber<? super Retry.RetrySignal> actual) { completionSignal.subscribe(actual); }
Example 6
Source File: FluxRetryWhen.java From reactor-core with Apache License 2.0 | 4 votes |
@Override public CoreSubscriber<? super Retry.RetrySignal> subscribeOrReturn(CoreSubscriber<? super Retry.RetrySignal> actual) { return actual; }
Example 7
Source File: FluxRetryWhen.java From reactor-core with Apache License 2.0 | 4 votes |
@Override public CorePublisher<Retry.RetrySignal> source() { return completionSignal; }
Example 8
Source File: FluxRetryWhen.java From reactor-core with Apache License 2.0 | 4 votes |
@Override public OptimizableOperator<?, ? extends Retry.RetrySignal> nextOptimizableSource() { return null; }
Example 9
Source File: RSocketReconnectTest.java From rsocket-java with Apache License 2.0 | 4 votes |
Consumer<Retry.RetrySignal> onRetry() { return context -> retries.add(context); }
Example 10
Source File: ReconnectMonoTests.java From rsocket-java with Apache License 2.0 | 4 votes |
Consumer<Retry.RetrySignal> onRetry() { return context -> retries.add(context); }