Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Commit

Permalink
Upcast to JaegerTracer for Closeable
Browse files Browse the repository at this point in the history
  • Loading branch information
safris committed Sep 27, 2018
1 parent 8af3052 commit ea77699
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 22 deletions.
7 changes: 5 additions & 2 deletions java/src/main/java/lesson01/solution/Hello.java
Expand Up @@ -2,6 +2,7 @@

import com.google.common.collect.ImmutableMap;

import io.jaegertracing.internal.JaegerTracer;
import io.opentracing.Span;
import io.opentracing.Tracer;
import lib.Tracing;
Expand Down Expand Up @@ -31,8 +32,10 @@ public static void main(String[] args) {
if (args.length != 1) {
throw new IllegalArgumentException("Expecting one argument");
}

String helloTo = args[0];
Tracer tracer = Tracing.init("hello-world");
new Hello(tracer).sayHello(helloTo);
try (JaegerTracer tracer = Tracing.init("hello-world")) {
new Hello(tracer).sayHello(helloTo);
}
}
}
7 changes: 5 additions & 2 deletions java/src/main/java/lesson02/solution/HelloActive.java
Expand Up @@ -2,6 +2,7 @@

import com.google.common.collect.ImmutableMap;

import io.jaegertracing.internal.JaegerTracer;
import io.opentracing.Scope;
import io.opentracing.Tracer;
import lib.Tracing;
Expand Down Expand Up @@ -42,8 +43,10 @@ public static void main(String[] args) {
if (args.length != 1) {
throw new IllegalArgumentException("Expecting one argument");
}

String helloTo = args[0];
Tracer tracer = Tracing.init("hello-world");
new HelloActive(tracer).sayHello(helloTo);
try (JaegerTracer tracer = Tracing.init("hello-world")) {
new HelloActive(tracer).sayHello(helloTo);
}
}
}
7 changes: 5 additions & 2 deletions java/src/main/java/lesson02/solution/HelloManual.java
Expand Up @@ -2,6 +2,7 @@

import com.google.common.collect.ImmutableMap;

import io.jaegertracing.internal.JaegerTracer;
import io.opentracing.Span;
import io.opentracing.Tracer;
import lib.Tracing;
Expand Down Expand Up @@ -49,8 +50,10 @@ public static void main(String[] args) {
if (args.length != 1) {
throw new IllegalArgumentException("Expecting one argument");
}

String helloTo = args[0];
Tracer tracer = Tracing.init("hello-world");
new HelloManual(tracer).sayHello(helloTo);
try (JaegerTracer tracer = Tracing.init("hello-world")) {
new HelloManual(tracer).sayHello(helloTo);
}
}
}
7 changes: 5 additions & 2 deletions java/src/main/java/lesson03/exercise/Hello.java
Expand Up @@ -4,6 +4,7 @@

import com.google.common.collect.ImmutableMap;

import io.jaegertracing.internal.JaegerTracer;
import io.opentracing.Scope;
import io.opentracing.Tracer;
import lib.Tracing;
Expand Down Expand Up @@ -66,8 +67,10 @@ public static void main(String[] args) {
if (args.length != 1) {
throw new IllegalArgumentException("Expecting one argument");
}

String helloTo = args[0];
Tracer tracer = Tracing.init("hello-world");
new Hello(tracer).sayHello(helloTo);
try (JaegerTracer tracer = Tracing.init("hello-world")) {
new Hello(tracer).sayHello(helloTo);
}
}
}
6 changes: 4 additions & 2 deletions java/src/main/java/lesson03/solution/Formatter.java
Expand Up @@ -13,6 +13,7 @@
import io.dropwizard.Application;
import io.dropwizard.Configuration;
import io.dropwizard.setup.Environment;
import io.jaegertracing.internal.JaegerTracer;
import io.opentracing.Scope;
import io.opentracing.Tracer;
import lib.Tracing;
Expand Down Expand Up @@ -48,7 +49,8 @@ public static void main(String[] args) throws Exception {
System.setProperty("dw.server.applicationConnectors[0].port", "8081");
System.setProperty("dw.server.adminConnectors[0].port", "9081");

Tracer tracer = Tracing.init("formatter");
new Formatter(tracer).run(args);
try (JaegerTracer tracer = Tracing.init("formatter")) {
new Formatter(tracer).run(args);
}
}
}
7 changes: 5 additions & 2 deletions java/src/main/java/lesson03/solution/Hello.java
Expand Up @@ -4,6 +4,7 @@

import com.google.common.collect.ImmutableMap;

