@Override public void request(long n) { try (CurrentTraceContext.Scope scope = this.currentTraceContext .maybeScope(this.traceContext)) { this.s.request(n); } }
@Test public void maybeScope_doesntDuplicateContext_onNull() { try (Scope scope2 = currentTraceContext.maybeScope(null)) { assertThat(scope2).isEqualTo(Scope.NOOP); } }
@Benchmark public void maybeScope_redundant_default() { try (CurrentTraceContext.Scope ws = base.maybeScope(context)) { } }
@Test public void maybeScope_doesntDuplicateContext() { try (Scope scope = currentTraceContext.newScope(context)) { try (Scope scope2 = currentTraceContext.maybeScope(context)) { assertThat(scope2).isEqualTo(Scope.NOOP); } } }
@Override public void onComplete() { Scope scope = contextScoper.maybeScope(assembled); try { // retrolambda can't resolve this try/finally downstream.onComplete(); } finally { scope.close(); } }
@Override public void onNext(T t) { Scope scope = contextScoper.maybeScope(assembled); try { // retrolambda can't resolve this try/finally downstream.onNext(t); } finally { scope.close(); } }
@Override public void onError(Throwable t) { Scope scope = contextScoper.maybeScope(assembled); try { // retrolambda can't resolve this try/finally downstream.onError(t); } finally { scope.close(); } }
@Override public void onNext(T t) { Scope scope = contextScoper.maybeScope(assembled); try { // retrolambda can't resolve this try/finally downstream.onNext(t); } finally { scope.close(); } }
/** Clears the scope to prevent remote reporters from accidentally tracing */ void finishInNullScope(Span span) { Scope ws = currentTraceContext.maybeScope(null); try { span.finish(); } finally { ws.close(); } } }
@Override public void onSuccess(T value) { Scope scope = contextScoper.maybeScope(assembled); try { // retrolambda can't resolve this try/finally downstream.onSuccess(value); } finally { scope.close(); } }
@Override public void onComplete() { if (done) return; done = true; Scope scope = contextScoper.maybeScope(assembled); try { // retrolambda can't resolve this try/finally downstream.onComplete(); } finally { scope.close(); } } }
@Override public void onSubscribe(Subscription subscription) { this.parent = subscription; try (CurrentTraceContext.Scope scope = this.currentTraceContext .maybeScope(this.span.context())) { this.actual.onSubscribe(this); } }
@Override public void onError(Throwable t) { Scope scope = contextScoper.maybeScope(assembled); try { // retrolambda can't resolve this try/finally downstream.onError(t); } finally { scope.close(); } }
@Override public void connect(Consumer<? super Disposable> connection) { Scope scope = contextScoper.maybeScope(assembled); try { // retrolambda can't resolve this try/finally source.connect(connection); } finally { scope.close(); } } }
@Override public void onSuccess(T value) { Scope scope = contextScoper.maybeScope(assembled); try { // retrolambda can't resolve this try/finally downstream.onSuccess(value); } finally { scope.close(); } }
@Override public void connect(Consumer<? super Disposable> connection) { Scope scope = contextScoper.maybeScope(assembled); try { // retrolambda can't resolve this try/finally source.connect(connection); } finally { scope.close(); } } }
@Override public void onComplete() { if (done) return; done = true; Scope scope = contextScoper.maybeScope(assembled); try { // retrolambda can't resolve this try/finally downstream.onComplete(); } finally { scope.close(); } }
@Override public void cancel() { try (CurrentTraceContext.Scope scope = this.currentTraceContext .maybeScope(this.span.context())) { this.parent.cancel(); } finally { this.processor.after(this.span, this.isNewSpan, this.log, this.hasLog); } }
@Override public void onCompletion(RecordMetadata metadata, @Nullable Exception exception) { try (Scope ws = current.maybeScope(span.context())) { delegate.onCompletion(metadata, exception); } finally { super.onCompletion(metadata, exception); } } }
Span handleStart(Req request, Span span) { if (span.isNoop()) return span; Scope ws = currentTraceContext.maybeScope(span.context()); try { parseRequest(request, span); } finally { ws.close(); } // all of the above parsing happened before a timestamp on the span return span.start(); }