You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ec...@apache.org on 2012/07/10 14:39:55 UTC
svn commit: r1359639 [12/13] - in /accumulo/trunk: ./ core/
core/src/main/java/org/apache/accumulo/core/client/admin/
core/src/main/java/org/apache/accumulo/core/client/impl/
core/src/main/java/org/apache/accumulo/core/client/impl/thrift/
core/src/main...
Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/functional/ZombieTServer.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/functional/ZombieTServer.java?rev=1359639&r1=1359638&r2=1359639&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/functional/ZombieTServer.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/functional/ZombieTServer.java Tue Jul 10 12:39:52 2012
@@ -21,6 +21,7 @@ import java.net.InetSocketAddress;
import java.util.HashMap;
import java.util.Random;
+import org.apache.accumulo.cloudtrace.instrument.Tracer;
import org.apache.accumulo.cloudtrace.thrift.TInfo;
import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.Instance;
@@ -29,6 +30,8 @@ import org.apache.accumulo.core.master.t
import org.apache.accumulo.core.security.thrift.AuthInfo;
import org.apache.accumulo.core.security.thrift.ThriftSecurityException;
import org.apache.accumulo.core.tabletserver.thrift.TabletClientService;
+import org.apache.accumulo.core.tabletserver.thrift.TabletClientService.Iface;
+import org.apache.accumulo.core.tabletserver.thrift.TabletClientService.Processor;
import org.apache.accumulo.core.util.AddressUtil;
import org.apache.accumulo.core.util.ServerServices;
import org.apache.accumulo.core.util.ServerServices.Service;
@@ -96,7 +99,7 @@ public class ZombieTServer {
TransactionWatcher watcher = new TransactionWatcher();
final ThriftClientHandler tch = new ThriftClientHandler(instance, watcher);
- TabletClientService.Processor processor = new TabletClientService.Processor(tch);
+ Processor<Iface> processor = new Processor<Iface>(tch);
ServerPort serverPort = TServerUtils.startTServer(port, processor, "ZombieTServer", "walking dead", 2, 1000);
InetSocketAddress addr = new InetSocketAddress(InetAddress.getLocalHost(), serverPort.port);
@@ -111,7 +114,7 @@ public class ZombieTServer {
@Override
public void lostLock(final LockLossReason reason) {
try {
- tch.halt(null, null, null);
+ tch.halt(Tracer.traceInfo(), null, null);
} catch (Exception ex) {
log.error(ex, ex);
System.exit(1);
Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/performance/thrift/NullTserver.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/performance/thrift/NullTserver.java?rev=1359639&r1=1359638&r2=1359639&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/performance/thrift/NullTserver.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/performance/thrift/NullTserver.java Tue Jul 10 12:39:52 2012
@@ -47,6 +47,8 @@ import org.apache.accumulo.core.security
import org.apache.accumulo.core.security.thrift.ThriftSecurityException;
import org.apache.accumulo.core.tabletserver.thrift.ActiveScan;
import org.apache.accumulo.core.tabletserver.thrift.TabletClientService;
+import org.apache.accumulo.core.tabletserver.thrift.TabletClientService.Iface;
+import org.apache.accumulo.core.tabletserver.thrift.TabletClientService.Processor;
import org.apache.accumulo.core.tabletserver.thrift.TabletStats;
import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.server.client.ClientServiceHandler;
@@ -205,7 +207,7 @@ public class NullTserver {
TransactionWatcher watcher = new TransactionWatcher();
ThriftClientHandler tch = new ThriftClientHandler(HdfsZooInstance.getInstance(), watcher);
- TabletClientService.Processor processor = new TabletClientService.Processor(tch);
+ Processor<Iface> processor = new Processor<Iface>(tch);
TServerUtils.startTServer(port, processor, "NullTServer", "null tserver", 2, 1000);
InetSocketAddress addr = new InetSocketAddress(InetAddress.getLocalHost(), port);
Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/trace/TraceServer.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/trace/TraceServer.java?rev=1359639&r1=1359638&r2=1359639&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/trace/TraceServer.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/trace/TraceServer.java Tue Jul 10 12:39:52 2012
@@ -23,7 +23,8 @@ import java.util.TimerTask;
import org.apache.accumulo.cloudtrace.instrument.Span;
import org.apache.accumulo.cloudtrace.thrift.RemoteSpan;
-import org.apache.accumulo.cloudtrace.thrift.SpanReceiver;
+import org.apache.accumulo.cloudtrace.thrift.SpanReceiver.Processor;
+import org.apache.accumulo.cloudtrace.thrift.SpanReceiver.Iface;
import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.BatchWriter;
import org.apache.accumulo.core.client.Connector;
@@ -110,7 +111,7 @@ public class TraceServer implements Watc
}
}
- class Receiver implements SpanReceiver.Iface {
+ class Receiver implements Iface {
@Override
public void span(RemoteSpan s) throws TException {
String idString = Long.toHexString(s.traceId);
@@ -172,7 +173,7 @@ public class TraceServer implements Watc
sock.bind(new InetSocketAddress(port));
final TServerTransport transport = new TServerSocket(sock);
TThreadPoolServer.Args options = new TThreadPoolServer.Args(transport);
- options.processor(new SpanReceiver.Processor(new Receiver()));
+ options.processor(new Processor<Iface>(new Receiver()));
server = new TThreadPoolServer(options);
final InetSocketAddress address = new InetSocketAddress(hostname, sock.getLocalPort());
registerInZooKeeper(AddressUtil.toString(address));
Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/Admin.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/Admin.java?rev=1359639&r1=1359638&r2=1359639&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/Admin.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/Admin.java Tue Jul 10 12:39:52 2012
@@ -24,6 +24,7 @@ import java.nio.ByteBuffer;
import jline.ConsoleReader;
+import org.apache.accumulo.cloudtrace.instrument.Tracer;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.impl.ClientExec;
@@ -119,10 +120,10 @@ public class Admin {
}
private static void stopServer(final AuthInfo credentials, final boolean tabletServersToo) throws AccumuloException, AccumuloSecurityException {
- MasterClient.execute(HdfsZooInstance.getInstance(), new ClientExec<MasterClientService.Iface>() {
+ MasterClient.execute(HdfsZooInstance.getInstance(), new ClientExec<MasterClientService.Client>() {
@Override
- public void execute(MasterClientService.Iface client) throws Exception {
- client.shutdown(null, credentials, tabletServersToo);
+ public void execute(MasterClientService.Client client) throws Exception {
+ client.shutdown(Tracer.traceInfo(), credentials, tabletServersToo);
}
});
}
@@ -130,10 +131,10 @@ public class Admin {
private static void stopTabletServer(String server, final boolean force) throws AccumuloException, AccumuloSecurityException {
InetSocketAddress address = AddressUtil.parseAddress(server, Property.TSERV_CLIENTPORT);
final String finalServer = org.apache.accumulo.core.util.AddressUtil.toString(address);
- MasterClient.execute(HdfsZooInstance.getInstance(), new ClientExec<MasterClientService.Iface>() {
+ MasterClient.execute(HdfsZooInstance.getInstance(), new ClientExec<MasterClientService.Client>() {
@Override
- public void execute(MasterClientService.Iface client) throws Exception {
- client.shutdownTabletServer(null, SecurityConstants.getSystemCredentials(), finalServer, force);
+ public void execute(MasterClientService.Client client) throws Exception {
+ client.shutdownTabletServer(Tracer.traceInfo(), SecurityConstants.getSystemCredentials(), finalServer, force);
}
});
}
Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/TServerUtils.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/TServerUtils.java?rev=1359639&r1=1359638&r2=1359639&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/TServerUtils.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/TServerUtils.java Tue Jul 10 12:39:52 2012
@@ -20,7 +20,6 @@ import java.io.IOException;
import java.lang.reflect.Field;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
-import java.net.Socket;
import java.net.UnknownHostException;
import java.nio.channels.ServerSocketChannel;
import java.util.Random;
@@ -43,10 +42,10 @@ import org.apache.thrift.TException;
import org.apache.thrift.TProcessor;
import org.apache.thrift.TProcessorFactory;
import org.apache.thrift.protocol.TProtocol;
+import org.apache.thrift.server.THsHaServer;
import org.apache.thrift.server.TServer;
import org.apache.thrift.server.TThreadPoolServer;
import org.apache.thrift.transport.TNonblockingServerSocket;
-import org.apache.thrift.transport.TNonblockingSocket;
import org.apache.thrift.transport.TServerTransport;
import org.apache.thrift.transport.TTransport;
import org.apache.thrift.transport.TTransportException;
@@ -148,7 +147,12 @@ public class TServerUtils {
metrics.add(ThriftMetrics.idle, (now - idleStart));
}
try {
- return other.process(in, out);
+ try {
+ return other.process(in, out);
+ } catch (NullPointerException ex) {
+ // THRIFT-1447 - remove with thrift 0.9
+ return true;
+ }
} finally {
if (metrics.isEnabled()) {
idleStart = System.currentTimeMillis();
@@ -173,34 +177,6 @@ public class TServerUtils {
}
}
- public static class THsHaServer extends org.apache.thrift.server.THsHaServer {
- public THsHaServer(Args args) {
- super(args);
- }
-
- protected Runnable getRunnable(FrameBuffer frameBuffer) {
- return new Invocation(frameBuffer);
- }
-
- private class Invocation implements Runnable {
-
- private final FrameBuffer frameBuffer;
-
- public Invocation(final FrameBuffer frameBuffer) {
- this.frameBuffer = frameBuffer;
- }
-
- public void run() {
- if (frameBuffer.trans_ instanceof TNonblockingSocket) {
- TNonblockingSocket tsock = (TNonblockingSocket) frameBuffer.trans_;
- Socket sock = tsock.getSocketChannel().socket();
- clientAddress.set(sock.getInetAddress().getHostAddress() + ":" + sock.getPort());
- }
- frameBuffer.invoke();
- }
- }
- }
-
public static ServerPort startHsHaServer(int port, TProcessor processor, final String serverName, String threadName, final int numThreads,
long timeBetweenThreadChecks) throws TTransportException {
TNonblockingServerSocket transport = new TNonblockingServerSocket(port);
Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/VerifyTabletAssignments.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/VerifyTabletAssignments.java?rev=1359639&r1=1359638&r2=1359639&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/VerifyTabletAssignments.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/VerifyTabletAssignments.java Tue Jul 10 12:39:52 2012
@@ -33,6 +33,8 @@ import java.util.concurrent.TimeUnit;
import jline.ConsoleReader;
+import org.apache.accumulo.cloudtrace.instrument.Tracer;
+import org.apache.accumulo.cloudtrace.thrift.TInfo;
import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
@@ -241,23 +243,23 @@ public class VerifyTabletAssignments {
Range r = new Range(row, true, row2, false);
batch.put(keyExtent.toThrift(), Collections.singletonList(r.toThrift()));
}
-
+ TInfo tinfo = Tracer.traceInfo();
Map<String,Map<String,String>> emptyMapSMapSS = Collections.emptyMap();
List<IterInfo> emptyListIterInfo = Collections.emptyList();
List<TColumn> emptyListColumn = Collections.emptyList();
- InitialMultiScan is = client.startMultiScan(null, st, batch, emptyListColumn, emptyListIterInfo, emptyMapSMapSS, Constants.NO_AUTHS.getAuthorizationsBB(),
+ InitialMultiScan is = client.startMultiScan(tinfo, st, batch, emptyListColumn, emptyListIterInfo, emptyMapSMapSS, Constants.NO_AUTHS.getAuthorizationsBB(),
false);
if (is.result.more) {
- MultiScanResult result = client.continueMultiScan(null, is.scanID);
+ MultiScanResult result = client.continueMultiScan(tinfo, is.scanID);
checkFailures(entry.getKey(), failures, result);
while (result.more) {
- result = client.continueMultiScan(null, is.scanID);
+ result = client.continueMultiScan(tinfo, is.scanID);
checkFailures(entry.getKey(), failures, result);
}
}
- client.closeMultiScan(null, is.scanID);
+ client.closeMultiScan(tinfo, is.scanID);
ThriftUtil.returnClient((TServiceClient) client);
}
Propchange: accumulo/trunk/src/
------------------------------------------------------------------------------
Merged /accumulo/branches/1.4/src:r1358206
Merged /accumulo/branches/1.4/src/src:r1358206
Merged /accumulo/branches/ACCUMULO-672/src:r1357826,1357829,1357842,1357858,1358236
Modified: accumulo/trunk/trace/pom.xml
URL: http://svn.apache.org/viewvc/accumulo/trunk/trace/pom.xml?rev=1359639&r1=1359638&r2=1359639&view=diff
==============================================================================
--- accumulo/trunk/trace/pom.xml (original)
+++ accumulo/trunk/trace/pom.xml Tue Jul 10 12:39:52 2012
@@ -50,15 +50,19 @@
<artifactId>libthrift</artifactId>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>zookeeper</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
</dependencies>
</project>
Modified: accumulo/trunk/trace/src/main/java/org/apache/accumulo/cloudtrace/instrument/thrift/TraceWrap.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/trace/src/main/java/org/apache/accumulo/cloudtrace/instrument/thrift/TraceWrap.java?rev=1359639&r1=1359638&r2=1359639&view=diff
==============================================================================
--- accumulo/trunk/trace/src/main/java/org/apache/accumulo/cloudtrace/instrument/thrift/TraceWrap.java (original)
+++ accumulo/trunk/trace/src/main/java/org/apache/accumulo/cloudtrace/instrument/thrift/TraceWrap.java Tue Jul 10 12:39:52 2012
@@ -25,6 +25,7 @@ import org.apache.accumulo.cloudtrace.in
import org.apache.accumulo.cloudtrace.instrument.Trace;
import org.apache.accumulo.cloudtrace.instrument.Tracer;
import org.apache.accumulo.cloudtrace.thrift.TInfo;
+import org.apache.log4j.Logger;
/**
Modified: accumulo/trunk/trace/src/main/java/org/apache/accumulo/cloudtrace/thrift/RemoteSpan.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/trace/src/main/java/org/apache/accumulo/cloudtrace/thrift/RemoteSpan.java?rev=1359639&r1=1359638&r2=1359639&view=diff
==============================================================================
--- accumulo/trunk/trace/src/main/java/org/apache/accumulo/cloudtrace/thrift/RemoteSpan.java (original)
+++ accumulo/trunk/trace/src/main/java/org/apache/accumulo/cloudtrace/thrift/RemoteSpan.java Tue Jul 10 12:39:52 2012
@@ -1,12 +1,33 @@
/**
- * Autogenerated by Thrift
+ * Autogenerated by Thrift Compiler (0.8.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
*/
package org.apache.accumulo.cloudtrace.thrift;
-public class RemoteSpan implements org.apache.thrift.TBase<RemoteSpan, RemoteSpan._Fields>, java.io.Serializable, Cloneable {
-private static final long serialVersionUID = 1L;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings("all") public class RemoteSpan implements org.apache.thrift.TBase<RemoteSpan, RemoteSpan._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RemoteSpan");
private static final org.apache.thrift.protocol.TField SENDER_FIELD_DESC = new org.apache.thrift.protocol.TField("sender", org.apache.thrift.protocol.TType.STRING, (short)1);
@@ -19,15 +40,21 @@ private static final long serialVersionU
private static final org.apache.thrift.protocol.TField DESCRIPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("description", org.apache.thrift.protocol.TType.STRING, (short)8);
private static final org.apache.thrift.protocol.TField DATA_FIELD_DESC = new org.apache.thrift.protocol.TField("data", org.apache.thrift.protocol.TType.MAP, (short)9);
- public String sender;
- public String svc;
- public long traceId;
- public long spanId;
- public long parentId;
- public long start;
- public long stop;
- public String description;
- public java.util.Map<String,String> data;
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new RemoteSpanStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new RemoteSpanTupleSchemeFactory());
+ }
+
+ public String sender; // required
+ public String svc; // required
+ public long traceId; // required
+ public long spanId; // required
+ public long parentId; // required
+ public long start; // required
+ public long stop; // required
+ public String description; // required
+ public Map<String,String> data; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
@@ -41,10 +68,10 @@ private static final long serialVersionU
DESCRIPTION((short)8, "description"),
DATA((short)9, "data");
- private static final java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
- for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
@@ -117,11 +144,10 @@ private static final long serialVersionU
private static final int __PARENTID_ISSET_ID = 2;
private static final int __START_ISSET_ID = 3;
private static final int __STOP_ISSET_ID = 4;
- private java.util.BitSet __isset_bit_vector = new java.util.BitSet(5);
-
- public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ private BitSet __isset_bit_vector = new BitSet(5);
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.SENDER, new org.apache.thrift.meta_data.FieldMetaData("sender", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.SVC, new org.apache.thrift.meta_data.FieldMetaData("svc", org.apache.thrift.TFieldRequirementType.DEFAULT,
@@ -142,7 +168,7 @@ private static final long serialVersionU
new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING),
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
- metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(RemoteSpan.class, metaDataMap);
}
@@ -158,7 +184,7 @@ private static final long serialVersionU
long start,
long stop,
String description,
- java.util.Map<String,String> data)
+ Map<String,String> data)
{
this();
this.sender = sender;
@@ -198,8 +224,8 @@ private static final long serialVersionU
this.description = other.description;
}
if (other.isSetData()) {
- java.util.Map<String,String> __this__data = new java.util.HashMap<String,String>();
- for (java.util.Map.Entry<String, String> other_element : other.data.entrySet()) {
+ Map<String,String> __this__data = new HashMap<String,String>();
+ for (Map.Entry<String, String> other_element : other.data.entrySet()) {
String other_element_key = other_element.getKey();
String other_element_value = other_element.getValue();
@@ -429,16 +455,16 @@ private static final long serialVersionU
public void putToData(String key, String val) {
if (this.data == null) {
- this.data = new java.util.HashMap<String,String>();
+ this.data = new HashMap<String,String>();
}
this.data.put(key, val);
}
- public java.util.Map<String,String> getData() {
+ public Map<String,String> getData() {
return this.data;
}
- public RemoteSpan setData(java.util.Map<String,String> data) {
+ public RemoteSpan setData(Map<String,String> data) {
this.data = data;
return this;
}
@@ -528,9 +554,7 @@ private static final long serialVersionU
if (value == null) {
unsetData();
} else {
- @SuppressWarnings("unchecked")
- java.util.Map<String,String> x = (java.util.Map<String,String>)value;
- setData(x);
+ setData((Map<String,String>)value);
}
break;
@@ -546,19 +570,19 @@ private static final long serialVersionU
return getSvc();
case TRACE_ID:
- return new Long(getTraceId());
+ return Long.valueOf(getTraceId());
case SPAN_ID:
- return new Long(getSpanId());
+ return Long.valueOf(getSpanId());
case PARENT_ID:
- return new Long(getParentId());
+ return Long.valueOf(getParentId());
case START:
- return new Long(getStart());
+ return Long.valueOf(getStart());
case STOP:
- return new Long(getStop());
+ return Long.valueOf(getStop());
case DESCRIPTION:
return getDescription();
@@ -807,155 +831,11 @@ private static final long serialVersionU
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (field.id) {
- case 1: // SENDER
- if (field.type == org.apache.thrift.protocol.TType.STRING) {
- this.sender = iprot.readString();
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 2: // SVC
- if (field.type == org.apache.thrift.protocol.TType.STRING) {
- this.svc = iprot.readString();
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 3: // TRACE_ID
- if (field.type == org.apache.thrift.protocol.TType.I64) {
- this.traceId = iprot.readI64();
- setTraceIdIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 4: // SPAN_ID
- if (field.type == org.apache.thrift.protocol.TType.I64) {
- this.spanId = iprot.readI64();
- setSpanIdIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 5: // PARENT_ID
- if (field.type == org.apache.thrift.protocol.TType.I64) {
- this.parentId = iprot.readI64();
- setParentIdIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 6: // START
- if (field.type == org.apache.thrift.protocol.TType.I64) {
- this.start = iprot.readI64();
- setStartIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 7: // STOP
- if (field.type == org.apache.thrift.protocol.TType.I64) {
- this.stop = iprot.readI64();
- setStopIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 8: // DESCRIPTION
- if (field.type == org.apache.thrift.protocol.TType.STRING) {
- this.description = iprot.readString();
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 9: // DATA
- if (field.type == org.apache.thrift.protocol.TType.MAP) {
- {
- org.apache.thrift.protocol.TMap _map0 = iprot.readMapBegin();
- this.data = new java.util.HashMap<String,String>(2*_map0.size);
- for (int _i1 = 0; _i1 < _map0.size; ++_i1)
- {
- String _key2;
- String _val3;
- _key2 = iprot.readString();
- _val3 = iprot.readString();
- this.data.put(_key2, _val3);
- }
- iprot.readMapEnd();
- }
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- validate();
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (this.sender != null) {
- oprot.writeFieldBegin(SENDER_FIELD_DESC);
- oprot.writeString(this.sender);
- oprot.writeFieldEnd();
- }
- if (this.svc != null) {
- oprot.writeFieldBegin(SVC_FIELD_DESC);
- oprot.writeString(this.svc);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldBegin(TRACE_ID_FIELD_DESC);
- oprot.writeI64(this.traceId);
- oprot.writeFieldEnd();
- oprot.writeFieldBegin(SPAN_ID_FIELD_DESC);
- oprot.writeI64(this.spanId);
- oprot.writeFieldEnd();
- oprot.writeFieldBegin(PARENT_ID_FIELD_DESC);
- oprot.writeI64(this.parentId);
- oprot.writeFieldEnd();
- oprot.writeFieldBegin(START_FIELD_DESC);
- oprot.writeI64(this.start);
- oprot.writeFieldEnd();
- oprot.writeFieldBegin(STOP_FIELD_DESC);
- oprot.writeI64(this.stop);
- oprot.writeFieldEnd();
- if (this.description != null) {
- oprot.writeFieldBegin(DESCRIPTION_FIELD_DESC);
- oprot.writeString(this.description);
- oprot.writeFieldEnd();
- }
- if (this.data != null) {
- oprot.writeFieldBegin(DATA_FIELD_DESC);
- {
- oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, this.data.size()));
- for (java.util.Map.Entry<String, String> _iter4 : this.data.entrySet())
- {
- oprot.writeString(_iter4.getKey());
- oprot.writeString(_iter4.getValue());
- }
- oprot.writeMapEnd();
- }
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -1033,12 +913,308 @@ private static final long serialVersionU
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
- __isset_bit_vector = new java.util.BitSet(1);
+ __isset_bit_vector = new BitSet(1);
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
+ private static class RemoteSpanStandardSchemeFactory implements SchemeFactory {
+ public RemoteSpanStandardScheme getScheme() {
+ return new RemoteSpanStandardScheme();
+ }
+ }
+
+ private static class RemoteSpanStandardScheme extends StandardScheme<RemoteSpan> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, RemoteSpan struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // SENDER
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.sender = iprot.readString();
+ struct.setSenderIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // SVC
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.svc = iprot.readString();
+ struct.setSvcIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // TRACE_ID
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.traceId = iprot.readI64();
+ struct.setTraceIdIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // SPAN_ID
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.spanId = iprot.readI64();
+ struct.setSpanIdIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 5: // PARENT_ID
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.parentId = iprot.readI64();
+ struct.setParentIdIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 6: // START
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.start = iprot.readI64();
+ struct.setStartIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 7: // STOP
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.stop = iprot.readI64();
+ struct.setStopIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 8: // DESCRIPTION
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.description = iprot.readString();
+ struct.setDescriptionIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 9: // DATA
+ if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
+ {
+ org.apache.thrift.protocol.TMap _map0 = iprot.readMapBegin();
+ struct.data = new HashMap<String,String>(2*_map0.size);
+ for (int _i1 = 0; _i1 < _map0.size; ++_i1)
+ {
+ String _key2; // required
+ String _val3; // required
+ _key2 = iprot.readString();
+ _val3 = iprot.readString();
+ struct.data.put(_key2, _val3);
+ }
+ iprot.readMapEnd();
+ }
+ struct.setDataIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+
+ // check for required fields of primitive type, which can't be checked in the validate method
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, RemoteSpan struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.sender != null) {
+ oprot.writeFieldBegin(SENDER_FIELD_DESC);
+ oprot.writeString(struct.sender);
+ oprot.writeFieldEnd();
+ }
+ if (struct.svc != null) {
+ oprot.writeFieldBegin(SVC_FIELD_DESC);
+ oprot.writeString(struct.svc);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldBegin(TRACE_ID_FIELD_DESC);
+ oprot.writeI64(struct.traceId);
+ oprot.writeFieldEnd();
+ oprot.writeFieldBegin(SPAN_ID_FIELD_DESC);
+ oprot.writeI64(struct.spanId);
+ oprot.writeFieldEnd();
+ oprot.writeFieldBegin(PARENT_ID_FIELD_DESC);
+ oprot.writeI64(struct.parentId);
+ oprot.writeFieldEnd();
+ oprot.writeFieldBegin(START_FIELD_DESC);
+ oprot.writeI64(struct.start);
+ oprot.writeFieldEnd();
+ oprot.writeFieldBegin(STOP_FIELD_DESC);
+ oprot.writeI64(struct.stop);
+ oprot.writeFieldEnd();
+ if (struct.description != null) {
+ oprot.writeFieldBegin(DESCRIPTION_FIELD_DESC);
+ oprot.writeString(struct.description);
+ oprot.writeFieldEnd();
+ }
+ if (struct.data != null) {
+ oprot.writeFieldBegin(DATA_FIELD_DESC);
+ {
+ oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.data.size()));
+ for (Map.Entry<String, String> _iter4 : struct.data.entrySet())
+ {
+ oprot.writeString(_iter4.getKey());
+ oprot.writeString(_iter4.getValue());
+ }
+ oprot.writeMapEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class RemoteSpanTupleSchemeFactory implements SchemeFactory {
+ public RemoteSpanTupleScheme getScheme() {
+ return new RemoteSpanTupleScheme();
+ }
+ }
+
+ private static class RemoteSpanTupleScheme extends TupleScheme<RemoteSpan> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, RemoteSpan struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetSender()) {
+ optionals.set(0);
+ }
+ if (struct.isSetSvc()) {
+ optionals.set(1);
+ }
+ if (struct.isSetTraceId()) {
+ optionals.set(2);
+ }
+ if (struct.isSetSpanId()) {
+ optionals.set(3);
+ }
+ if (struct.isSetParentId()) {
+ optionals.set(4);
+ }
+ if (struct.isSetStart()) {
+ optionals.set(5);
+ }
+ if (struct.isSetStop()) {
+ optionals.set(6);
+ }
+ if (struct.isSetDescription()) {
+ optionals.set(7);
+ }
+ if (struct.isSetData()) {
+ optionals.set(8);
+ }
+ oprot.writeBitSet(optionals, 9);
+ if (struct.isSetSender()) {
+ oprot.writeString(struct.sender);
+ }
+ if (struct.isSetSvc()) {
+ oprot.writeString(struct.svc);
+ }
+ if (struct.isSetTraceId()) {
+ oprot.writeI64(struct.traceId);
+ }
+ if (struct.isSetSpanId()) {
+ oprot.writeI64(struct.spanId);
+ }
+ if (struct.isSetParentId()) {
+ oprot.writeI64(struct.parentId);
+ }
+ if (struct.isSetStart()) {
+ oprot.writeI64(struct.start);
+ }
+ if (struct.isSetStop()) {
+ oprot.writeI64(struct.stop);
+ }
+ if (struct.isSetDescription()) {
+ oprot.writeString(struct.description);
+ }
+ if (struct.isSetData()) {
+ {
+ oprot.writeI32(struct.data.size());
+ for (Map.Entry<String, String> _iter5 : struct.data.entrySet())
+ {
+ oprot.writeString(_iter5.getKey());
+ oprot.writeString(_iter5.getValue());
+ }
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, RemoteSpan struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(9);
+ if (incoming.get(0)) {
+ struct.sender = iprot.readString();
+ struct.setSenderIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.svc = iprot.readString();
+ struct.setSvcIsSet(true);
+ }
+ if (incoming.get(2)) {
+ struct.traceId = iprot.readI64();
+ struct.setTraceIdIsSet(true);
+ }
+ if (incoming.get(3)) {
+ struct.spanId = iprot.readI64();
+ struct.setSpanIdIsSet(true);
+ }
+ if (incoming.get(4)) {
+ struct.parentId = iprot.readI64();
+ struct.setParentIdIsSet(true);
+ }
+ if (incoming.get(5)) {
+ struct.start = iprot.readI64();
+ struct.setStartIsSet(true);
+ }
+ if (incoming.get(6)) {
+ struct.stop = iprot.readI64();
+ struct.setStopIsSet(true);
+ }
+ if (incoming.get(7)) {
+ struct.description = iprot.readString();
+ struct.setDescriptionIsSet(true);
+ }
+ if (incoming.get(8)) {
+ {
+ org.apache.thrift.protocol.TMap _map6 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+ struct.data = new HashMap<String,String>(2*_map6.size);
+ for (int _i7 = 0; _i7 < _map6.size; ++_i7)
+ {
+ String _key8; // required
+ String _val9; // required
+ _key8 = iprot.readString();
+ _val9 = iprot.readString();
+ struct.data.put(_key8, _val9);
+ }
+ }
+ struct.setDataIsSet(true);
+ }
+ }
+ }
+
}
Modified: accumulo/trunk/trace/src/main/java/org/apache/accumulo/cloudtrace/thrift/SpanReceiver.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/trace/src/main/java/org/apache/accumulo/cloudtrace/thrift/SpanReceiver.java?rev=1359639&r1=1359638&r2=1359639&view=diff
==============================================================================
--- accumulo/trunk/trace/src/main/java/org/apache/accumulo/cloudtrace/thrift/SpanReceiver.java (original)
+++ accumulo/trunk/trace/src/main/java/org/apache/accumulo/cloudtrace/thrift/SpanReceiver.java Tue Jul 10 12:39:52 2012
@@ -1,11 +1,33 @@
/**
- * Autogenerated by Thrift
+ * Autogenerated by Thrift Compiler (0.8.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
*/
package org.apache.accumulo.cloudtrace.thrift;
-public class SpanReceiver {
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings("all") public class SpanReceiver {
public interface Iface {
@@ -19,7 +41,7 @@ public class SpanReceiver {
}
- public static class Client implements org.apache.thrift.TServiceClient, Iface {
+ public static class Client extends org.apache.thrift.TServiceClient implements Iface {
public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
public Factory() {}
public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
@@ -32,28 +54,11 @@ public class SpanReceiver {
public Client(org.apache.thrift.protocol.TProtocol prot)
{
- this(prot, prot);
- }
-
- public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot)
- {
- iprot_ = iprot;
- oprot_ = oprot;
+ super(prot, prot);
}
- protected org.apache.thrift.protocol.TProtocol iprot_;
- protected org.apache.thrift.protocol.TProtocol oprot_;
-
- protected int seqid_;
-
- public org.apache.thrift.protocol.TProtocol getInputProtocol()
- {
- return this.iprot_;
- }
-
- public org.apache.thrift.protocol.TProtocol getOutputProtocol()
- {
- return this.oprot_;
+ public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
+ super(iprot, oprot);
}
public void span(RemoteSpan span) throws org.apache.thrift.TException
@@ -63,12 +68,9 @@ public class SpanReceiver {
public void send_span(RemoteSpan span) throws org.apache.thrift.TException
{
- oprot_.writeMessageBegin(new org.apache.thrift.protocol.TMessage("span", org.apache.thrift.protocol.TMessageType.CALL, ++seqid_));
span_args args = new span_args();
args.setSpan(span);
- args.write(oprot_);
- oprot_.writeMessageEnd();
- oprot_.getTransport().flush();
+ sendBase("span", args);
}
}
@@ -91,15 +93,13 @@ public class SpanReceiver {
public void span(RemoteSpan span, org.apache.thrift.async.AsyncMethodCallback<span_call> resultHandler) throws org.apache.thrift.TException {
checkReady();
- span_call method_call = new span_call(span, resultHandler, this, protocolFactory, transport);
- this.currentMethod = method_call;
- manager.call(method_call);
+ span_call method_call = new span_call(span, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
}
- @SuppressWarnings("rawtypes")
public static class span_call extends org.apache.thrift.async.TAsyncMethodCall {
private RemoteSpan span;
- @SuppressWarnings("unchecked")
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 {
super(client, protocolFactory, transport, resultHandler, true);
this.span = span;
@@ -117,83 +117,66 @@ public class SpanReceiver {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
+ org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+ org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
}
}
}
- public static class Processor implements org.apache.thrift.TProcessor {
- private static final org.slf4j.Logger LOGGER = org.slf4j.LoggerFactory.getLogger(Processor.class.getName());
- public Processor(Iface iface)
- {
- iface_ = iface;
- processMap_.put("span", new span());
+ public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
+ private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
+ public Processor(I iface) {
+ super(iface, getProcessMap(new HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
}
- protected static interface ProcessFunction {
- public void process(int seqid, org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException;
+ protected Processor(I iface, Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
+ super(iface, getProcessMap(processMap));
}
- private Iface iface_;
- protected final java.util.HashMap<String,ProcessFunction> processMap_ = new java.util.HashMap<String,ProcessFunction>();
+ private static <I extends Iface> Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> getProcessMap(Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
+ processMap.put("span", new span());
+ return processMap;
+ }
- public boolean process(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException
- {
- org.apache.thrift.protocol.TMessage msg = iprot.readMessageBegin();
- ProcessFunction fn = processMap_.get(msg.name);
- if (fn == null) {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, org.apache.thrift.protocol.TType.STRUCT);
- iprot.readMessageEnd();
- org.apache.thrift.TApplicationException x = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.UNKNOWN_METHOD, "Invalid method name: '"+msg.name+"'");
- oprot.writeMessageBegin(new org.apache.thrift.protocol.TMessage(msg.name, org.apache.thrift.protocol.TMessageType.EXCEPTION, msg.seqid));
- x.write(oprot);
- oprot.writeMessageEnd();
- oprot.getTransport().flush();
- return true;
+ private static class span<I extends Iface> extends org.apache.thrift.ProcessFunction<I, span_args> {
+ public span() {
+ super("span");
}
- fn.process(msg.seqid, iprot, oprot);
- return true;
- }
- private class span implements ProcessFunction {
- public void process(int seqid, org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException
- {
- span_args args = new span_args();
- try {
- args.read(iprot);
- } catch (org.apache.thrift.protocol.TProtocolException e) {
- iprot.readMessageEnd();
- org.apache.thrift.TApplicationException x = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.PROTOCOL_ERROR, e.getMessage());
- oprot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("span", org.apache.thrift.protocol.TMessageType.EXCEPTION, seqid));
- x.write(oprot);
- oprot.writeMessageEnd();
- oprot.getTransport().flush();
- return;
- }
- iprot.readMessageEnd();
- iface_.span(args.span);
- return;
+ protected span_args getEmptyArgsInstance() {
+ return new span_args();
+ }
+
+ protected org.apache.thrift.TBase getResult(I iface, span_args args) throws org.apache.thrift.TException {
+ iface.span(args.span);
+ return null;
}
}
}
public static class span_args implements org.apache.thrift.TBase<span_args, span_args._Fields>, java.io.Serializable, Cloneable {
-private static final long serialVersionUID = 1L;
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);
- public RemoteSpan span;
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new span_argsStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new span_argsTupleSchemeFactory());
+ }
+
+ public RemoteSpan span; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
SPAN((short)1, "span");
- private static final java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
- for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
@@ -245,13 +228,12 @@ private static final long serialVersionU
}
// isset id assignments
-
- public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.SPAN, new org.apache.thrift.meta_data.FieldMetaData("span", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, RemoteSpan.class)));
- metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(span_args.class, metaDataMap);
}
@@ -398,56 +380,25 @@ private static final long serialVersionU
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (field.id) {
- case 1: // SPAN
- if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
- this.span = new RemoteSpan();
- this.span.read(iprot);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- validate();
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (this.span != null) {
- oprot.writeFieldBegin(SPAN_FIELD_DESC);
- this.span.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("span_args(");
+ boolean first = true;
+
sb.append("span:");
if (this.span == null) {
sb.append("null");
} else {
sb.append(this.span);
}
+ first = false;
sb.append(")");
return sb.toString();
}
@@ -472,6 +423,92 @@ private static final long serialVersionU
}
}
+ private static class span_argsStandardSchemeFactory implements SchemeFactory {
+ public span_argsStandardScheme getScheme() {
+ return new span_argsStandardScheme();
+ }
+ }
+
+ private static class span_argsStandardScheme extends StandardScheme<span_args> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, span_args struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // SPAN
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.span = new RemoteSpan();
+ struct.span.read(iprot);
+ struct.setSpanIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+
+ // check for required fields of primitive type, which can't be checked in the validate method
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, span_args struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.span != null) {
+ oprot.writeFieldBegin(SPAN_FIELD_DESC);
+ struct.span.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class span_argsTupleSchemeFactory implements SchemeFactory {
+ public span_argsTupleScheme getScheme() {
+ return new span_argsTupleScheme();
+ }
+ }
+
+ private static class span_argsTupleScheme extends TupleScheme<span_args> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, span_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetSpan()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetSpan()) {
+ struct.span.write(oprot);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, span_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.span = new RemoteSpan();
+ struct.span.read(iprot);
+ struct.setSpanIsSet(true);
+ }
+ }
+ }
+
}
}
Modified: accumulo/trunk/trace/src/main/java/org/apache/accumulo/cloudtrace/thrift/TInfo.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/trace/src/main/java/org/apache/accumulo/cloudtrace/thrift/TInfo.java?rev=1359639&r1=1359638&r2=1359639&view=diff
==============================================================================
--- accumulo/trunk/trace/src/main/java/org/apache/accumulo/cloudtrace/thrift/TInfo.java (original)
+++ accumulo/trunk/trace/src/main/java/org/apache/accumulo/cloudtrace/thrift/TInfo.java Tue Jul 10 12:39:52 2012
@@ -1,29 +1,56 @@
/**
- * Autogenerated by Thrift
+ * Autogenerated by Thrift Compiler (0.8.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
*/
package org.apache.accumulo.cloudtrace.thrift;
-public class TInfo implements org.apache.thrift.TBase<TInfo, TInfo._Fields>, java.io.Serializable, Cloneable {
-private static final long serialVersionUID = 1L;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+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 {
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);
private static final org.apache.thrift.protocol.TField PARENT_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("parentId", org.apache.thrift.protocol.TType.I64, (short)2);
- public long traceId;
- public long parentId;
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TInfoStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TInfoTupleSchemeFactory());
+ }
+
+ public long traceId; // required
+ public long parentId; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
TRACE_ID((short)1, "traceId"),
PARENT_ID((short)2, "parentId");
- private static final java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>();
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
- for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
@@ -79,16 +106,15 @@ private static final long serialVersionU
// isset id assignments
private static final int __TRACEID_ISSET_ID = 0;
private static final int __PARENTID_ISSET_ID = 1;
- private java.util.BitSet __isset_bit_vector = new java.util.BitSet(2);
-
- public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ private BitSet __isset_bit_vector = new BitSet(2);
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.TRACE_ID, new org.apache.thrift.meta_data.FieldMetaData("traceId", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
tmpMap.put(_Fields.PARENT_ID, new org.apache.thrift.meta_data.FieldMetaData("parentId", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
- metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TInfo.class, metaDataMap);
}
@@ -198,10 +224,10 @@ private static final long serialVersionU
public Object getFieldValue(_Fields field) {
switch (field) {
case TRACE_ID:
- return new Long(getTraceId());
+ return Long.valueOf(getTraceId());
case PARENT_ID:
- return new Long(getParentId());
+ return Long.valueOf(getParentId());
}
throw new IllegalStateException();
@@ -297,54 +323,11 @@ private static final long serialVersionU
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (field.id) {
- case 1: // TRACE_ID
- if (field.type == org.apache.thrift.protocol.TType.I64) {
- this.traceId = iprot.readI64();
- setTraceIdIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 2: // PARENT_ID
- if (field.type == org.apache.thrift.protocol.TType.I64) {
- this.parentId = iprot.readI64();
- setParentIdIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- validate();
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- oprot.writeFieldBegin(TRACE_ID_FIELD_DESC);
- oprot.writeI64(this.traceId);
- oprot.writeFieldEnd();
- oprot.writeFieldBegin(PARENT_ID_FIELD_DESC);
- oprot.writeI64(this.parentId);
- oprot.writeFieldEnd();
- oprot.writeFieldStop();
- oprot.writeStructEnd();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -378,12 +361,115 @@ private static final long serialVersionU
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
- __isset_bit_vector = new java.util.BitSet(1);
+ __isset_bit_vector = new BitSet(1);
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
+ private static class TInfoStandardSchemeFactory implements SchemeFactory {
+ public TInfoStandardScheme getScheme() {
+ return new TInfoStandardScheme();
+ }
+ }
+
+ private static class TInfoStandardScheme extends StandardScheme<TInfo> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TInfo struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // TRACE_ID
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.traceId = iprot.readI64();
+ struct.setTraceIdIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // PARENT_ID
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.parentId = iprot.readI64();
+ struct.setParentIdIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+
+ // check for required fields of primitive type, which can't be checked in the validate method
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, TInfo struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(TRACE_ID_FIELD_DESC);
+ oprot.writeI64(struct.traceId);
+ oprot.writeFieldEnd();
+ oprot.writeFieldBegin(PARENT_ID_FIELD_DESC);
+ oprot.writeI64(struct.parentId);
+ oprot.writeFieldEnd();
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TInfoTupleSchemeFactory implements SchemeFactory {
+ public TInfoTupleScheme getScheme() {
+ return new TInfoTupleScheme();
+ }
+ }
+
+ private static class TInfoTupleScheme extends TupleScheme<TInfo> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TInfo struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetTraceId()) {
+ optionals.set(0);
+ }
+ if (struct.isSetParentId()) {
+ optionals.set(1);
+ }
+ oprot.writeBitSet(optionals, 2);
+ if (struct.isSetTraceId()) {
+ oprot.writeI64(struct.traceId);
+ }
+ if (struct.isSetParentId()) {
+ oprot.writeI64(struct.parentId);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TInfo struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(2);
+ if (incoming.get(0)) {
+ struct.traceId = iprot.readI64();
+ struct.setTraceIdIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.parentId = iprot.readI64();
+ struct.setParentIdIsSet(true);
+ }
+ }
+ }
+
}