import io.jaegertracing.internal.JaegerTracer;
import io.opentracing.Scope;
import io.opentracing.Tracer;
import io.opentracing.propagation.Format;
Expand Down Expand Up @@ -74,8 +75,10 @@ public static void main(String[] args) {
if (args.length != 1) {
throw new IllegalArgumentException("Expecting one argument");
}

String helloTo = args[0];
Tracer tracer = Tracing.init("hello-world");
new Hello(tracer).sayHello(helloTo);
try (JaegerTracer tracer = Tracing.init("hello-world")) {
new Hello(tracer).sayHello(helloTo);
}
}
}
6 changes: 4 additions & 2 deletions java/src/main/java/lesson03/solution/Publisher.java
Expand Up @@ -13,6 +13,7 @@
import io.dropwizard.Application;
import io.dropwizard.Configuration;
import io.dropwizard.setup.Environment;
import io.jaegertracing.internal.JaegerTracer;
import io.opentracing.Scope;
import io.opentracing.Tracer;
import lib.Tracing;
Expand Down Expand Up @@ -47,7 +48,8 @@ public void run(Configuration configuration, Environment environment) throws Exc
public static void main(String[] args) throws Exception {
System.setProperty("dw.server.applicationConnectors[0].port", "8082");
System.setProperty("dw.server.adminConnectors[0].port", "9082");
Tracer tracer = Tracing.init("publisher");
new Publisher(tracer).run(args);
try (JaegerTracer tracer = Tracing.init("publisher")) {
new Publisher(tracer).run(args);
}
}
}
6 changes: 4 additions & 2 deletions java/src/main/java/lesson04/exercise/Publisher.java
Expand Up @@ -13,6 +13,7 @@
import io.dropwizard.Application;
import io.dropwizard.Configuration;
import io.dropwizard.setup.Environment;
import io.jaegertracing.internal.JaegerTracer;
import io.opentracing.Scope;
import io.opentracing.Tracer;
import lib.Tracing;
Expand Down Expand Up @@ -47,7 +48,8 @@ public void run(Configuration configuration, Environment environment) throws Exc
public static void main(String[] args) throws Exception {
System.setProperty("dw.server.applicationConnectors[0].port", "8082");
System.setProperty("dw.server.adminConnectors[0].port", "9082");
Tracer tracer = Tracing.init("publisher");
new Publisher(tracer).run(args);
try (JaegerTracer tracer = Tracing.init("publisher")) {
new Publisher(tracer).run(args);
}
}
}
6 changes: 4 additions & 2 deletions java/src/main/java/lesson04/solution/Formatter.java
Expand Up @@ -13,6 +13,7 @@
import io.dropwizard.Application;
import io.dropwizard.Configuration;
import io.dropwizard.setup.Environment;
import io.jaegertracing.internal.JaegerTracer;
import io.opentracing.Scope;
import io.opentracing.Tracer;
import lib.Tracing;
Expand Down Expand Up @@ -51,7 +52,8 @@ public void run(Configuration configuration, Environment environment) throws Exc
public static void main(String[] args) throws Exception {
System.setProperty("dw.server.applicationConnectors[0].port", "8081");
System.setProperty("dw.server.adminConnectors[0].port", "9081");
Tracer tracer = Tracing.init("formatter");
new Formatter(tracer).run(args);
try (JaegerTracer tracer = Tracing.init("formatter")) {
new Formatter(tracer).run(args);
}
}
}
6 changes: 4 additions & 2 deletions java/src/main/java/lesson04/solution/Hello.java
Expand Up @@ -4,6 +4,7 @@

import com.google.common.collect.ImmutableMap;

import io.jaegertracing.internal.JaegerTracer;
import io.opentracing.Scope;
import io.opentracing.Tracer;
import io.opentracing.propagation.Format;
Expand Down Expand Up @@ -77,7 +78,8 @@ public static void main(String[] args) {
}
String helloTo = args[0];
String greeting = args[1];
Tracer tracer = Tracing.init("hello-world");
new Hello(tracer).sayHello(helloTo, greeting);
try (JaegerTracer tracer = Tracing.init("hello-world")) {
new Hello(tracer).sayHello(helloTo, greeting);
}
}
}
6 changes: 4 additions & 2 deletions java/src/main/java/lesson04/solution/Publisher.java
Expand Up @@ -13,6 +13,7 @@
import io.dropwizard.Application;
import io.dropwizard.Configuration;
import io.dropwizard.setup.Environment;
import io.jaegertracing.internal.JaegerTracer;
import io.opentracing.Scope;
import io.opentracing.Tracer;
import lib.Tracing;
Expand Down Expand Up @@ -47,7 +48,8 @@ public void run(Configuration configuration, Environment environment) throws Exc
public static void main(String[] args) throws Exception {
System.setProperty("dw.server.applicationConnectors[0].port", "8082");
System.setProperty("dw.server.adminConnectors[0].port", "9082");
Tracer tracer = Tracing.init("publisher");
new Publisher(tracer).run(args);
try (JaegerTracer tracer = Tracing.init("publisher")) {
new Publisher(tracer).run(args);
}
}
}

0 comments on commit ea77699

Please sign in to comment.