From f008a33e53de421ca3f091fdc922015720535aab Mon Sep 17 00:00:00 2001 From: Greg Burd Date: Wed, 9 Aug 2017 09:34:20 -0400 Subject: [PATCH] Changed Zipkin API a bit, now requires a TraceContext rather than a Span before sync/async calls. --- pom.xml | 2 +- .../core/operation/AbstractOptionalOperation.java | 4 ++-- .../core/operation/AbstractStatementOperation.java | 10 +++++----- .../core/operation/AbstractStreamOperation.java | 4 ++-- .../helenus/core/reflect/MapperInvocationHandler.java | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pom.xml b/pom.xml index 1e215f8..a0509fe 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 net.helenus helenus-core - 2.0.9-SNAPSHOT + 2.0.10-SNAPSHOT jar helenus diff --git a/src/main/java/net/helenus/core/operation/AbstractOptionalOperation.java b/src/main/java/net/helenus/core/operation/AbstractOptionalOperation.java index 5c56442..507fd69 100644 --- a/src/main/java/net/helenus/core/operation/AbstractOptionalOperation.java +++ b/src/main/java/net/helenus/core/operation/AbstractOptionalOperation.java @@ -53,7 +53,7 @@ public abstract class AbstractOptionalOperation sync() { Tracer tracer = this.sessionOps.getZipkinTracer(); - final Span cassandraSpan = (tracer != null && span != null) ? tracer.newChild(span.context()) : null; + final Span cassandraSpan = (tracer != null && traceContext != null) ? tracer.newChild(traceContext) : null; if (cassandraSpan != null) { cassandraSpan.name("cassandra"); cassandraSpan.start(); @@ -71,7 +71,7 @@ public abstract class AbstractOptionalOperation> async() { final Tracer tracer = this.sessionOps.getZipkinTracer(); - final Span cassandraSpan = (tracer != null && span != null) ? tracer.newChild(span.context()) : null; + final Span cassandraSpan = (tracer != null && traceContext != null) ? tracer.newChild(traceContext) : null; if (cassandraSpan != null) { cassandraSpan.name("cassandra"); cassandraSpan.start(); diff --git a/src/main/java/net/helenus/core/operation/AbstractStatementOperation.java b/src/main/java/net/helenus/core/operation/AbstractStatementOperation.java index 1e4a70a..9cdf890 100644 --- a/src/main/java/net/helenus/core/operation/AbstractStatementOperation.java +++ b/src/main/java/net/helenus/core/operation/AbstractStatementOperation.java @@ -15,8 +15,8 @@ */ package net.helenus.core.operation; -import brave.Span; import brave.Tracer; +import brave.propagation.TraceContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -44,7 +44,7 @@ public abstract class AbstractStatementOperation sync() { Tracer tracer = this.sessionOps.getZipkinTracer(); - final Span cassandraSpan = (tracer != null && span != null) ? tracer.newChild(span.context()) : null; + final Span cassandraSpan = (tracer != null && traceContext != null) ? tracer.newChild(traceContext) : null; if (cassandraSpan != null) { cassandraSpan.name("cassandra"); cassandraSpan.start(); @@ -72,7 +72,7 @@ public abstract class AbstractStreamOperation> async() { Tracer tracer = this.sessionOps.getZipkinTracer(); - final Span cassandraSpan = (tracer != null && span != null) ? tracer.newChild(span.context()) : null; + final Span cassandraSpan = (tracer != null && traceContext != null) ? tracer.newChild(traceContext) : null; if (cassandraSpan != null) { cassandraSpan.name("cassandra"); cassandraSpan.start(); diff --git a/src/main/java/net/helenus/core/reflect/MapperInvocationHandler.java b/src/main/java/net/helenus/core/reflect/MapperInvocationHandler.java index 773c8ff..b77ba50 100644 --- a/src/main/java/net/helenus/core/reflect/MapperInvocationHandler.java +++ b/src/main/java/net/helenus/core/reflect/MapperInvocationHandler.java @@ -107,7 +107,7 @@ public class MapperInvocationHandler implements InvocationHandler { } else if (returnType.isEnum() && (value.getClass() == Integer.class || value.getClass() == int.class)) { try { - value = returnType.getClass().getEnumConstants()[(int) value]; + value = Class.forName(returnType.getName()).getEnumConstants()[(Integer) value]; } catch (ArrayIndexOutOfBoundsException e) { throw new IllegalArgumentException("invalid ordinal " + value + " for enum type " + returnType.getSimpleName()); }