You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flume.apache.org by mp...@apache.org on 2013/04/08 07:05:04 UTC
[2/2] git commit: FLUME-1974. Thrift compatibility issue with
hbase-0.92.
FLUME-1974. Thrift compatibility issue with hbase-0.92.
(Hari Shreedharan via Mike Percy)
Project: http://git-wip-us.apache.org/repos/asf/flume/repo
Commit: http://git-wip-us.apache.org/repos/asf/flume/commit/c72a3b1a
Tree: http://git-wip-us.apache.org/repos/asf/flume/tree/c72a3b1a
Diff: http://git-wip-us.apache.org/repos/asf/flume/diff/c72a3b1a
Branch: refs/heads/trunk
Commit: c72a3b1a5a2548f9157fe7913611c4318ce5e64d
Parents: 6ca6168
Author: Mike Percy <mp...@apache.org>
Authored: Sun Apr 7 22:04:22 2013 -0700
Committer: Mike Percy <mp...@apache.org>
Committed: Sun Apr 7 22:04:22 2013 -0700
----------------------------------------------------------------------
.../java/org/apache/flume/source/ThriftSource.java | 37 +-
.../flume/handlers/thrift/EventStatus.java | 3 +-
.../cloudera/flume/handlers/thrift/Priority.java | 3 +-
.../flume/handlers/thrift/ThriftFlumeEvent.java | 388 +++-------
.../handlers/thrift/ThriftFlumeEventServer.java | 351 +++------
.../main/java/org/apache/flume/thrift/Status.java | 3 +-
.../org/apache/flume/thrift/ThriftFlumeEvent.java | 217 ++----
.../apache/flume/thrift/ThriftSourceProtocol.java | 606 ++++-----------
.../org/apache/flume/source/scribe/LogEntry.java | 176 ++---
.../org/apache/flume/source/scribe/ResultCode.java | 3 +-
.../org/apache/flume/source/scribe/Scribe.java | 333 +++------
pom.xml | 2 +-
12 files changed, 619 insertions(+), 1503 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flume/blob/c72a3b1a/flume-ng-core/src/main/java/org/apache/flume/source/ThriftSource.java
----------------------------------------------------------------------
diff --git a/flume-ng-core/src/main/java/org/apache/flume/source/ThriftSource.java b/flume-ng-core/src/main/java/org/apache/flume/source/ThriftSource.java
index 979fd35..5856e90 100644
--- a/flume-ng-core/src/main/java/org/apache/flume/source/ThriftSource.java
+++ b/flume-ng-core/src/main/java/org/apache/flume/source/ThriftSource.java
@@ -29,15 +29,16 @@ import org.apache.flume.FlumeException;
import org.apache.flume.conf.Configurable;
import org.apache.flume.event.EventBuilder;
import org.apache.flume.instrumentation.SourceCounter;
-import org.apache.flume.lifecycle.LifecycleState;
import org.apache.flume.thrift.Status;
import org.apache.flume.thrift.ThriftSourceProtocol;
import org.apache.flume.thrift.ThriftFlumeEvent;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TCompactProtocol;
import org.apache.thrift.server.TServer;
-import org.apache.thrift.server.TThreadedSelectorServer;
-import org.apache.thrift.transport.TNonblockingServerSocket;
+import org.apache.thrift.server.TThreadPoolServer;
+import org.apache.thrift.transport.TFastFramedTransport;
+import org.apache.thrift.transport.TServerSocket;
+import org.apache.thrift.transport.TServerTransport;
import org.apache.thrift.transport.TTransportException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -46,7 +47,6 @@ import java.net.InetSocketAddress;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
public class ThriftSource extends AbstractSource implements Configurable,
@@ -72,7 +72,7 @@ public class ThriftSource extends AbstractSource implements Configurable,
private int maxThreads = 0;
private SourceCounter sourceCounter;
private TServer server;
- private TNonblockingServerSocket serverTransport;
+ private TServerTransport serverTransport;
private ExecutorService servingExecutor;
@Override
@@ -100,29 +100,27 @@ public class ThriftSource extends AbstractSource implements Configurable,
@Override
public void start() {
logger.info("Starting thrift source");
- ExecutorService sourceService;
- ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat(
- "Flume Thrift IPC Thread %d").build();
- if (maxThreads == 0) {
- sourceService = Executors.newCachedThreadPool(threadFactory);
- } else {
- sourceService = Executors.newFixedThreadPool(maxThreads, threadFactory);
- }
+ maxThreads = (maxThreads <= 0) ? Integer.MAX_VALUE : maxThreads;
try {
- serverTransport = new TNonblockingServerSocket(new InetSocketAddress
+ serverTransport = new TServerSocket(new InetSocketAddress
(bindAddress, port));
} catch (TTransportException e) {
throw new FlumeException("Failed to start Thrift Source.", e);
}
- server = new TThreadedSelectorServer(
- new TThreadedSelectorServer.Args(serverTransport).protocolFactory(
- new TCompactProtocol.Factory()).processor(
- new ThriftSourceProtocol.Processor<ThriftSourceHandler>(
- new ThriftSourceHandler())).executorService(sourceService));
+
+ TThreadPoolServer.Args args = new TThreadPoolServer.Args(serverTransport);
+ args.protocolFactory(new TCompactProtocol.Factory());
+ args.inputTransportFactory(new TFastFramedTransport.Factory());
+ args.outputTransportFactory(new TFastFramedTransport.Factory());
+ args.processor(new ThriftSourceProtocol.Processor<ThriftSourceHandler>(
+ new ThriftSourceHandler())).maxWorkerThreads(maxThreads);
+
+ server = new TThreadPoolServer(args);
servingExecutor = Executors.newSingleThreadExecutor(new
ThreadFactoryBuilder().setNameFormat("Flume Thrift Source I/O Boss")
.build());
+
/**
* Start serving.
*/
@@ -165,7 +163,6 @@ public class ThriftSource extends AbstractSource implements Configurable,
"shutdown.");
}
sourceCounter.stop();
- // Thrift will shutdown the executor passed to it.
super.stop();
}
http://git-wip-us.apache.org/repos/asf/flume/blob/c72a3b1a/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/EventStatus.java
----------------------------------------------------------------------
diff --git a/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/EventStatus.java b/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/EventStatus.java
index 549ea16..7af9e77 100644
--- a/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/EventStatus.java
+++ b/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/EventStatus.java
@@ -17,10 +17,9 @@
* under the License.
*/
/**
- * Autogenerated by Thrift Compiler (0.9.0)
+ * Autogenerated by Thrift Compiler (0.7.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
*/
package com.cloudera.flume.handlers.thrift;
http://git-wip-us.apache.org/repos/asf/flume/blob/c72a3b1a/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/Priority.java
----------------------------------------------------------------------
diff --git a/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/Priority.java b/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/Priority.java
index 6879817..40826dc 100644
--- a/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/Priority.java
+++ b/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/Priority.java
@@ -17,10 +17,9 @@
* under the License.
*/
/**
- * Autogenerated by Thrift Compiler (0.9.0)
+ * Autogenerated by Thrift Compiler (0.7.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
*/
package com.cloudera.flume.handlers.thrift;
http://git-wip-us.apache.org/repos/asf/flume/blob/c72a3b1a/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/ThriftFlumeEvent.java
----------------------------------------------------------------------
diff --git a/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/ThriftFlumeEvent.java b/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/ThriftFlumeEvent.java
index 418c376..f83cba4 100644
--- a/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/ThriftFlumeEvent.java
+++ b/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/ThriftFlumeEvent.java
@@ -17,23 +17,13 @@
* under the License.
*/
/**
- * Autogenerated by Thrift Compiler (0.9.0)
+ * Autogenerated by Thrift Compiler (0.7.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
*/
package com.cloudera.flume.handlers.thrift;
import org.apache.commons.lang.builder.HashCodeBuilder;
-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 org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
@@ -49,7 +39,6 @@ import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@Deprecated
public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEvent, ThriftFlumeEvent._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ThriftFlumeEvent");
@@ -60,12 +49,6 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven
private static final org.apache.thrift.protocol.TField HOST_FIELD_DESC = new org.apache.thrift.protocol.TField("host", org.apache.thrift.protocol.TType.STRING, (short)5);
private static final org.apache.thrift.protocol.TField FIELDS_FIELD_DESC = new org.apache.thrift.protocol.TField("fields", org.apache.thrift.protocol.TType.MAP, (short)6);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new ThriftFlumeEventStandardSchemeFactory());
- schemes.put(TupleScheme.class, new ThriftFlumeEventTupleSchemeFactory());
- }
-
public long timestamp; // required
/**
*
@@ -157,7 +140,8 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven
// isset id assignments
private static final int __TIMESTAMP_ISSET_ID = 0;
private static final int __NANOS_ISSET_ID = 1;
- private byte __isset_bitfield = 0;
+ private BitSet __isset_bit_vector = new BitSet(2);
+
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
@@ -205,7 +189,8 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven
* Performs a deep copy on <i>other</i>.
*/
public ThriftFlumeEvent(ThriftFlumeEvent other) {
- __isset_bitfield = other.__isset_bitfield;
+ __isset_bit_vector.clear();
+ __isset_bit_vector.or(other.__isset_bit_vector);
this.timestamp = other.timestamp;
if (other.isSetPriority()) {
this.priority = other.priority;
@@ -263,16 +248,16 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven
}
public void unsetTimestamp() {
- __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TIMESTAMP_ISSET_ID);
+ __isset_bit_vector.clear(__TIMESTAMP_ISSET_ID);
}
/** Returns true if field timestamp is set (has been assigned a value) and false otherwise */
public boolean isSetTimestamp() {
- return EncodingUtils.testBit(__isset_bitfield, __TIMESTAMP_ISSET_ID);
+ return __isset_bit_vector.get(__TIMESTAMP_ISSET_ID);
}
public void setTimestampIsSet(boolean value) {
- __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TIMESTAMP_ISSET_ID, value);
+ __isset_bit_vector.set(__TIMESTAMP_ISSET_ID, value);
}
/**
@@ -352,16 +337,16 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven
}
public void unsetNanos() {
- __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __NANOS_ISSET_ID);
+ __isset_bit_vector.clear(__NANOS_ISSET_ID);
}
/** Returns true if field nanos is set (has been assigned a value) and false otherwise */
public boolean isSetNanos() {
- return EncodingUtils.testBit(__isset_bitfield, __NANOS_ISSET_ID);
+ return __isset_bit_vector.get(__NANOS_ISSET_ID);
}
public void setNanosIsSet(boolean value) {
- __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __NANOS_ISSET_ID, value);
+ __isset_bit_vector.set(__NANOS_ISSET_ID, value);
}
public String getHost() {
@@ -706,11 +691,122 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ 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: // TIMESTAMP
+ if (field.type == org.apache.thrift.protocol.TType.I64) {
+ this.timestamp = iprot.readI64();
+ setTimestampIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ case 2: // PRIORITY
+ if (field.type == org.apache.thrift.protocol.TType.I32) {
+ this.priority = Priority.findByValue(iprot.readI32());
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ case 3: // BODY
+ if (field.type == org.apache.thrift.protocol.TType.STRING) {
+ this.body = iprot.readBinary();
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ case 4: // NANOS
+ if (field.type == org.apache.thrift.protocol.TType.I64) {
+ this.nanos = iprot.readI64();
+ setNanosIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ case 5: // HOST
+ if (field.type == org.apache.thrift.protocol.TType.STRING) {
+ this.host = iprot.readString();
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ case 6: // FIELDS
+ if (field.type == org.apache.thrift.protocol.TType.MAP) {
+ {
+ org.apache.thrift.protocol.TMap _map0 = iprot.readMapBegin();
+ this.fields = new HashMap<String,ByteBuffer>(2*_map0.size);
+ for (int _i1 = 0; _i1 < _map0.size; ++_i1)
+ {
+ String _key2; // required
+ ByteBuffer _val3; // required
+ _key2 = iprot.readString();
+ _val3 = iprot.readBinary();
+ this.fields.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();
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+ validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
+ oprot.writeI64(this.timestamp);
+ oprot.writeFieldEnd();
+ if (this.priority != null) {
+ oprot.writeFieldBegin(PRIORITY_FIELD_DESC);
+ oprot.writeI32(this.priority.getValue());
+ oprot.writeFieldEnd();
+ }
+ if (this.body != null) {
+ oprot.writeFieldBegin(BODY_FIELD_DESC);
+ oprot.writeBinary(this.body);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldBegin(NANOS_FIELD_DESC);
+ oprot.writeI64(this.nanos);
+ oprot.writeFieldEnd();
+ if (this.host != null) {
+ oprot.writeFieldBegin(HOST_FIELD_DESC);
+ oprot.writeString(this.host);
+ oprot.writeFieldEnd();
+ }
+ if (this.fields != null) {
+ oprot.writeFieldBegin(FIELDS_FIELD_DESC);
+ {
+ oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, this.fields.size()));
+ for (Map.Entry<String, ByteBuffer> _iter4 : this.fields.entrySet())
+ {
+ oprot.writeString(_iter4.getKey());
+ oprot.writeBinary(_iter4.getValue());
+ }
+ oprot.writeMapEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
}
@Override
@@ -763,7 +859,6 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven
public void validate() throws org.apache.thrift.TException {
// check for required fields
- // check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -777,245 +872,12 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven
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_bitfield = 0;
+ __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 ThriftFlumeEventStandardSchemeFactory implements SchemeFactory {
- public ThriftFlumeEventStandardScheme getScheme() {
- return new ThriftFlumeEventStandardScheme();
- }
- }
-
- private static class ThriftFlumeEventStandardScheme extends StandardScheme<ThriftFlumeEvent> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, ThriftFlumeEvent 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: // TIMESTAMP
- if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
- struct.timestamp = iprot.readI64();
- struct.setTimestampIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 2: // PRIORITY
- if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
- struct.priority = Priority.findByValue(iprot.readI32());
- struct.setPriorityIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // BODY
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.body = iprot.readBinary();
- struct.setBodyIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 4: // NANOS
- if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
- struct.nanos = iprot.readI64();
- struct.setNanosIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 5: // HOST
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.host = iprot.readString();
- struct.setHostIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 6: // FIELDS
- if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
- {
- org.apache.thrift.protocol.TMap _map0 = iprot.readMapBegin();
- struct.fields = new HashMap<String,ByteBuffer>(2*_map0.size);
- for (int _i1 = 0; _i1 < _map0.size; ++_i1)
- {
- String _key2; // required
- ByteBuffer _val3; // required
- _key2 = iprot.readString();
- _val3 = iprot.readBinary();
- struct.fields.put(_key2, _val3);
- }
- iprot.readMapEnd();
- }
- struct.setFieldsIsSet(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, ThriftFlumeEvent struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
- oprot.writeI64(struct.timestamp);
- oprot.writeFieldEnd();
- if (struct.priority != null) {
- oprot.writeFieldBegin(PRIORITY_FIELD_DESC);
- oprot.writeI32(struct.priority.getValue());
- oprot.writeFieldEnd();
- }
- if (struct.body != null) {
- oprot.writeFieldBegin(BODY_FIELD_DESC);
- oprot.writeBinary(struct.body);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldBegin(NANOS_FIELD_DESC);
- oprot.writeI64(struct.nanos);
- oprot.writeFieldEnd();
- if (struct.host != null) {
- oprot.writeFieldBegin(HOST_FIELD_DESC);
- oprot.writeString(struct.host);
- oprot.writeFieldEnd();
- }
- if (struct.fields != null) {
- oprot.writeFieldBegin(FIELDS_FIELD_DESC);
- {
- oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.fields.size()));
- for (Map.Entry<String, ByteBuffer> _iter4 : struct.fields.entrySet())
- {
- oprot.writeString(_iter4.getKey());
- oprot.writeBinary(_iter4.getValue());
- }
- oprot.writeMapEnd();
- }
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class ThriftFlumeEventTupleSchemeFactory implements SchemeFactory {
- public ThriftFlumeEventTupleScheme getScheme() {
- return new ThriftFlumeEventTupleScheme();
- }
- }
-
- private static class ThriftFlumeEventTupleScheme extends TupleScheme<ThriftFlumeEvent> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, ThriftFlumeEvent struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- BitSet optionals = new BitSet();
- if (struct.isSetTimestamp()) {
- optionals.set(0);
- }
- if (struct.isSetPriority()) {
- optionals.set(1);
- }
- if (struct.isSetBody()) {
- optionals.set(2);
- }
- if (struct.isSetNanos()) {
- optionals.set(3);
- }
- if (struct.isSetHost()) {
- optionals.set(4);
- }
- if (struct.isSetFields()) {
- optionals.set(5);
- }
- oprot.writeBitSet(optionals, 6);
- if (struct.isSetTimestamp()) {
- oprot.writeI64(struct.timestamp);
- }
- if (struct.isSetPriority()) {
- oprot.writeI32(struct.priority.getValue());
- }
- if (struct.isSetBody()) {
- oprot.writeBinary(struct.body);
- }
- if (struct.isSetNanos()) {
- oprot.writeI64(struct.nanos);
- }
- if (struct.isSetHost()) {
- oprot.writeString(struct.host);
- }
- if (struct.isSetFields()) {
- {
- oprot.writeI32(struct.fields.size());
- for (Map.Entry<String, ByteBuffer> _iter5 : struct.fields.entrySet())
- {
- oprot.writeString(_iter5.getKey());
- oprot.writeBinary(_iter5.getValue());
- }
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, ThriftFlumeEvent struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- BitSet incoming = iprot.readBitSet(6);
- if (incoming.get(0)) {
- struct.timestamp = iprot.readI64();
- struct.setTimestampIsSet(true);
- }
- if (incoming.get(1)) {
- struct.priority = Priority.findByValue(iprot.readI32());
- struct.setPriorityIsSet(true);
- }
- if (incoming.get(2)) {
- struct.body = iprot.readBinary();
- struct.setBodyIsSet(true);
- }
- if (incoming.get(3)) {
- struct.nanos = iprot.readI64();
- struct.setNanosIsSet(true);
- }
- if (incoming.get(4)) {
- struct.host = iprot.readString();
- struct.setHostIsSet(true);
- }
- if (incoming.get(5)) {
- {
- 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.fields = new HashMap<String,ByteBuffer>(2*_map6.size);
- for (int _i7 = 0; _i7 < _map6.size; ++_i7)
- {
- String _key8; // required
- ByteBuffer _val9; // required
- _key8 = iprot.readString();
- _val9 = iprot.readBinary();
- struct.fields.put(_key8, _val9);
- }
- }
- struct.setFieldsIsSet(true);
- }
- }
- }
-
}
http://git-wip-us.apache.org/repos/asf/flume/blob/c72a3b1a/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/ThriftFlumeEventServer.java
----------------------------------------------------------------------
diff --git a/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/ThriftFlumeEventServer.java b/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/ThriftFlumeEventServer.java
index 10f35c7..ff32c45 100644
--- a/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/ThriftFlumeEventServer.java
+++ b/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/ThriftFlumeEventServer.java
@@ -17,23 +17,13 @@
* under the License.
*/
/**
- * Autogenerated by Thrift Compiler (0.9.0)
+ * Autogenerated by Thrift Compiler (0.7.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
*/
package com.cloudera.flume.handlers.thrift;
import org.apache.commons.lang.builder.HashCodeBuilder;
-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 org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
@@ -49,7 +39,6 @@ import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@Deprecated
public class ThriftFlumeEventServer {
public interface Iface {
@@ -199,7 +188,7 @@ public class ThriftFlumeEventServer {
}
- public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
+ public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor 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>>()));
@@ -215,39 +204,31 @@ public class ThriftFlumeEventServer {
return processMap;
}
- public static class append<I extends Iface> extends org.apache.thrift.ProcessFunction<I, append_args> {
+ private static class append<I extends Iface> extends org.apache.thrift.ProcessFunction<I, append_args> {
public append() {
super("append");
}
- public append_args getEmptyArgsInstance() {
+ protected append_args getEmptyArgsInstance() {
return new append_args();
}
- protected boolean isOneway() {
- return true;
- }
-
- public org.apache.thrift.TBase getResult(I iface, append_args args) throws org.apache.thrift.TException {
+ protected org.apache.thrift.TBase getResult(I iface, append_args args) throws org.apache.thrift.TException {
iface.append(args.evt);
return null;
}
}
- public static class close<I extends Iface> extends org.apache.thrift.ProcessFunction<I, close_args> {
+ private static class close<I extends Iface> extends org.apache.thrift.ProcessFunction<I, close_args> {
public close() {
super("close");
}
- public close_args getEmptyArgsInstance() {
+ protected close_args getEmptyArgsInstance() {
return new close_args();
}
- protected boolean isOneway() {
- return false;
- }
-
- public close_result getResult(I iface, close_args args) throws org.apache.thrift.TException {
+ protected close_result getResult(I iface, close_args args) throws org.apache.thrift.TException {
close_result result = new close_result();
iface.close();
return result;
@@ -261,12 +242,6 @@ public class ThriftFlumeEventServer {
private static final org.apache.thrift.protocol.TField EVT_FIELD_DESC = new org.apache.thrift.protocol.TField("evt", org.apache.thrift.protocol.TType.STRUCT, (short)1);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new append_argsStandardSchemeFactory());
- schemes.put(TupleScheme.class, new append_argsTupleSchemeFactory());
- }
-
public ThriftFlumeEvent evt; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
@@ -328,6 +303,7 @@ public class ThriftFlumeEventServer {
}
// isset id assignments
+
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
@@ -487,11 +463,45 @@ public class ThriftFlumeEventServer {
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ 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: // EVT
+ if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
+ this.evt = new ThriftFlumeEvent();
+ this.evt.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();
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+ validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (this.evt != null) {
+ oprot.writeFieldBegin(EVT_FIELD_DESC);
+ this.evt.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
}
@Override
@@ -512,10 +522,6 @@ public class ThriftFlumeEventServer {
public void validate() throws org.apache.thrift.TException {
// check for required fields
- // check for sub-struct validity
- if (evt != null) {
- evt.validate();
- }
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -534,104 +540,12 @@ public class ThriftFlumeEventServer {
}
}
- private static class append_argsStandardSchemeFactory implements SchemeFactory {
- public append_argsStandardScheme getScheme() {
- return new append_argsStandardScheme();
- }
- }
-
- private static class append_argsStandardScheme extends StandardScheme<append_args> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, append_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: // EVT
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.evt = new ThriftFlumeEvent();
- struct.evt.read(iprot);
- struct.setEvtIsSet(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, append_args struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.evt != null) {
- oprot.writeFieldBegin(EVT_FIELD_DESC);
- struct.evt.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class append_argsTupleSchemeFactory implements SchemeFactory {
- public append_argsTupleScheme getScheme() {
- return new append_argsTupleScheme();
- }
- }
-
- private static class append_argsTupleScheme extends TupleScheme<append_args> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, append_args struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- BitSet optionals = new BitSet();
- if (struct.isSetEvt()) {
- optionals.set(0);
- }
- oprot.writeBitSet(optionals, 1);
- if (struct.isSetEvt()) {
- struct.evt.write(oprot);
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, append_args struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- BitSet incoming = iprot.readBitSet(1);
- if (incoming.get(0)) {
- struct.evt = new ThriftFlumeEvent();
- struct.evt.read(iprot);
- struct.setEvtIsSet(true);
- }
- }
- }
-
}
public static class close_args implements org.apache.thrift.TBase<close_args, close_args._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("close_args");
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new close_argsStandardSchemeFactory());
- schemes.put(TupleScheme.class, new close_argsTupleSchemeFactory());
- }
-
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
@@ -773,11 +687,32 @@ public class ThriftFlumeEventServer {
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ 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) {
+ 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();
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+ validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
}
@Override
@@ -791,7 +726,6 @@ public class ThriftFlumeEventServer {
public void validate() throws org.apache.thrift.TException {
// check for required fields
- // check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -810,76 +744,12 @@ public class ThriftFlumeEventServer {
}
}
- private static class close_argsStandardSchemeFactory implements SchemeFactory {
- public close_argsStandardScheme getScheme() {
- return new close_argsStandardScheme();
- }
- }
-
- private static class close_argsStandardScheme extends StandardScheme<close_args> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, close_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) {
- 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, close_args struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class close_argsTupleSchemeFactory implements SchemeFactory {
- public close_argsTupleScheme getScheme() {
- return new close_argsTupleScheme();
- }
- }
-
- private static class close_argsTupleScheme extends TupleScheme<close_args> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, close_args struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, close_args struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- }
- }
-
}
public static class close_result implements org.apache.thrift.TBase<close_result, close_result._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("close_result");
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new close_resultStandardSchemeFactory());
- schemes.put(TupleScheme.class, new close_resultTupleSchemeFactory());
- }
-
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
@@ -1021,12 +891,32 @@ public class ThriftFlumeEventServer {
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ 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) {
+ 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();
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
- }
+ oprot.writeStructBegin(STRUCT_DESC);
+
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
@Override
public String toString() {
@@ -1039,7 +929,6 @@ public class ThriftFlumeEventServer {
public void validate() throws org.apache.thrift.TException {
// check for required fields
- // check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -1058,64 +947,6 @@ public class ThriftFlumeEventServer {
}
}
- private static class close_resultStandardSchemeFactory implements SchemeFactory {
- public close_resultStandardScheme getScheme() {
- return new close_resultStandardScheme();
- }
- }
-
- private static class close_resultStandardScheme extends StandardScheme<close_result> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, close_result 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) {
- 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, close_result struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class close_resultTupleSchemeFactory implements SchemeFactory {
- public close_resultTupleScheme getScheme() {
- return new close_resultTupleScheme();
- }
- }
-
- private static class close_resultTupleScheme extends TupleScheme<close_result> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, close_result struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, close_result struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- }
- }
-
}
}
http://git-wip-us.apache.org/repos/asf/flume/blob/c72a3b1a/flume-ng-sdk/src/main/java/org/apache/flume/thrift/Status.java
----------------------------------------------------------------------
diff --git a/flume-ng-sdk/src/main/java/org/apache/flume/thrift/Status.java b/flume-ng-sdk/src/main/java/org/apache/flume/thrift/Status.java
index c05f4e3..634c323 100644
--- a/flume-ng-sdk/src/main/java/org/apache/flume/thrift/Status.java
+++ b/flume-ng-sdk/src/main/java/org/apache/flume/thrift/Status.java
@@ -17,10 +17,9 @@
* under the License.
*/
/**
- * Autogenerated by Thrift Compiler (0.9.0)
+ * Autogenerated by Thrift Compiler (0.7.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
*/
package org.apache.flume.thrift;
http://git-wip-us.apache.org/repos/asf/flume/blob/c72a3b1a/flume-ng-sdk/src/main/java/org/apache/flume/thrift/ThriftFlumeEvent.java
----------------------------------------------------------------------
diff --git a/flume-ng-sdk/src/main/java/org/apache/flume/thrift/ThriftFlumeEvent.java b/flume-ng-sdk/src/main/java/org/apache/flume/thrift/ThriftFlumeEvent.java
index b8af99c..fc0b678 100644
--- a/flume-ng-sdk/src/main/java/org/apache/flume/thrift/ThriftFlumeEvent.java
+++ b/flume-ng-sdk/src/main/java/org/apache/flume/thrift/ThriftFlumeEvent.java
@@ -17,23 +17,13 @@
* under the License.
*/
/**
- * Autogenerated by Thrift Compiler (0.9.0)
+ * Autogenerated by Thrift Compiler (0.7.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
*/
package org.apache.flume.thrift;
import org.apache.commons.lang.builder.HashCodeBuilder;
-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 org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
@@ -55,12 +45,6 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven
private static final org.apache.thrift.protocol.TField HEADERS_FIELD_DESC = new org.apache.thrift.protocol.TField("headers", org.apache.thrift.protocol.TType.MAP, (short)1);
private static final org.apache.thrift.protocol.TField BODY_FIELD_DESC = new org.apache.thrift.protocol.TField("body", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new ThriftFlumeEventStandardSchemeFactory());
- schemes.put(TupleScheme.class, new ThriftFlumeEventTupleSchemeFactory());
- }
-
public Map<String,String> headers; // required
public ByteBuffer body; // required
@@ -126,6 +110,7 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven
}
// isset id assignments
+
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
@@ -390,11 +375,76 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ 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: // HEADERS
+ if (field.type == org.apache.thrift.protocol.TType.MAP) {
+ {
+ org.apache.thrift.protocol.TMap _map0 = iprot.readMapBegin();
+ this.headers = 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();
+ this.headers.put(_key2, _val3);
+ }
+ iprot.readMapEnd();
+ }
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ case 2: // BODY
+ if (field.type == org.apache.thrift.protocol.TType.STRING) {
+ this.body = iprot.readBinary();
+ } 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();
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+ validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (this.headers != null) {
+ oprot.writeFieldBegin(HEADERS_FIELD_DESC);
+ {
+ oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, this.headers.size()));
+ for (Map.Entry<String, String> _iter4 : this.headers.entrySet())
+ {
+ oprot.writeString(_iter4.getKey());
+ oprot.writeString(_iter4.getValue());
+ }
+ oprot.writeMapEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ if (this.body != null) {
+ oprot.writeFieldBegin(BODY_FIELD_DESC);
+ oprot.writeBinary(this.body);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
}
@Override
@@ -429,7 +479,6 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven
if (body == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'body' was not present! Struct: " + toString());
}
- // check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -448,133 +497,5 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven
}
}
- private static class ThriftFlumeEventStandardSchemeFactory implements SchemeFactory {
- public ThriftFlumeEventStandardScheme getScheme() {
- return new ThriftFlumeEventStandardScheme();
- }
- }
-
- private static class ThriftFlumeEventStandardScheme extends StandardScheme<ThriftFlumeEvent> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, ThriftFlumeEvent 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: // HEADERS
- if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
- {
- org.apache.thrift.protocol.TMap _map0 = iprot.readMapBegin();
- struct.headers = 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.headers.put(_key2, _val3);
- }
- iprot.readMapEnd();
- }
- struct.setHeadersIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 2: // BODY
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.body = iprot.readBinary();
- struct.setBodyIsSet(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, ThriftFlumeEvent struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.headers != null) {
- oprot.writeFieldBegin(HEADERS_FIELD_DESC);
- {
- oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.headers.size()));
- for (Map.Entry<String, String> _iter4 : struct.headers.entrySet())
- {
- oprot.writeString(_iter4.getKey());
- oprot.writeString(_iter4.getValue());
- }
- oprot.writeMapEnd();
- }
- oprot.writeFieldEnd();
- }
- if (struct.body != null) {
- oprot.writeFieldBegin(BODY_FIELD_DESC);
- oprot.writeBinary(struct.body);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class ThriftFlumeEventTupleSchemeFactory implements SchemeFactory {
- public ThriftFlumeEventTupleScheme getScheme() {
- return new ThriftFlumeEventTupleScheme();
- }
- }
-
- private static class ThriftFlumeEventTupleScheme extends TupleScheme<ThriftFlumeEvent> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, ThriftFlumeEvent struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- {
- oprot.writeI32(struct.headers.size());
- for (Map.Entry<String, String> _iter5 : struct.headers.entrySet())
- {
- oprot.writeString(_iter5.getKey());
- oprot.writeString(_iter5.getValue());
- }
- }
- oprot.writeBinary(struct.body);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, ThriftFlumeEvent struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- {
- 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.headers = 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.headers.put(_key8, _val9);
- }
- }
- struct.setHeadersIsSet(true);
- struct.body = iprot.readBinary();
- struct.setBodyIsSet(true);
- }
- }
-
}
http://git-wip-us.apache.org/repos/asf/flume/blob/c72a3b1a/flume-ng-sdk/src/main/java/org/apache/flume/thrift/ThriftSourceProtocol.java
----------------------------------------------------------------------
diff --git a/flume-ng-sdk/src/main/java/org/apache/flume/thrift/ThriftSourceProtocol.java b/flume-ng-sdk/src/main/java/org/apache/flume/thrift/ThriftSourceProtocol.java
index b041895..7f966b0 100644
--- a/flume-ng-sdk/src/main/java/org/apache/flume/thrift/ThriftSourceProtocol.java
+++ b/flume-ng-sdk/src/main/java/org/apache/flume/thrift/ThriftSourceProtocol.java
@@ -17,23 +17,13 @@
* under the License.
*/
/**
- * Autogenerated by Thrift Compiler (0.9.0)
+ * Autogenerated by Thrift Compiler (0.7.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
*/
package org.apache.flume.thrift;
import org.apache.commons.lang.builder.HashCodeBuilder;
-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 org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
@@ -217,7 +207,7 @@ public class ThriftSourceProtocol {
}
- public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
+ public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor 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>>()));
@@ -233,40 +223,32 @@ public class ThriftSourceProtocol {
return processMap;
}
- public static class append<I extends Iface> extends org.apache.thrift.ProcessFunction<I, append_args> {
+ private static class append<I extends Iface> extends org.apache.thrift.ProcessFunction<I, append_args> {
public append() {
super("append");
}
- public append_args getEmptyArgsInstance() {
+ protected append_args getEmptyArgsInstance() {
return new append_args();
}
- protected boolean isOneway() {
- return false;
- }
-
- public append_result getResult(I iface, append_args args) throws org.apache.thrift.TException {
+ protected append_result getResult(I iface, append_args args) throws org.apache.thrift.TException {
append_result result = new append_result();
result.success = iface.append(args.event);
return result;
}
}
- public static class appendBatch<I extends Iface> extends org.apache.thrift.ProcessFunction<I, appendBatch_args> {
+ private static class appendBatch<I extends Iface> extends org.apache.thrift.ProcessFunction<I, appendBatch_args> {
public appendBatch() {
super("appendBatch");
}
- public appendBatch_args getEmptyArgsInstance() {
+ protected appendBatch_args getEmptyArgsInstance() {
return new appendBatch_args();
}
- protected boolean isOneway() {
- return false;
- }
-
- public appendBatch_result getResult(I iface, appendBatch_args args) throws org.apache.thrift.TException {
+ protected appendBatch_result getResult(I iface, appendBatch_args args) throws org.apache.thrift.TException {
appendBatch_result result = new appendBatch_result();
result.success = iface.appendBatch(args.events);
return result;
@@ -280,12 +262,6 @@ public class ThriftSourceProtocol {
private static final org.apache.thrift.protocol.TField EVENT_FIELD_DESC = new org.apache.thrift.protocol.TField("event", org.apache.thrift.protocol.TType.STRUCT, (short)1);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new append_argsStandardSchemeFactory());
- schemes.put(TupleScheme.class, new append_argsTupleSchemeFactory());
- }
-
public ThriftFlumeEvent event; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
@@ -347,6 +323,7 @@ public class ThriftSourceProtocol {
}
// isset id assignments
+
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
@@ -506,11 +483,45 @@ public class ThriftSourceProtocol {
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ 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: // EVENT
+ if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
+ this.event = new ThriftFlumeEvent();
+ this.event.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();
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+ validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (this.event != null) {
+ oprot.writeFieldBegin(EVENT_FIELD_DESC);
+ this.event.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
}
@Override
@@ -531,10 +542,6 @@ public class ThriftSourceProtocol {
public void validate() throws org.apache.thrift.TException {
// check for required fields
- // check for sub-struct validity
- if (event != null) {
- event.validate();
- }
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -553,92 +560,6 @@ public class ThriftSourceProtocol {
}
}
- private static class append_argsStandardSchemeFactory implements SchemeFactory {
- public append_argsStandardScheme getScheme() {
- return new append_argsStandardScheme();
- }
- }
-
- private static class append_argsStandardScheme extends StandardScheme<append_args> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, append_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: // EVENT
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.event = new ThriftFlumeEvent();
- struct.event.read(iprot);
- struct.setEventIsSet(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, append_args struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.event != null) {
- oprot.writeFieldBegin(EVENT_FIELD_DESC);
- struct.event.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class append_argsTupleSchemeFactory implements SchemeFactory {
- public append_argsTupleScheme getScheme() {
- return new append_argsTupleScheme();
- }
- }
-
- private static class append_argsTupleScheme extends TupleScheme<append_args> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, append_args struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- BitSet optionals = new BitSet();
- if (struct.isSetEvent()) {
- optionals.set(0);
- }
- oprot.writeBitSet(optionals, 1);
- if (struct.isSetEvent()) {
- struct.event.write(oprot);
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, append_args struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- BitSet incoming = iprot.readBitSet(1);
- if (incoming.get(0)) {
- struct.event = new ThriftFlumeEvent();
- struct.event.read(iprot);
- struct.setEventIsSet(true);
- }
- }
- }
-
}
public static class append_result implements org.apache.thrift.TBase<append_result, append_result._Fields>, java.io.Serializable, Cloneable {
@@ -646,12 +567,6 @@ public class ThriftSourceProtocol {
private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new append_resultStandardSchemeFactory());
- schemes.put(TupleScheme.class, new append_resultTupleSchemeFactory());
- }
-
/**
*
* @see Status
@@ -721,6 +636,7 @@ public class ThriftSourceProtocol {
}
// isset id assignments
+
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
@@ -888,12 +804,44 @@ public class ThriftSourceProtocol {
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ 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 0: // SUCCESS
+ if (field.type == org.apache.thrift.protocol.TType.I32) {
+ this.success = Status.findByValue(iprot.readI32());
+ } 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();
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+ oprot.writeStructBegin(STRUCT_DESC);
+
+ if (this.isSetSuccess()) {
+ oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+ oprot.writeI32(this.success.getValue());
+ oprot.writeFieldEnd();
}
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
@Override
public String toString() {
@@ -913,7 +861,6 @@ public class ThriftSourceProtocol {
public void validate() throws org.apache.thrift.TException {
// check for required fields
- // check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -932,90 +879,6 @@ public class ThriftSourceProtocol {
}
}
- private static class append_resultStandardSchemeFactory implements SchemeFactory {
- public append_resultStandardScheme getScheme() {
- return new append_resultStandardScheme();
- }
- }
-
- private static class append_resultStandardScheme extends StandardScheme<append_result> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, append_result 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 0: // SUCCESS
- if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
- struct.success = Status.findByValue(iprot.readI32());
- struct.setSuccessIsSet(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, append_result struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.success != null) {
- oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
- oprot.writeI32(struct.success.getValue());
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class append_resultTupleSchemeFactory implements SchemeFactory {
- public append_resultTupleScheme getScheme() {
- return new append_resultTupleScheme();
- }
- }
-
- private static class append_resultTupleScheme extends TupleScheme<append_result> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, append_result struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- BitSet optionals = new BitSet();
- if (struct.isSetSuccess()) {
- optionals.set(0);
- }
- oprot.writeBitSet(optionals, 1);
- if (struct.isSetSuccess()) {
- oprot.writeI32(struct.success.getValue());
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, append_result struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- BitSet incoming = iprot.readBitSet(1);
- if (incoming.get(0)) {
- struct.success = Status.findByValue(iprot.readI32());
- struct.setSuccessIsSet(true);
- }
- }
- }
-
}
public static class appendBatch_args implements org.apache.thrift.TBase<appendBatch_args, appendBatch_args._Fields>, java.io.Serializable, Cloneable {
@@ -1023,12 +886,6 @@ public class ThriftSourceProtocol {
private static final org.apache.thrift.protocol.TField EVENTS_FIELD_DESC = new org.apache.thrift.protocol.TField("events", org.apache.thrift.protocol.TType.LIST, (short)1);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new appendBatch_argsStandardSchemeFactory());
- schemes.put(TupleScheme.class, new appendBatch_argsTupleSchemeFactory());
- }
-
public List<ThriftFlumeEvent> events; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
@@ -1090,6 +947,7 @@ public class ThriftSourceProtocol {
}
// isset id assignments
+
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
@@ -1269,11 +1127,62 @@ public class ThriftSourceProtocol {
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ 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: // EVENTS
+ if (field.type == org.apache.thrift.protocol.TType.LIST) {
+ {
+ org.apache.thrift.protocol.TList _list5 = iprot.readListBegin();
+ this.events = new ArrayList<ThriftFlumeEvent>(_list5.size);
+ for (int _i6 = 0; _i6 < _list5.size; ++_i6)
+ {
+ ThriftFlumeEvent _elem7; // required
+ _elem7 = new ThriftFlumeEvent();
+ _elem7.read(iprot);
+ this.events.add(_elem7);
+ }
+ iprot.readListEnd();
+ }
+ } 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();
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+ validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (this.events != null) {
+ oprot.writeFieldBegin(EVENTS_FIELD_DESC);
+ {
+ oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.events.size()));
+ for (ThriftFlumeEvent _iter8 : this.events)
+ {
+ _iter8.write(oprot);
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
}
@Override
@@ -1294,7 +1203,6 @@ public class ThriftSourceProtocol {
public void validate() throws org.apache.thrift.TException {
// check for required fields
- // check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -1313,124 +1221,6 @@ public class ThriftSourceProtocol {
}
}
- private static class appendBatch_argsStandardSchemeFactory implements SchemeFactory {
- public appendBatch_argsStandardScheme getScheme() {
- return new appendBatch_argsStandardScheme();
- }
- }
-
- private static class appendBatch_argsStandardScheme extends StandardScheme<appendBatch_args> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, appendBatch_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: // EVENTS
- if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
- {
- org.apache.thrift.protocol.TList _list10 = iprot.readListBegin();
- struct.events = new ArrayList<ThriftFlumeEvent>(_list10.size);
- for (int _i11 = 0; _i11 < _list10.size; ++_i11)
- {
- ThriftFlumeEvent _elem12; // required
- _elem12 = new ThriftFlumeEvent();
- _elem12.read(iprot);
- struct.events.add(_elem12);
- }
- iprot.readListEnd();
- }
- struct.setEventsIsSet(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, appendBatch_args struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.events != null) {
- oprot.writeFieldBegin(EVENTS_FIELD_DESC);
- {
- oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.events.size()));
- for (ThriftFlumeEvent _iter13 : struct.events)
- {
- _iter13.write(oprot);
- }
- oprot.writeListEnd();
- }
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class appendBatch_argsTupleSchemeFactory implements SchemeFactory {
- public appendBatch_argsTupleScheme getScheme() {
- return new appendBatch_argsTupleScheme();
- }
- }
-
- private static class appendBatch_argsTupleScheme extends TupleScheme<appendBatch_args> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, appendBatch_args struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- BitSet optionals = new BitSet();
- if (struct.isSetEvents()) {
- optionals.set(0);
- }
- oprot.writeBitSet(optionals, 1);
- if (struct.isSetEvents()) {
- {
- oprot.writeI32(struct.events.size());
- for (ThriftFlumeEvent _iter14 : struct.events)
- {
- _iter14.write(oprot);
- }
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, appendBatch_args struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- BitSet incoming = iprot.readBitSet(1);
- if (incoming.get(0)) {
- {
- org.apache.thrift.protocol.TList _list15 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
- struct.events = new ArrayList<ThriftFlumeEvent>(_list15.size);
- for (int _i16 = 0; _i16 < _list15.size; ++_i16)
- {
- ThriftFlumeEvent _elem17; // required
- _elem17 = new ThriftFlumeEvent();
- _elem17.read(iprot);
- struct.events.add(_elem17);
- }
- }
- struct.setEventsIsSet(true);
- }
- }
- }
-
}
public static class appendBatch_result implements org.apache.thrift.TBase<appendBatch_result, appendBatch_result._Fields>, java.io.Serializable, Cloneable {
@@ -1438,12 +1228,6 @@ public class ThriftSourceProtocol {
private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0);
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new appendBatch_resultStandardSchemeFactory());
- schemes.put(TupleScheme.class, new appendBatch_resultTupleSchemeFactory());
- }
-
/**
*
* @see Status
@@ -1513,6 +1297,7 @@ public class ThriftSourceProtocol {
}
// isset id assignments
+
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
@@ -1680,12 +1465,44 @@ public class ThriftSourceProtocol {
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ 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 0: // SUCCESS
+ if (field.type == org.apache.thrift.protocol.TType.I32) {
+ this.success = Status.findByValue(iprot.readI32());
+ } 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();
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+ oprot.writeStructBegin(STRUCT_DESC);
+
+ if (this.isSetSuccess()) {
+ oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+ oprot.writeI32(this.success.getValue());
+ oprot.writeFieldEnd();
}
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
@Override
public String toString() {
@@ -1705,7 +1522,6 @@ public class ThriftSourceProtocol {
public void validate() throws org.apache.thrift.TException {
// check for required fields
- // check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -1724,90 +1540,6 @@ public class ThriftSourceProtocol {
}
}
- private static class appendBatch_resultStandardSchemeFactory implements SchemeFactory {
- public appendBatch_resultStandardScheme getScheme() {
- return new appendBatch_resultStandardScheme();
- }
- }
-
- private static class appendBatch_resultStandardScheme extends StandardScheme<appendBatch_result> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, appendBatch_result 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 0: // SUCCESS
- if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
- struct.success = Status.findByValue(iprot.readI32());
- struct.setSuccessIsSet(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, appendBatch_result struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.success != null) {
- oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
- oprot.writeI32(struct.success.getValue());
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class appendBatch_resultTupleSchemeFactory implements SchemeFactory {
- public appendBatch_resultTupleScheme getScheme() {
- return new appendBatch_resultTupleScheme();
- }
- }
-
- private static class appendBatch_resultTupleScheme extends TupleScheme<appendBatch_result> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, appendBatch_result struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- BitSet optionals = new BitSet();
- if (struct.isSetSuccess()) {
- optionals.set(0);
- }
- oprot.writeBitSet(optionals, 1);
- if (struct.isSetSuccess()) {
- oprot.writeI32(struct.success.getValue());
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, appendBatch_result struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- BitSet incoming = iprot.readBitSet(1);
- if (incoming.get(0)) {
- struct.success = Status.findByValue(iprot.readI32());
- struct.setSuccessIsSet(true);
- }
- }
- }
-
}
}