Repository: accumulo Updated Branches: refs/heads/ACCUMULO-1691 [created] 520f5fdee
http://git-wip-us.apache.org/repos/asf/accumulo/blob/520f5fde/trace/src/main/java/org/apache/accumulo/trace/thrift/SpanReceiver.java ---------------------------------------------------------------------- diff --git a/trace/src/main/java/org/apache/accumulo/trace/thrift/SpanReceiver.java b/trace/src/main/java/org/apache/accumulo/trace/thrift/SpanReceiver.java index b7b57f8..4fe4c38 100644 --- a/trace/src/main/java/org/apache/accumulo/trace/thrift/SpanReceiver.java +++ b/trace/src/main/java/org/apache/accumulo/trace/thrift/SpanReceiver.java @@ -15,7 +15,7 @@ * limitations under the License. */ /** - * Autogenerated by Thrift Compiler (0.9.0) + * Autogenerated by Thrift Compiler (0.9.1) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -31,6 +31,8 @@ import org.apache.thrift.protocol.TTupleProtocol; import org.apache.thrift.protocol.TProtocolException; import org.apache.thrift.EncodingUtils; import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.server.AbstractNonblockingServer.*; import java.util.List; import java.util.ArrayList; import java.util.Map; @@ -56,7 +58,7 @@ import org.slf4j.LoggerFactory; public interface AsyncIface { - public void span(RemoteSpan span, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.span_call> resultHandler) throws org.apache.thrift.TException; + public void span(RemoteSpan span, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; } @@ -110,7 +112,7 @@ import org.slf4j.LoggerFactory; super(protocolFactory, clientManager, transport); } - public void span(RemoteSpan span, org.apache.thrift.async.AsyncMethodCallback<span_call> resultHandler) throws org.apache.thrift.TException { + public void span(RemoteSpan span, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { checkReady(); span_call method_call = new span_call(span, resultHandler, this, ___protocolFactory, ___transport); this.___currentMethod = method_call; @@ -119,7 +121,7 @@ import org.slf4j.LoggerFactory; public static class span_call extends org.apache.thrift.async.TAsyncMethodCall { private RemoteSpan span; - public span_call(RemoteSpan span, org.apache.thrift.async.AsyncMethodCallback<span_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + public span_call(RemoteSpan span, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { super(client, protocolFactory, transport, resultHandler, true); this.span = span; } @@ -179,7 +181,52 @@ import org.slf4j.LoggerFactory; } - public static class span_args implements org.apache.thrift.TBase<span_args, span_args._Fields>, java.io.Serializable, Cloneable { + public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> { + private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); + public AsyncProcessor(I iface) { + super(iface, getProcessMap(new HashMap<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>())); + } + + protected AsyncProcessor(I iface, Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) { + super(iface, getProcessMap(processMap)); + } + + private static <I extends AsyncIface> Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase,?>> getProcessMap(Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) { + processMap.put("span", new span()); + return processMap; + } + + public static class span<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, span_args, Void> { + public span() { + super("span"); + } + + public span_args getEmptyArgsInstance() { + return new span_args(); + } + + public AsyncMethodCallback<Void> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback<Void>() { + public void onComplete(Void o) { + } + public void onError(Exception e) { + } + }; + } + + protected boolean isOneway() { + return true; + } + + public void start(I iface, span_args args, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws TException { + iface.span(args.span,resultHandler); + } + } + + } + + public static class span_args implements org.apache.thrift.TBase<span_args, span_args._Fields>, java.io.Serializable, Cloneable, Comparable<span_args> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("span_args"); private static final org.apache.thrift.protocol.TField SPAN_FIELD_DESC = new org.apache.thrift.protocol.TField("span", org.apache.thrift.protocol.TType.STRUCT, (short)1); @@ -377,20 +424,20 @@ import org.slf4j.LoggerFactory; return 0; } + @Override public int compareTo(span_args other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; - span_args typedOther = (span_args)other; - lastComparison = Boolean.valueOf(isSetSpan()).compareTo(typedOther.isSetSpan()); + lastComparison = Boolean.valueOf(isSetSpan()).compareTo(other.isSetSpan()); if (lastComparison != 0) { return lastComparison; } if (isSetSpan()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.span, typedOther.span); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.span, other.span); if (lastComparison != 0) { return lastComparison; } http://git-wip-us.apache.org/repos/asf/accumulo/blob/520f5fde/trace/src/main/java/org/apache/accumulo/trace/thrift/TInfo.java ---------------------------------------------------------------------- diff --git a/trace/src/main/java/org/apache/accumulo/trace/thrift/TInfo.java b/trace/src/main/java/org/apache/accumulo/trace/thrift/TInfo.java index ed4f7c2..9f899bf 100644 --- a/trace/src/main/java/org/apache/accumulo/trace/thrift/TInfo.java +++ b/trace/src/main/java/org/apache/accumulo/trace/thrift/TInfo.java @@ -15,7 +15,7 @@ * limitations under the License. */ /** - * Autogenerated by Thrift Compiler (0.9.0) + * Autogenerated by Thrift Compiler (0.9.1) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -31,6 +31,8 @@ import org.apache.thrift.protocol.TTupleProtocol; import org.apache.thrift.protocol.TProtocolException; import org.apache.thrift.EncodingUtils; import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.server.AbstractNonblockingServer.*; import java.util.List; import java.util.ArrayList; import java.util.Map; @@ -46,7 +48,7 @@ import java.util.Arrays; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@SuppressWarnings("all") public class TInfo implements org.apache.thrift.TBase<TInfo, TInfo._Fields>, java.io.Serializable, Cloneable { +@SuppressWarnings("all") public class TInfo implements org.apache.thrift.TBase<TInfo, TInfo._Fields>, java.io.Serializable, Cloneable, Comparable<TInfo> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TInfo"); private static final org.apache.thrift.protocol.TField TRACE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("traceId", org.apache.thrift.protocol.TType.I64, (short)1); @@ -305,30 +307,30 @@ import org.slf4j.LoggerFactory; return 0; } + @Override public int compareTo(TInfo other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; - TInfo typedOther = (TInfo)other; - lastComparison = Boolean.valueOf(isSetTraceId()).compareTo(typedOther.isSetTraceId()); + lastComparison = Boolean.valueOf(isSetTraceId()).compareTo(other.isSetTraceId()); if (lastComparison != 0) { return lastComparison; } if (isSetTraceId()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.traceId, typedOther.traceId); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.traceId, other.traceId); if (lastComparison != 0) { return lastComparison; } } - lastComparison = Boolean.valueOf(isSetParentId()).compareTo(typedOther.isSetParentId()); + lastComparison = Boolean.valueOf(isSetParentId()).compareTo(other.isSetParentId()); if (lastComparison != 0) { return lastComparison; } if (isSetParentId()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.parentId, typedOther.parentId); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.parentId, other.parentId); if (lastComparison != 0) { return lastComparison; } http://git-wip-us.apache.org/repos/asf/accumulo/blob/520f5fde/trace/src/main/java/org/apache/accumulo/trace/thrift/TestService.java ---------------------------------------------------------------------- diff --git a/trace/src/main/java/org/apache/accumulo/trace/thrift/TestService.java b/trace/src/main/java/org/apache/accumulo/trace/thrift/TestService.java index 60263f8..da5d64f 100644 --- a/trace/src/main/java/org/apache/accumulo/trace/thrift/TestService.java +++ b/trace/src/main/java/org/apache/accumulo/trace/thrift/TestService.java @@ -15,7 +15,7 @@ * limitations under the License. */ /** - * Autogenerated by Thrift Compiler (0.9.0) + * Autogenerated by Thrift Compiler (0.9.1) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -31,6 +31,8 @@ import org.apache.thrift.protocol.TTupleProtocol; import org.apache.thrift.protocol.TProtocolException; import org.apache.thrift.EncodingUtils; import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.server.AbstractNonblockingServer.*; import java.util.List; import java.util.ArrayList; import java.util.Map; @@ -56,7 +58,7 @@ import org.slf4j.LoggerFactory; public interface AsyncIface { - public void checkTrace(TInfo tinfo, String message, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.checkTrace_call> resultHandler) throws org.apache.thrift.TException; + public void checkTrace(TInfo tinfo, String message, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; } @@ -122,7 +124,7 @@ import org.slf4j.LoggerFactory; super(protocolFactory, clientManager, transport); } - public void checkTrace(TInfo tinfo, String message, org.apache.thrift.async.AsyncMethodCallback<checkTrace_call> resultHandler) throws org.apache.thrift.TException { + public void checkTrace(TInfo tinfo, String message, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { checkReady(); checkTrace_call method_call = new checkTrace_call(tinfo, message, resultHandler, this, ___protocolFactory, ___transport); this.___currentMethod = method_call; @@ -132,7 +134,7 @@ import org.slf4j.LoggerFactory; public static class checkTrace_call extends org.apache.thrift.async.TAsyncMethodCall { private TInfo tinfo; private String message; - public checkTrace_call(TInfo tinfo, String message, org.apache.thrift.async.AsyncMethodCallback<checkTrace_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + public checkTrace_call(TInfo tinfo, String message, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { super(client, protocolFactory, transport, resultHandler, false); this.tinfo = tinfo; this.message = message; @@ -197,7 +199,76 @@ import org.slf4j.LoggerFactory; } - public static class checkTrace_args implements org.apache.thrift.TBase<checkTrace_args, checkTrace_args._Fields>, java.io.Serializable, Cloneable { + public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> { + private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); + public AsyncProcessor(I iface) { + super(iface, getProcessMap(new HashMap<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>())); + } + + protected AsyncProcessor(I iface, Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) { + super(iface, getProcessMap(processMap)); + } + + private static <I extends AsyncIface> Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase,?>> getProcessMap(Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) { + processMap.put("checkTrace", new checkTrace()); + return processMap; + } + + public static class checkTrace<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, checkTrace_args, Boolean> { + public checkTrace() { + super("checkTrace"); + } + + public checkTrace_args getEmptyArgsInstance() { + return new checkTrace_args(); + } + + public AsyncMethodCallback<Boolean> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback<Boolean>() { + public void onComplete(Boolean o) { + checkTrace_result result = new checkTrace_result(); + result.success = o; + result.setSuccessIsSet(true); + try { + fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + checkTrace_result result = new checkTrace_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb,msg,msgType,seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, checkTrace_args args, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws TException { + iface.checkTrace(args.tinfo, args.message,resultHandler); + } + } + + } + + public static class checkTrace_args implements org.apache.thrift.TBase<checkTrace_args, checkTrace_args._Fields>, java.io.Serializable, Cloneable, Comparable<checkTrace_args> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("checkTrace_args"); private static final org.apache.thrift.protocol.TField TINFO_FIELD_DESC = new org.apache.thrift.protocol.TField("tinfo", org.apache.thrift.protocol.TType.STRUCT, (short)1); @@ -454,30 +525,30 @@ import org.slf4j.LoggerFactory; return 0; } + @Override public int compareTo(checkTrace_args other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; - checkTrace_args typedOther = (checkTrace_args)other; - lastComparison = Boolean.valueOf(isSetTinfo()).compareTo(typedOther.isSetTinfo()); + lastComparison = Boolean.valueOf(isSetTinfo()).compareTo(other.isSetTinfo()); if (lastComparison != 0) { return lastComparison; } if (isSetTinfo()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tinfo, typedOther.tinfo); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tinfo, other.tinfo); if (lastComparison != 0) { return lastComparison; } } - lastComparison = Boolean.valueOf(isSetMessage()).compareTo(typedOther.isSetMessage()); + lastComparison = Boolean.valueOf(isSetMessage()).compareTo(other.isSetMessage()); if (lastComparison != 0) { return lastComparison; } if (isSetMessage()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, typedOther.message); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, other.message); if (lastComparison != 0) { return lastComparison; } @@ -656,7 +727,7 @@ import org.slf4j.LoggerFactory; } - public static class checkTrace_result implements org.apache.thrift.TBase<checkTrace_result, checkTrace_result._Fields>, java.io.Serializable, Cloneable { + public static class checkTrace_result implements org.apache.thrift.TBase<checkTrace_result, checkTrace_result._Fields>, java.io.Serializable, Cloneable, Comparable<checkTrace_result> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("checkTrace_result"); private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.BOOL, (short)0); @@ -856,20 +927,20 @@ import org.slf4j.LoggerFactory; return 0; } + @Override public int compareTo(checkTrace_result other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; - checkTrace_result typedOther = (checkTrace_result)other; - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); if (lastComparison != 0) { return lastComparison; } if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); if (lastComparison != 0) { return lastComparison; }