Rename unused try-with-resources scope variables (#3201)

This commit is contained in:
Trask Stalnaker 2021-06-06 19:41:50 -07:00 committed by GitHub
parent cefaecab3f
commit f9dcd03b4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 18 additions and 20 deletions

View File

@ -18,7 +18,7 @@ public final class Worker {
/** Simulate work for the give number of milliseconds. */
public static void doWork(long workTimeMillis) {
Span span = tracer.spanBuilder("work").startSpan();
try (Scope scope = span.makeCurrent()) {
try (Scope ignored = span.makeCurrent()) {
if (span != null) {
span.setAttribute("work-time", workTimeMillis);
span.setAttribute("info", "interesting stuff");

View File

@ -66,12 +66,10 @@ public final class JettyPerftest {
private static void scheduleWork(long workTimeMillis) {
Span span = tracer.spanBuilder("work").startSpan();
try (Scope scope = span.makeCurrent()) {
if (span != null) {
span.setAttribute("work-time", workTimeMillis);
span.setAttribute("info", "interesting stuff");
span.setAttribute("additionalInfo", "interesting stuff");
}
try (Scope ignored = span.makeCurrent()) {
span.setAttribute("work-time", workTimeMillis);
span.setAttribute("info", "interesting stuff");
span.setAttribute("additionalInfo", "interesting stuff");
if (workTimeMillis > 0) {
Worker.doWork(workTimeMillis);
}

View File

@ -181,7 +181,7 @@ public class ApacheHttpAsyncClientInstrumentation implements TypeInstrumentation
if (parentContext == null) {
completeDelegate(result);
} else {
try (Scope scope = parentContext.makeCurrent()) {
try (Scope ignored = parentContext.makeCurrent()) {
completeDelegate(result);
}
}
@ -195,7 +195,7 @@ public class ApacheHttpAsyncClientInstrumentation implements TypeInstrumentation
if (parentContext == null) {
failDelegate(ex);
} else {
try (Scope scope = parentContext.makeCurrent()) {
try (Scope ignored = parentContext.makeCurrent()) {
failDelegate(ex);
}
}
@ -209,7 +209,7 @@ public class ApacheHttpAsyncClientInstrumentation implements TypeInstrumentation
if (parentContext == null) {
cancelDelegate();
} else {
try (Scope scope = parentContext.makeCurrent()) {
try (Scope ignored = parentContext.makeCurrent()) {
cancelDelegate();
}
}

View File

@ -29,28 +29,28 @@ public class SubscriberWrapper implements Subscriber<Object> {
@Override
public void onSubscribe(Subscription subscription) {
try (Scope ignore = context.makeCurrent()) {
try (Scope ignored = context.makeCurrent()) {
delegate.onSubscribe(subscription);
}
}
@Override
public void onNext(Object o) {
try (Scope ignore = context.makeCurrent()) {
try (Scope ignored = context.makeCurrent()) {
delegate.onNext(o);
}
}
@Override
public void onError(Throwable throwable) {
try (Scope ignore = context.makeCurrent()) {
try (Scope ignored = context.makeCurrent()) {
delegate.onError(throwable);
}
}
@Override
public void onComplete() {
try (Scope ignore = context.makeCurrent()) {
try (Scope ignored = context.makeCurrent()) {
delegate.onComplete();
}
}

View File

@ -51,7 +51,7 @@ public class AsyncHandlerWrapper implements AsyncHandler {
public Object onCompleted() throws Exception {
tracer().end(context, builder.build());
try (Scope scope = parentContext.makeCurrent()) {
try (Scope ignored = parentContext.makeCurrent()) {
return delegate.onCompleted();
}
}
@ -60,7 +60,7 @@ public class AsyncHandlerWrapper implements AsyncHandler {
public void onThrowable(Throwable throwable) {
tracer().endExceptionally(context, throwable);
try (Scope scope = parentContext.makeCurrent()) {
try (Scope ignored = parentContext.makeCurrent()) {
delegate.onThrowable(throwable);
}
}

View File

@ -64,7 +64,7 @@ public class TracedDelegatingConsumer implements Consumer {
throws IOException {
Context context = tracer().startDeliverySpan(queue, envelope, properties, body);
try (Scope scope = context.makeCurrent()) {
try (Scope ignored = context.makeCurrent()) {
// Call delegate.
delegate.handleDelivery(consumerTag, envelope, properties, body);
tracer().end(context);

View File

@ -102,14 +102,14 @@ public class AdviceUtils {
@Override
public void onSubscribe(Subscription subscription) {
this.subscription = subscription;
try (Scope scope = otelContext.makeCurrent()) {
try (Scope ignored = otelContext.makeCurrent()) {
subscriber.onSubscribe(this);
}
}
@Override
public void onNext(T t) {
try (Scope scope = otelContext.makeCurrent()) {
try (Scope ignored = otelContext.makeCurrent()) {
subscriber.onNext(t);
}
}

View File

@ -36,7 +36,7 @@ public class ExceptionHandlerWrapper implements Handler<Throwable> {
tracer().endExceptionally(contexts.context, throwable);
try (Scope scope = contexts.parentContext.makeCurrent()) {
try (Scope ignored = contexts.parentContext.makeCurrent()) {
callHandler(throwable);
}
}