From 25c2aba15fb6e45511719169f65ccc39660e377e Mon Sep 17 00:00:00 2001 From: Prithvi Raj Date: Wed, 11 Oct 2017 22:06:28 -0400 Subject: [PATCH 1/3] Update errorprone and lombok plugin Signed-off-by: Prithvi Raj --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 74a0eac93..181dbff72 100644 --- a/build.gradle +++ b/build.gradle @@ -126,7 +126,7 @@ subprojects { } dependencies { - compileOnly 'org.projectlombok:lombok:1.16.12' + compileOnly 'org.projectlombok:lombok:1.16.18' compileOnly 'org.codehaus.mojo:animal-sniffer-annotations:1.15' } @@ -165,7 +165,7 @@ task printVersion { configure(subprojects.findAll {it.name != 'jaeger-thrift'}) { apply plugin: 'net.ltgt.errorprone' dependencies { - errorprone 'com.google.errorprone:error_prone_core:2.0.15' + errorprone 'com.google.errorprone:error_prone_core:2.1.1' } } From 9e2c98c46be35782108c717d822c4a5729728a44 Mon Sep 17 00:00:00 2001 From: Prithvi Raj Date: Wed, 11 Oct 2017 22:59:34 -0400 Subject: [PATCH 2/3] Update errorprone and lombok and fix warnings and errors - Update errorprone to 2.1.1 - Update lombok to 1.16.18 - Disable the InstanceOfAndCastMatchWrongType and NestedInstanceOfConditions checks to ensure compatibility with lombok. See https://github.com/google/error-prone/issues/750 Signed-off-by: Prithvi Raj --- build.gradle | 6 +++++- jaeger-core/src/main/java/com/uber/jaeger/Tracer.java | 2 +- .../jaeger/samplers/GuaranteedThroughputSamplerTest.java | 3 +++ .../main/java/com/uber/jaeger/crossdock/JerseyServer.java | 6 ++++-- .../resources/behavior/tchannel/TChannelServer.java | 6 +++++- .../com/uber/jaeger/dropwizard/JerseyServerFilterTest.java | 1 + 6 files changed, 19 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 181dbff72..bbf2050bd 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ plugins { id "com.github.hierynomus.license" version "0.14.0" id 'com.github.sherter.google-java-format' version '0.3.2' id "com.github.johnrengelman.shadow" version "2.0.1" - id "net.ltgt.errorprone" version "0.0.10" + id "net.ltgt.errorprone" version "0.0.12" id 'ru.vyarus.animalsniffer' version '1.3.0' id 'io.codearte.nexus-staging' version '0.11.0' } @@ -167,6 +167,10 @@ configure(subprojects.findAll {it.name != 'jaeger-thrift'}) { dependencies { errorprone 'com.google.errorprone:error_prone_core:2.1.1' } + tasks.withType(JavaCompile) { + // These are disabled because of a bug with errorprone. See https://github.com/google/error-prone/issues/750 + options.compilerArgs += [ '-Xep:NestedInstanceOfConditions:OFF', '-Xep:InstanceOfAndCastMatchWrongType:OFF' ] + } } def getVersionForBuild() { diff --git a/jaeger-core/src/main/java/com/uber/jaeger/Tracer.java b/jaeger-core/src/main/java/com/uber/jaeger/Tracer.java index 53f164cb7..f3374ae5a 100644 --- a/jaeger-core/src/main/java/com/uber/jaeger/Tracer.java +++ b/jaeger-core/src/main/java/com/uber/jaeger/Tracer.java @@ -268,7 +268,7 @@ private SpanContext createNewContext(String debugId) { byte flags = 0; if (debugId != null) { - flags |= SpanContext.flagSampled | SpanContext.flagDebug; + flags = (byte) (flags | SpanContext.flagSampled | SpanContext.flagDebug); tags.put(Constants.DEBUG_ID_HEADER_KEY, debugId); metrics.traceStartedSampled.inc(1); } else { diff --git a/jaeger-core/src/test/java/com/uber/jaeger/samplers/GuaranteedThroughputSamplerTest.java b/jaeger-core/src/test/java/com/uber/jaeger/samplers/GuaranteedThroughputSamplerTest.java index e60f6faa4..e085625c8 100644 --- a/jaeger-core/src/test/java/com/uber/jaeger/samplers/GuaranteedThroughputSamplerTest.java +++ b/jaeger-core/src/test/java/com/uber/jaeger/samplers/GuaranteedThroughputSamplerTest.java @@ -20,6 +20,8 @@ import com.uber.jaeger.Constants; import java.util.Map; + +import org.junit.After; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; @@ -30,6 +32,7 @@ public class GuaranteedThroughputSamplerTest { private GuaranteedThroughputSampler undertest; + @After public void tearDown() { undertest.close(); } diff --git a/jaeger-crossdock/src/main/java/com/uber/jaeger/crossdock/JerseyServer.java b/jaeger-crossdock/src/main/java/com/uber/jaeger/crossdock/JerseyServer.java index 1d8672611..dea311824 100644 --- a/jaeger-crossdock/src/main/java/com/uber/jaeger/crossdock/JerseyServer.java +++ b/jaeger-crossdock/src/main/java/com/uber/jaeger/crossdock/JerseyServer.java @@ -36,9 +36,11 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.concurrent.ExecutionException; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import org.apache.log4j.BasicConfigurator; +import org.glassfish.grizzly.GrizzlyFuture; import org.glassfish.grizzly.http.server.HttpServer; import org.glassfish.grizzly.http.server.NetworkListener; import org.glassfish.hk2.utilities.binding.AbstractBinder; @@ -117,8 +119,8 @@ protected void configure() { .register(JacksonFeature.class); } - public void shutdown() { - server.shutdown(); + public void shutdown() throws ExecutionException, InterruptedException { + server.shutdown().get(); } public Tracer getTracer() { diff --git a/jaeger-crossdock/src/main/java/com/uber/jaeger/crossdock/resources/behavior/tchannel/TChannelServer.java b/jaeger-crossdock/src/main/java/com/uber/jaeger/crossdock/resources/behavior/tchannel/TChannelServer.java index 7210722f1..0beecbe58 100644 --- a/jaeger-crossdock/src/main/java/com/uber/jaeger/crossdock/resources/behavior/tchannel/TChannelServer.java +++ b/jaeger-crossdock/src/main/java/com/uber/jaeger/crossdock/resources/behavior/tchannel/TChannelServer.java @@ -18,6 +18,7 @@ import com.uber.jaeger.crossdock.resources.behavior.TraceBehavior; import com.uber.tchannel.api.TChannel; import com.uber.tchannel.tracing.TracingContext; +import io.netty.channel.ChannelFuture; import io.opentracing.Span; import io.opentracing.Tracer; import java.util.EmptyStackException; @@ -45,7 +46,10 @@ public TChannel getChannel() { public void start() throws InterruptedException { // listen for incoming connections - server.listen().channel().closeFuture(); + ChannelFuture serverFuture = server.listen().awaitUninterruptibly(); + if (!serverFuture.isSuccess()) { + throw new RuntimeException("Server future unsuccessful"); + } } public void shutdown() { diff --git a/jaeger-dropwizard/src/test/java/com/uber/jaeger/dropwizard/JerseyServerFilterTest.java b/jaeger-dropwizard/src/test/java/com/uber/jaeger/dropwizard/JerseyServerFilterTest.java index 31235fbc9..1ce94f0dc 100644 --- a/jaeger-dropwizard/src/test/java/com/uber/jaeger/dropwizard/JerseyServerFilterTest.java +++ b/jaeger-dropwizard/src/test/java/com/uber/jaeger/dropwizard/JerseyServerFilterTest.java @@ -55,6 +55,7 @@ protected Application configure() { return resourceConfig; } + @Override @After public void tearDown() throws Exception { super.tearDown(); From 9ad9b8af0c72397831989f51af51332fb0f6b01d Mon Sep 17 00:00:00 2001 From: Prithvi Raj Date: Wed, 11 Oct 2017 23:03:11 -0400 Subject: [PATCH 3/3] Remove unused import Signed-off-by: Prithvi Raj --- .../src/main/java/com/uber/jaeger/crossdock/JerseyServer.java | 1 - 1 file changed, 1 deletion(-) diff --git a/jaeger-crossdock/src/main/java/com/uber/jaeger/crossdock/JerseyServer.java b/jaeger-crossdock/src/main/java/com/uber/jaeger/crossdock/JerseyServer.java index dea311824..67282299f 100644 --- a/jaeger-crossdock/src/main/java/com/uber/jaeger/crossdock/JerseyServer.java +++ b/jaeger-crossdock/src/main/java/com/uber/jaeger/crossdock/JerseyServer.java @@ -40,7 +40,6 @@ import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import org.apache.log4j.BasicConfigurator; -import org.glassfish.grizzly.GrizzlyFuture; import org.glassfish.grizzly.http.server.HttpServer; import org.glassfish.grizzly.http.server.NetworkListener; import org.glassfish.hk2.utilities.binding.AbstractBinder;