You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flume.apache.org by de...@apache.org on 2017/09/11 13:07:22 UTC
[1/2] flume git commit: FLUME-3127. Upgrade libfb303 library
dependency
Repository: flume
Updated Branches:
refs/heads/trunk d35526278 -> 773555c5c
http://git-wip-us.apache.org/repos/asf/flume/blob/773555c5/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 67a64ac..72c9a2c 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,13 +17,24 @@
* under the License.
*/
/**
- * Autogenerated by Thrift Compiler (0.7.0)
+ * Autogenerated by Thrift Compiler (0.9.3)
*
* 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 org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
@@ -36,9 +47,12 @@ import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
+import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2017-09-01")
public class ThriftSourceProtocol {
public interface Iface {
@@ -51,9 +65,9 @@ public class ThriftSourceProtocol {
public interface AsyncIface {
- public void append(ThriftFlumeEvent event, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.append_call> resultHandler) throws org.apache.thrift.TException;
+ public void append(ThriftFlumeEvent event, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
- public void appendBatch(List<ThriftFlumeEvent> events, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.appendBatch_call> resultHandler) throws org.apache.thrift.TException;
+ public void appendBatch(List<ThriftFlumeEvent> events, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
}
@@ -141,7 +155,7 @@ public class ThriftSourceProtocol {
super(protocolFactory, clientManager, transport);
}
- public void append(ThriftFlumeEvent event, org.apache.thrift.async.AsyncMethodCallback<append_call> resultHandler) throws org.apache.thrift.TException {
+ public void append(ThriftFlumeEvent event, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
checkReady();
append_call method_call = new append_call(event, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
@@ -150,7 +164,7 @@ public class ThriftSourceProtocol {
public static class append_call extends org.apache.thrift.async.TAsyncMethodCall {
private ThriftFlumeEvent event;
- public append_call(ThriftFlumeEvent event, org.apache.thrift.async.AsyncMethodCallback<append_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ public append_call(ThriftFlumeEvent event, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
super(client, protocolFactory, transport, resultHandler, false);
this.event = event;
}
@@ -173,7 +187,7 @@ public class ThriftSourceProtocol {
}
}
- public void appendBatch(List<ThriftFlumeEvent> events, org.apache.thrift.async.AsyncMethodCallback<appendBatch_call> resultHandler) throws org.apache.thrift.TException {
+ public void appendBatch(List<ThriftFlumeEvent> events, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
checkReady();
appendBatch_call method_call = new appendBatch_call(events, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
@@ -182,7 +196,7 @@ public class ThriftSourceProtocol {
public static class appendBatch_call extends org.apache.thrift.async.TAsyncMethodCall {
private List<ThriftFlumeEvent> events;
- public appendBatch_call(List<ThriftFlumeEvent> events, org.apache.thrift.async.AsyncMethodCallback<appendBatch_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ public appendBatch_call(List<ThriftFlumeEvent> events, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
super(client, protocolFactory, transport, resultHandler, false);
this.events = events;
}
@@ -207,7 +221,7 @@ public class ThriftSourceProtocol {
}
- public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor implements org.apache.thrift.TProcessor {
+ 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>>()));
@@ -223,7 +237,7 @@ public class ThriftSourceProtocol {
return processMap;
}
- private static class append<I extends Iface> extends org.apache.thrift.ProcessFunction<I, append_args> {
+ public static class append<I extends Iface> extends org.apache.thrift.ProcessFunction<I, append_args> {
public append() {
super("append");
}
@@ -232,19 +246,107 @@ public class ThriftSourceProtocol {
return new append_args();
}
- public append_result getResult(I iface, append_args args) throws org
- .apache.thrift.TException {
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public 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> {
+ public appendBatch() {
+ super("appendBatch");
+ }
+
+ public 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 {
+ appendBatch_result result = new appendBatch_result();
+ result.success = iface.appendBatch(args.events);
+ return result;
+ }
+ }
+
+ }
+
+ public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
+ private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName());
+ public AsyncProcessor(I iface) {
+ super(iface, getProcessMap(new HashMap<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>()));
}
- private static class appendBatch<I extends Iface> extends org.apache.thrift.ProcessFunction<I, appendBatch_args> {
+ protected AsyncProcessor(I iface, Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) {
+ super(iface, getProcessMap(processMap));
+ }
+
+ private static <I extends AsyncIface> Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase,?>> getProcessMap(Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) {
+ processMap.put("append", new append());
+ processMap.put("appendBatch", new appendBatch());
+ return processMap;
+ }
+
+ public static class append<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, append_args, Status> {
+ public append() {
+ super("append");
+ }
+
+ public append_args getEmptyArgsInstance() {
+ return new append_args();
+ }
+
+ public AsyncMethodCallback<Status> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback<Status>() {
+ public void onComplete(Status o) {
+ append_result result = new append_result();
+ result.success = o;
+ try {
+ fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+ return;
+ } catch (Exception e) {
+ LOGGER.error("Exception writing to internal frame buffer", e);
+ }
+ fb.close();
+ }
+ public void onError(Exception e) {
+ byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+ org.apache.thrift.TBase msg;
+ append_result result = new append_result();
+ {
+ msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+ msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+ }
+ try {
+ fcall.sendResponse(fb,msg,msgType,seqid);
+ return;
+ } catch (Exception ex) {
+ LOGGER.error("Exception writing to internal frame buffer", ex);
+ }
+ fb.close();
+ }
+ };
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public void start(I iface, append_args args, org.apache.thrift.async.AsyncMethodCallback<Status> resultHandler) throws TException {
+ iface.append(args.event,resultHandler);
+ }
+ }
+
+ public static class appendBatch<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, appendBatch_args, Status> {
public appendBatch() {
super("appendBatch");
}
@@ -253,25 +355,61 @@ public class ThriftSourceProtocol {
return new appendBatch_args();
}
- public 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;
+ public AsyncMethodCallback<Status> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback<Status>() {
+ public void onComplete(Status o) {
+ appendBatch_result result = new appendBatch_result();
+ result.success = o;
+ try {
+ fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+ return;
+ } catch (Exception e) {
+ LOGGER.error("Exception writing to internal frame buffer", e);
+ }
+ fb.close();
+ }
+ public void onError(Exception e) {
+ byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+ org.apache.thrift.TBase msg;
+ appendBatch_result result = new appendBatch_result();
+ {
+ msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+ msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+ }
+ try {
+ fcall.sendResponse(fb,msg,msgType,seqid);
+ return;
+ } catch (Exception ex) {
+ LOGGER.error("Exception writing to internal frame buffer", ex);
+ }
+ fb.close();
+ }
+ };
}
protected boolean isOneway() {
return false;
}
+
+ public void start(I iface, appendBatch_args args, org.apache.thrift.async.AsyncMethodCallback<Status> resultHandler) throws TException {
+ iface.appendBatch(args.events,resultHandler);
+ }
}
}
- public static class append_args implements org.apache.thrift.TBase<append_args, append_args._Fields>, java.io.Serializable, Cloneable {
+ public static class append_args implements org.apache.thrift.TBase<append_args, append_args._Fields>, java.io.Serializable, Cloneable, Comparable<append_args> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("append_args");
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. */
@@ -333,7 +471,6 @@ 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);
@@ -457,30 +594,30 @@ public class ThriftSourceProtocol {
@Override
public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
+ List<Object> list = new ArrayList<Object>();
boolean present_event = true && (isSetEvent());
- builder.append(present_event);
+ list.add(present_event);
if (present_event)
- builder.append(event);
+ list.add(event);
- return builder.toHashCode();
+ return list.hashCode();
}
+ @Override
public int compareTo(append_args other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
- append_args typedOther = (append_args)other;
- lastComparison = Boolean.valueOf(isSetEvent()).compareTo(typedOther.isSetEvent());
+ lastComparison = Boolean.valueOf(isSetEvent()).compareTo(other.isSetEvent());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetEvent()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.event, typedOther.event);
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.event, other.event);
if (lastComparison != 0) {
return lastComparison;
}
@@ -493,45 +630,11 @@ public class ThriftSourceProtocol {
}
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: // 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();
+ 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.event != null) {
- oprot.writeFieldBegin(EVENT_FIELD_DESC);
- this.event.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -552,6 +655,10 @@ 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 {
@@ -570,13 +677,105 @@ 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 {
+ public static class append_result implements org.apache.thrift.TBase<append_result, append_result._Fields>, java.io.Serializable, Cloneable, Comparable<append_result> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("append_result");
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
@@ -646,7 +845,6 @@ 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);
@@ -778,30 +976,30 @@ public class ThriftSourceProtocol {
@Override
public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
+ List<Object> list = new ArrayList<Object>();
boolean present_success = true && (isSetSuccess());
- builder.append(present_success);
+ list.add(present_success);
if (present_success)
- builder.append(success.getValue());
+ list.add(success.getValue());
- return builder.toHashCode();
+ return list.hashCode();
}
+ @Override
public int compareTo(append_result other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
- append_result typedOther = (append_result)other;
- lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
+ lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSuccess()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
if (lastComparison != 0) {
return lastComparison;
}
@@ -814,44 +1012,12 @@ public class ThriftSourceProtocol {
}
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 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();
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- oprot.writeStructBegin(STRUCT_DESC);
-
- if (this.isSetSuccess()) {
- oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
- oprot.writeI32(this.success.getValue());
- oprot.writeFieldEnd();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
@Override
public String toString() {
@@ -871,6 +1037,7 @@ 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 {
@@ -889,13 +1056,103 @@ 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 = org.apache.flume.thrift.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 = org.apache.flume.thrift.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 {
+ public static class appendBatch_args implements org.apache.thrift.TBase<appendBatch_args, appendBatch_args._Fields>, java.io.Serializable, Cloneable, Comparable<appendBatch_args> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("appendBatch_args");
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. */
@@ -957,7 +1214,6 @@ 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);
@@ -983,7 +1239,7 @@ public class ThriftSourceProtocol {
*/
public appendBatch_args(appendBatch_args other) {
if (other.isSetEvents()) {
- List<ThriftFlumeEvent> __this__events = new ArrayList<ThriftFlumeEvent>();
+ List<ThriftFlumeEvent> __this__events = new ArrayList<ThriftFlumeEvent>(other.events.size());
for (ThriftFlumeEvent other_element : other.events) {
__this__events.add(new ThriftFlumeEvent(other_element));
}
@@ -1101,30 +1357,30 @@ public class ThriftSourceProtocol {
@Override
public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
+ List<Object> list = new ArrayList<Object>();
boolean present_events = true && (isSetEvents());
- builder.append(present_events);
+ list.add(present_events);
if (present_events)
- builder.append(events);
+ list.add(events);
- return builder.toHashCode();
+ return list.hashCode();
}
+ @Override
public int compareTo(appendBatch_args other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
- appendBatch_args typedOther = (appendBatch_args)other;
- lastComparison = Boolean.valueOf(isSetEvents()).compareTo(typedOther.isSetEvents());
+ lastComparison = Boolean.valueOf(isSetEvents()).compareTo(other.isSetEvents());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetEvents()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.events, typedOther.events);
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.events, other.events);
if (lastComparison != 0) {
return lastComparison;
}
@@ -1137,62 +1393,11 @@ public class ThriftSourceProtocol {
}
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: // 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();
+ 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.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();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -1213,6 +1418,7 @@ 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 {
@@ -1231,13 +1437,137 @@ 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);
+ ThriftFlumeEvent _elem11;
+ for (int _i12 = 0; _i12 < _list10.size; ++_i12)
+ {
+ _elem11 = new ThriftFlumeEvent();
+ _elem11.read(iprot);
+ struct.events.add(_elem11);
+ }
+ 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);
+ ThriftFlumeEvent _elem16;
+ for (int _i17 = 0; _i17 < _list15.size; ++_i17)
+ {
+ _elem16 = new ThriftFlumeEvent();
+ _elem16.read(iprot);
+ struct.events.add(_elem16);
+ }
+ }
+ struct.setEventsIsSet(true);
+ }
+ }
+ }
+
}
- public static class appendBatch_result implements org.apache.thrift.TBase<appendBatch_result, appendBatch_result._Fields>, java.io.Serializable, Cloneable {
+ public static class appendBatch_result implements org.apache.thrift.TBase<appendBatch_result, appendBatch_result._Fields>, java.io.Serializable, Cloneable, Comparable<appendBatch_result> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("appendBatch_result");
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
@@ -1307,7 +1637,6 @@ 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);
@@ -1439,30 +1768,30 @@ public class ThriftSourceProtocol {
@Override
public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
+ List<Object> list = new ArrayList<Object>();
boolean present_success = true && (isSetSuccess());
- builder.append(present_success);
+ list.add(present_success);
if (present_success)
- builder.append(success.getValue());
+ list.add(success.getValue());
- return builder.toHashCode();
+ return list.hashCode();
}
+ @Override
public int compareTo(appendBatch_result other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
- appendBatch_result typedOther = (appendBatch_result)other;
- lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
+ lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSuccess()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
if (lastComparison != 0) {
return lastComparison;
}
@@ -1475,44 +1804,12 @@ public class ThriftSourceProtocol {
}
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 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();
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- oprot.writeStructBegin(STRUCT_DESC);
-
- if (this.isSetSuccess()) {
- oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
- oprot.writeI32(this.success.getValue());
- oprot.writeFieldEnd();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
@Override
public String toString() {
@@ -1532,6 +1829,7 @@ 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 {
@@ -1550,6 +1848,90 @@ 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 = org.apache.flume.thrift.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 = org.apache.flume.thrift.Status.findByValue(iprot.readI32());
+ struct.setSuccessIsSet(true);
+ }
+ }
+ }
+
}
}
http://git-wip-us.apache.org/repos/asf/flume/blob/773555c5/flume-ng-sources/flume-scribe-source/src/main/java/org/apache/flume/source/scribe/LogEntry.java
----------------------------------------------------------------------
diff --git a/flume-ng-sources/flume-scribe-source/src/main/java/org/apache/flume/source/scribe/LogEntry.java b/flume-ng-sources/flume-scribe-source/src/main/java/org/apache/flume/source/scribe/LogEntry.java
index be703a9..bd0a4c5 100644
--- a/flume-ng-sources/flume-scribe-source/src/main/java/org/apache/flume/source/scribe/LogEntry.java
+++ b/flume-ng-sources/flume-scribe-source/src/main/java/org/apache/flume/source/scribe/LogEntry.java
@@ -17,13 +17,24 @@
* under the License.
*/
/**
- * Autogenerated by Thrift Compiler (0.7.0)
+ * Autogenerated by Thrift Compiler (0.9.3)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
*/
package org.apache.flume.source.scribe;
-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 org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
@@ -36,15 +47,24 @@ import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
+import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class LogEntry implements org.apache.thrift.TBase<LogEntry, LogEntry._Fields>, java.io.Serializable, Cloneable {
+@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2017-09-01")
+public class LogEntry implements org.apache.thrift.TBase<LogEntry, LogEntry._Fields>, java.io.Serializable, Cloneable, Comparable<LogEntry> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("LogEntry");
private static final org.apache.thrift.protocol.TField CATEGORY_FIELD_DESC = new org.apache.thrift.protocol.TField("category", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", 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 LogEntryStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new LogEntryTupleSchemeFactory());
+ }
+
public String category; // required
public String message; // required
@@ -110,7 +130,6 @@ public class LogEntry implements org.apache.thrift.TBase<LogEntry, LogEntry._Fie
}
// 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);
@@ -288,45 +307,45 @@ public class LogEntry implements org.apache.thrift.TBase<LogEntry, LogEntry._Fie
@Override
public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
+ List<Object> list = new ArrayList<Object>();
boolean present_category = true && (isSetCategory());
- builder.append(present_category);
+ list.add(present_category);
if (present_category)
- builder.append(category);
+ list.add(category);
boolean present_message = true && (isSetMessage());
- builder.append(present_message);
+ list.add(present_message);
if (present_message)
- builder.append(message);
+ list.add(message);
- return builder.toHashCode();
+ return list.hashCode();
}
+ @Override
public int compareTo(LogEntry other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
- LogEntry typedOther = (LogEntry)other;
- lastComparison = Boolean.valueOf(isSetCategory()).compareTo(typedOther.isSetCategory());
+ lastComparison = Boolean.valueOf(isSetCategory()).compareTo(other.isSetCategory());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetCategory()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.category, typedOther.category);
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.category, other.category);
if (lastComparison != 0) {
return lastComparison;
}
}
- lastComparison = Boolean.valueOf(isSetMessage()).compareTo(typedOther.isSetMessage());
+ lastComparison = Boolean.valueOf(isSetMessage()).compareTo(other.isSetMessage());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetMessage()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, typedOther.message);
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, other.message);
if (lastComparison != 0) {
return lastComparison;
}
@@ -339,56 +358,11 @@ public class LogEntry implements org.apache.thrift.TBase<LogEntry, LogEntry._Fie
}
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: // CATEGORY
- if (field.type == org.apache.thrift.protocol.TType.STRING) {
- this.category = iprot.readString();
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 2: // MESSAGE
- if (field.type == org.apache.thrift.protocol.TType.STRING) {
- this.message = iprot.readString();
- } 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.category != null) {
- oprot.writeFieldBegin(CATEGORY_FIELD_DESC);
- oprot.writeString(this.category);
- oprot.writeFieldEnd();
- }
- if (this.message != null) {
- oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
- oprot.writeString(this.message);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -417,6 +391,7 @@ public class LogEntry implements org.apache.thrift.TBase<LogEntry, LogEntry._Fie
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 {
@@ -435,5 +410,112 @@ public class LogEntry implements org.apache.thrift.TBase<LogEntry, LogEntry._Fie
}
}
+ private static class LogEntryStandardSchemeFactory implements SchemeFactory {
+ public LogEntryStandardScheme getScheme() {
+ return new LogEntryStandardScheme();
+ }
+ }
+
+ private static class LogEntryStandardScheme extends StandardScheme<LogEntry> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, LogEntry 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: // CATEGORY
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.category = iprot.readString();
+ struct.setCategoryIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // MESSAGE
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.message = iprot.readString();
+ struct.setMessageIsSet(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, LogEntry struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.category != null) {
+ oprot.writeFieldBegin(CATEGORY_FIELD_DESC);
+ oprot.writeString(struct.category);
+ oprot.writeFieldEnd();
+ }
+ if (struct.message != null) {
+ oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
+ oprot.writeString(struct.message);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class LogEntryTupleSchemeFactory implements SchemeFactory {
+ public LogEntryTupleScheme getScheme() {
+ return new LogEntryTupleScheme();
+ }
+ }
+
+ private static class LogEntryTupleScheme extends TupleScheme<LogEntry> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, LogEntry struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetCategory()) {
+ optionals.set(0);
+ }
+ if (struct.isSetMessage()) {
+ optionals.set(1);
+ }
+ oprot.writeBitSet(optionals, 2);
+ if (struct.isSetCategory()) {
+ oprot.writeString(struct.category);
+ }
+ if (struct.isSetMessage()) {
+ oprot.writeString(struct.message);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, LogEntry struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(2);
+ if (incoming.get(0)) {
+ struct.category = iprot.readString();
+ struct.setCategoryIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.message = iprot.readString();
+ struct.setMessageIsSet(true);
+ }
+ }
+ }
+
}
http://git-wip-us.apache.org/repos/asf/flume/blob/773555c5/flume-ng-sources/flume-scribe-source/src/main/java/org/apache/flume/source/scribe/ResultCode.java
----------------------------------------------------------------------
diff --git a/flume-ng-sources/flume-scribe-source/src/main/java/org/apache/flume/source/scribe/ResultCode.java b/flume-ng-sources/flume-scribe-source/src/main/java/org/apache/flume/source/scribe/ResultCode.java
index 210e21e..fc7d773 100644
--- a/flume-ng-sources/flume-scribe-source/src/main/java/org/apache/flume/source/scribe/ResultCode.java
+++ b/flume-ng-sources/flume-scribe-source/src/main/java/org/apache/flume/source/scribe/ResultCode.java
@@ -17,9 +17,10 @@
* under the License.
*/
/**
- * Autogenerated by Thrift Compiler (0.7.0)
+ * Autogenerated by Thrift Compiler (0.9.3)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
*/
package org.apache.flume.source.scribe;
http://git-wip-us.apache.org/repos/asf/flume/blob/773555c5/flume-ng-sources/flume-scribe-source/src/main/java/org/apache/flume/source/scribe/Scribe.java
----------------------------------------------------------------------
diff --git a/flume-ng-sources/flume-scribe-source/src/main/java/org/apache/flume/source/scribe/Scribe.java b/flume-ng-sources/flume-scribe-source/src/main/java/org/apache/flume/source/scribe/Scribe.java
index 3b5b3c7..4c30bac 100644
--- a/flume-ng-sources/flume-scribe-source/src/main/java/org/apache/flume/source/scribe/Scribe.java
+++ b/flume-ng-sources/flume-scribe-source/src/main/java/org/apache/flume/source/scribe/Scribe.java
@@ -17,13 +17,24 @@
* under the License.
*/
/**
- * Autogenerated by Thrift Compiler (0.7.0)
+ * Autogenerated by Thrift Compiler (0.9.3)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
*/
package org.apache.flume.source.scribe;
-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 org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
@@ -36,9 +47,12 @@ import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
+import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2017-09-01")
public class Scribe {
public interface Iface {
@@ -49,7 +63,7 @@ public class Scribe {
public interface AsyncIface {
- public void Log(List<LogEntry> messages, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.Log_call> resultHandler) throws org.apache.thrift.TException;
+ public void Log(List<LogEntry> messages, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
}
@@ -114,7 +128,7 @@ public class Scribe {
super(protocolFactory, clientManager, transport);
}
- public void Log(List<LogEntry> messages, org.apache.thrift.async.AsyncMethodCallback<Log_call> resultHandler) throws org.apache.thrift.TException {
+ public void Log(List<LogEntry> messages, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
checkReady();
Log_call method_call = new Log_call(messages, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
@@ -123,7 +137,7 @@ public class Scribe {
public static class Log_call extends org.apache.thrift.async.TAsyncMethodCall {
private List<LogEntry> messages;
- public Log_call(List<LogEntry> messages, org.apache.thrift.async.AsyncMethodCallback<Log_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ public Log_call(List<LogEntry> messages, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
super(client, protocolFactory, transport, resultHandler, false);
this.messages = messages;
}
@@ -148,7 +162,7 @@ public class Scribe {
}
- public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor implements org.apache.thrift.TProcessor {
+ 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>>()));
@@ -163,7 +177,7 @@ public class Scribe {
return processMap;
}
- private static class Log<I extends Iface> extends org.apache.thrift.ProcessFunction<I, Log_args> {
+ public static class Log<I extends Iface> extends org.apache.thrift.ProcessFunction<I, Log_args> {
public Log() {
super("Log");
}
@@ -172,25 +186,98 @@ public class Scribe {
return new Log_args();
}
- public Log_result getResult(I iface, Log_args args) throws org.apache
- .thrift.TException {
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public Log_result getResult(I iface, Log_args args) throws org.apache.thrift.TException {
Log_result result = new Log_result();
result.success = iface.Log(args.messages);
return result;
}
+ }
+
+ }
+
+ public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
+ private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName());
+ public AsyncProcessor(I iface) {
+ super(iface, getProcessMap(new HashMap<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>()));
+ }
+
+ protected AsyncProcessor(I iface, Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) {
+ super(iface, getProcessMap(processMap));
+ }
+
+ private static <I extends AsyncIface> Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase,?>> getProcessMap(Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) {
+ processMap.put("Log", new Log());
+ return processMap;
+ }
+
+ public static class Log<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, Log_args, ResultCode> {
+ public Log() {
+ super("Log");
+ }
+
+ public Log_args getEmptyArgsInstance() {
+ return new Log_args();
+ }
+
+ public AsyncMethodCallback<ResultCode> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback<ResultCode>() {
+ public void onComplete(ResultCode o) {
+ Log_result result = new Log_result();
+ result.success = o;
+ try {
+ fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+ return;
+ } catch (Exception e) {
+ LOGGER.error("Exception writing to internal frame buffer", e);
+ }
+ fb.close();
+ }
+ public void onError(Exception e) {
+ byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+ org.apache.thrift.TBase msg;
+ Log_result result = new Log_result();
+ {
+ msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+ msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+ }
+ try {
+ fcall.sendResponse(fb,msg,msgType,seqid);
+ return;
+ } catch (Exception ex) {
+ LOGGER.error("Exception writing to internal frame buffer", ex);
+ }
+ fb.close();
+ }
+ };
+ }
- public boolean isOneway() {
+ protected boolean isOneway() {
return false;
}
+
+ public void start(I iface, Log_args args, org.apache.thrift.async.AsyncMethodCallback<ResultCode> resultHandler) throws TException {
+ iface.Log(args.messages,resultHandler);
+ }
}
}
- public static class Log_args implements org.apache.thrift.TBase<Log_args, Log_args._Fields>, java.io.Serializable, Cloneable {
+ public static class Log_args implements org.apache.thrift.TBase<Log_args, Log_args._Fields>, java.io.Serializable, Cloneable, Comparable<Log_args> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Log_args");
private static final org.apache.thrift.protocol.TField MESSAGES_FIELD_DESC = new org.apache.thrift.protocol.TField("messages", 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 Log_argsStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new Log_argsTupleSchemeFactory());
+ }
+
public List<LogEntry> messages; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
@@ -252,7 +339,6 @@ public class Scribe {
}
// 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);
@@ -278,7 +364,7 @@ public class Scribe {
*/
public Log_args(Log_args other) {
if (other.isSetMessages()) {
- List<LogEntry> __this__messages = new ArrayList<LogEntry>();
+ List<LogEntry> __this__messages = new ArrayList<LogEntry>(other.messages.size());
for (LogEntry other_element : other.messages) {
__this__messages.add(new LogEntry(other_element));
}
@@ -396,30 +482,30 @@ public class Scribe {
@Override
public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
+ List<Object> list = new ArrayList<Object>();
boolean present_messages = true && (isSetMessages());
- builder.append(present_messages);
+ list.add(present_messages);
if (present_messages)
- builder.append(messages);
+ list.add(messages);
- return builder.toHashCode();
+ return list.hashCode();
}
+ @Override
public int compareTo(Log_args other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
- Log_args typedOther = (Log_args)other;
- lastComparison = Boolean.valueOf(isSetMessages()).compareTo(typedOther.isSetMessages());
+ lastComparison = Boolean.valueOf(isSetMessages()).compareTo(other.isSetMessages());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetMessages()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.messages, typedOther.messages);
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.messages, other.messages);
if (lastComparison != 0) {
return lastComparison;
}
@@ -432,62 +518,11 @@ public class Scribe {
}
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: // MESSAGES
- if (field.type == org.apache.thrift.protocol.TType.LIST) {
- {
- org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
- this.messages = new ArrayList<LogEntry>(_list0.size);
- for (int _i1 = 0; _i1 < _list0.size; ++_i1)
- {
- LogEntry _elem2; // required
- _elem2 = new LogEntry();
- _elem2.read(iprot);
- this.messages.add(_elem2);
- }
- 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();
+ 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.messages != null) {
- oprot.writeFieldBegin(MESSAGES_FIELD_DESC);
- {
- oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.messages.size()));
- for (LogEntry _iter3 : this.messages)
- {
- _iter3.write(oprot);
- }
- oprot.writeListEnd();
- }
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -508,6 +543,7 @@ public class Scribe {
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 {
@@ -526,13 +562,137 @@ public class Scribe {
}
}
+ private static class Log_argsStandardSchemeFactory implements SchemeFactory {
+ public Log_argsStandardScheme getScheme() {
+ return new Log_argsStandardScheme();
+ }
+ }
+
+ private static class Log_argsStandardScheme extends StandardScheme<Log_args> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, Log_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: // MESSAGES
+ if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+ {
+ org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
+ struct.messages = new ArrayList<LogEntry>(_list0.size);
+ LogEntry _elem1;
+ for (int _i2 = 0; _i2 < _list0.size; ++_i2)
+ {
+ _elem1 = new LogEntry();
+ _elem1.read(iprot);
+ struct.messages.add(_elem1);
+ }
+ iprot.readListEnd();
+ }
+ struct.setMessagesIsSet(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, Log_args struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.messages != null) {
+ oprot.writeFieldBegin(MESSAGES_FIELD_DESC);
+ {
+ oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.messages.size()));
+ for (LogEntry _iter3 : struct.messages)
+ {
+ _iter3.write(oprot);
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class Log_argsTupleSchemeFactory implements SchemeFactory {
+ public Log_argsTupleScheme getScheme() {
+ return new Log_argsTupleScheme();
+ }
+ }
+
+ private static class Log_argsTupleScheme extends TupleScheme<Log_args> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, Log_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetMessages()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetMessages()) {
+ {
+ oprot.writeI32(struct.messages.size());
+ for (LogEntry _iter4 : struct.messages)
+ {
+ _iter4.write(oprot);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, Log_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 _list5 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.messages = new ArrayList<LogEntry>(_list5.size);
+ LogEntry _elem6;
+ for (int _i7 = 0; _i7 < _list5.size; ++_i7)
+ {
+ _elem6 = new LogEntry();
+ _elem6.read(iprot);
+ struct.messages.add(_elem6);
+ }
+ }
+ struct.setMessagesIsSet(true);
+ }
+ }
+ }
+
}
- public static class Log_result implements org.apache.thrift.TBase<Log_result, Log_result._Fields>, java.io.Serializable, Cloneable {
+ public static class Log_result implements org.apache.thrift.TBase<Log_result, Log_result._Fields>, java.io.Serializable, Cloneable, Comparable<Log_result> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Log_result");
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 Log_resultStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new Log_resultTupleSchemeFactory());
+ }
+
/**
*
* @see ResultCode
@@ -602,7 +762,6 @@ public class Scribe {
}
// 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);
@@ -734,30 +893,30 @@ public class Scribe {
@Override
public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
+ List<Object> list = new ArrayList<Object>();
boolean present_success = true && (isSetSuccess());
- builder.append(present_success);
+ list.add(present_success);
if (present_success)
- builder.append(success.getValue());
+ list.add(success.getValue());
- return builder.toHashCode();
+ return list.hashCode();
}
+ @Override
public int compareTo(Log_result other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
- Log_result typedOther = (Log_result)other;
- lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
+ lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSuccess()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
if (lastComparison != 0) {
return lastComparison;
}
@@ -770,44 +929,12 @@ public class Scribe {
}
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 0: // SUCCESS
- if (field.type == org.apache.thrift.protocol.TType.I32) {
- this.success = ResultCode.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();
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- oprot.writeStructBegin(STRUCT_DESC);
-
- if (this.isSetSuccess()) {
- oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
- oprot.writeI32(this.success.getValue());
- oprot.writeFieldEnd();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
@Override
public String toString() {
@@ -827,6 +954,7 @@ public class Scribe {
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 {
@@ -845,6 +973,90 @@ public class Scribe {
}
}
+ private static class Log_resultStandardSchemeFactory implements SchemeFactory {
+ public Log_resultStandardScheme getScheme() {
+ return new Log_resultStandardScheme();
+ }
+ }
+
+ private static class Log_resultStandardScheme extends StandardScheme<Log_result> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, Log_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 = org.apache.flume.source.scribe.ResultCode.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, Log_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 Log_resultTupleSchemeFactory implements SchemeFactory {
+ public Log_resultTupleScheme getScheme() {
+ return new Log_resultTupleScheme();
+ }
+ }
+
+ private static class Log_resultTupleScheme extends TupleScheme<Log_result> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, Log_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, Log_result struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.success = org.apache.flume.source.scribe.ResultCode.findByValue(iprot.readI32());
+ struct.setSuccessIsSet(true);
+ }
+ }
+ }
+
}
}
http://git-wip-us.apache.org/repos/asf/flume/blob/773555c5/flume-ng-sources/flume-scribe-source/src/main/java/org/apache/flume/source/scribe/ScribeSource.java
----------------------------------------------------------------------
diff --git a/flume-ng-sources/flume-scribe-source/src/main/java/org/apache/flume/source/scribe/ScribeSource.java b/flume-ng-sources/flume-scribe-source/src/main/java/org/apache/flume/source/scribe/ScribeSource.java
index 1d7da09..551fe1f 100644
--- a/flume-ng-sources/flume-scribe-source/src/main/java/org/apache/flume/source/scribe/ScribeSource.java
+++ b/flume-ng-sources/flume-scribe-source/src/main/java/org/apache/flume/source/scribe/ScribeSource.java
@@ -96,7 +96,8 @@ public class ScribeSource extends AbstractSource implements
TNonblockingServerTransport transport = new TNonblockingServerSocket(port);
THsHaServer.Args args = new THsHaServer.Args(transport);
- args.workerThreads(workers);
+ args.minWorkerThreads(workers);
+ args.maxWorkerThreads(workers);
args.processor(processor);
args.transportFactory(new TFramedTransport.Factory(maxReadBufferBytes));
args.protocolFactory(new TBinaryProtocol.Factory(false, false));
http://git-wip-us.apache.org/repos/asf/flume/blob/773555c5/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index e901248..ab9fe53 100644
--- a/pom.xml
+++ b/pom.xml
@@ -107,7 +107,7 @@ limitations under the License.
<solr-global.version>4.3.0</solr-global.version>
<slf4j.version>1.6.1</slf4j.version>
<system-rules.version>1.16.0</system-rules.version>
- <thrift.version>0.7.0</thrift.version>
+ <thrift.version>0.9.3</thrift.version>
<twitter4j.version>3.0.3</twitter4j.version>
<xalan.version>2.7.2</xalan.version>
<xerces.version>2.9.1</xerces.version>
@@ -197,7 +197,6 @@ limitations under the License.
<hadoop.version>${hadoop2.version}</hadoop.version>
<hbase.version>0.94.2</hbase.version>
<hadoop.common.artifact.id>hadoop-common</hadoop.common.artifact.id>
- <thrift.version>0.9.0</thrift.version>
</properties>
<dependencyManagement>
<dependencies>
@@ -299,7 +298,6 @@ limitations under the License.
<hadoop.version>${hadoop2.version}</hadoop.version>
<hbase.version>1.0.0</hbase.version>
<hadoop.common.artifact.id>hadoop-common</hadoop.common.artifact.id>
- <thrift.version>0.9.0</thrift.version>
</properties>
<dependencyManagement>
<dependencies>
[2/2] flume git commit: FLUME-3127. Upgrade libfb303 library
dependency
Posted by de...@apache.org.
FLUME-3127. Upgrade libfb303 library dependency
- thrift version changed to 0.9.3
- thrift objects generated with the new version
- deprecated method calls updated in ScribeSource
- cross-compatibility tested with Flume 1.6 and 1.7
This closes #163
Reviewers: Denes Arvay
(Ferenc Szabo via Denes Arvay)
Project: http://git-wip-us.apache.org/repos/asf/flume/repo
Commit: http://git-wip-us.apache.org/repos/asf/flume/commit/773555c5
Tree: http://git-wip-us.apache.org/repos/asf/flume/tree/773555c5
Diff: http://git-wip-us.apache.org/repos/asf/flume/diff/773555c5
Branch: refs/heads/trunk
Commit: 773555c5c7d09650f8f4173ced232954b1a3a361
Parents: d355262
Author: Ferenc Szabo <fs...@cloudera.com>
Authored: Fri Sep 1 16:16:08 2017 +0200
Committer: Denes Arvay <de...@apache.org>
Committed: Mon Sep 11 14:33:31 2017 +0200
----------------------------------------------------------------------
.../flume/handlers/thrift/EventStatus.java | 3 +-
.../flume/handlers/thrift/Priority.java | 3 +-
.../flume/handlers/thrift/ThriftFlumeEvent.java | 476 +++++++----
.../handlers/thrift/ThriftFlumeEventServer.java | 500 +++++++++---
.../java/org/apache/flume/thrift/Status.java | 3 +-
.../apache/flume/thrift/ThriftFlumeEvent.java | 269 ++++---
.../flume/thrift/ThriftSourceProtocol.java | 806 ++++++++++++++-----
.../apache/flume/source/scribe/LogEntry.java | 206 +++--
.../apache/flume/source/scribe/ResultCode.java | 3 +-
.../org/apache/flume/source/scribe/Scribe.java | 444 +++++++---
.../flume/source/scribe/ScribeSource.java | 3 +-
pom.xml | 4 +-
12 files changed, 1928 insertions(+), 792 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flume/blob/773555c5/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 7af9e77..fa05210 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,9 +17,10 @@
* under the License.
*/
/**
- * Autogenerated by Thrift Compiler (0.7.0)
+ * Autogenerated by Thrift Compiler (0.9.3)
*
* 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/773555c5/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 40826dc..46d4a5b 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,9 +17,10 @@
* under the License.
*/
/**
- * Autogenerated by Thrift Compiler (0.7.0)
+ * Autogenerated by Thrift Compiler (0.9.3)
*
* 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/773555c5/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 f83cba4..1649abd 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,13 +17,24 @@
* under the License.
*/
/**
- * Autogenerated by Thrift Compiler (0.7.0)
+ * Autogenerated by Thrift Compiler (0.9.3)
*
* 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 org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
@@ -36,10 +47,13 @@ import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
+import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEvent, ThriftFlumeEvent._Fields>, java.io.Serializable, Cloneable {
+@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2017-09-01")
+public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEvent, ThriftFlumeEvent._Fields>, java.io.Serializable, Cloneable, Comparable<ThriftFlumeEvent> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ThriftFlumeEvent");
private static final org.apache.thrift.protocol.TField TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("timestamp", org.apache.thrift.protocol.TType.I64, (short)1);
@@ -49,6 +63,12 @@ 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
/**
*
@@ -140,8 +160,7 @@ 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 BitSet __isset_bit_vector = new BitSet(2);
-
+ private byte __isset_bitfield = 0;
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);
@@ -178,7 +197,7 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven
this.timestamp = timestamp;
setTimestampIsSet(true);
this.priority = priority;
- this.body = body;
+ this.body = org.apache.thrift.TBaseHelper.copyBinary(body);
this.nanos = nanos;
setNanosIsSet(true);
this.host = host;
@@ -189,34 +208,20 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven
* Performs a deep copy on <i>other</i>.
*/
public ThriftFlumeEvent(ThriftFlumeEvent other) {
- __isset_bit_vector.clear();
- __isset_bit_vector.or(other.__isset_bit_vector);
+ __isset_bitfield = other.__isset_bitfield;
this.timestamp = other.timestamp;
if (other.isSetPriority()) {
this.priority = other.priority;
}
if (other.isSetBody()) {
this.body = org.apache.thrift.TBaseHelper.copyBinary(other.body);
-;
}
this.nanos = other.nanos;
if (other.isSetHost()) {
this.host = other.host;
}
if (other.isSetFields()) {
- Map<String,ByteBuffer> __this__fields = new HashMap<String,ByteBuffer>();
- for (Map.Entry<String, ByteBuffer> other_element : other.fields.entrySet()) {
-
- String other_element_key = other_element.getKey();
- ByteBuffer other_element_value = other_element.getValue();
-
- String __this__fields_copy_key = other_element_key;
-
- ByteBuffer __this__fields_copy_value = org.apache.thrift.TBaseHelper.copyBinary(other_element_value);
-;
-
- __this__fields.put(__this__fields_copy_key, __this__fields_copy_value);
- }
+ Map<String,ByteBuffer> __this__fields = new HashMap<String,ByteBuffer>(other.fields);
this.fields = __this__fields;
}
}
@@ -248,16 +253,16 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven
}
public void unsetTimestamp() {
- __isset_bit_vector.clear(__TIMESTAMP_ISSET_ID);
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TIMESTAMP_ISSET_ID);
}
/** Returns true if field timestamp is set (has been assigned a value) and false otherwise */
public boolean isSetTimestamp() {
- return __isset_bit_vector.get(__TIMESTAMP_ISSET_ID);
+ return EncodingUtils.testBit(__isset_bitfield, __TIMESTAMP_ISSET_ID);
}
public void setTimestampIsSet(boolean value) {
- __isset_bit_vector.set(__TIMESTAMP_ISSET_ID, value);
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TIMESTAMP_ISSET_ID, value);
}
/**
@@ -298,16 +303,16 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven
}
public ByteBuffer bufferForBody() {
- return body;
+ return org.apache.thrift.TBaseHelper.copyBinary(body);
}
public ThriftFlumeEvent setBody(byte[] body) {
- setBody(body == null ? (ByteBuffer)null : ByteBuffer.wrap(body));
+ this.body = body == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(body, body.length));
return this;
}
public ThriftFlumeEvent setBody(ByteBuffer body) {
- this.body = body;
+ this.body = org.apache.thrift.TBaseHelper.copyBinary(body);
return this;
}
@@ -337,16 +342,16 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven
}
public void unsetNanos() {
- __isset_bit_vector.clear(__NANOS_ISSET_ID);
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __NANOS_ISSET_ID);
}
/** Returns true if field nanos is set (has been assigned a value) and false otherwise */
public boolean isSetNanos() {
- return __isset_bit_vector.get(__NANOS_ISSET_ID);
+ return EncodingUtils.testBit(__isset_bitfield, __NANOS_ISSET_ID);
}
public void setNanosIsSet(boolean value) {
- __isset_bit_vector.set(__NANOS_ISSET_ID, value);
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __NANOS_ISSET_ID, value);
}
public String getHost() {
@@ -464,7 +469,7 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven
public Object getFieldValue(_Fields field) {
switch (field) {
case TIMESTAMP:
- return Long.valueOf(getTimestamp());
+ return getTimestamp();
case PRIORITY:
return getPriority();
@@ -473,7 +478,7 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven
return getBody();
case NANOS:
- return Long.valueOf(getNanos());
+ return getNanos();
case HOST:
return getHost();
@@ -580,105 +585,105 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven
@Override
public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
+ List<Object> list = new ArrayList<Object>();
boolean present_timestamp = true;
- builder.append(present_timestamp);
+ list.add(present_timestamp);
if (present_timestamp)
- builder.append(timestamp);
+ list.add(timestamp);
boolean present_priority = true && (isSetPriority());
- builder.append(present_priority);
+ list.add(present_priority);
if (present_priority)
- builder.append(priority.getValue());
+ list.add(priority.getValue());
boolean present_body = true && (isSetBody());
- builder.append(present_body);
+ list.add(present_body);
if (present_body)
- builder.append(body);
+ list.add(body);
boolean present_nanos = true;
- builder.append(present_nanos);
+ list.add(present_nanos);
if (present_nanos)
- builder.append(nanos);
+ list.add(nanos);
boolean present_host = true && (isSetHost());
- builder.append(present_host);
+ list.add(present_host);
if (present_host)
- builder.append(host);
+ list.add(host);
boolean present_fields = true && (isSetFields());
- builder.append(present_fields);
+ list.add(present_fields);
if (present_fields)
- builder.append(fields);
+ list.add(fields);
- return builder.toHashCode();
+ return list.hashCode();
}
+ @Override
public int compareTo(ThriftFlumeEvent other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
- ThriftFlumeEvent typedOther = (ThriftFlumeEvent)other;
- lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(typedOther.isSetTimestamp());
+ lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(other.isSetTimestamp());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetTimestamp()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timestamp, typedOther.timestamp);
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timestamp, other.timestamp);
if (lastComparison != 0) {
return lastComparison;
}
}
- lastComparison = Boolean.valueOf(isSetPriority()).compareTo(typedOther.isSetPriority());
+ lastComparison = Boolean.valueOf(isSetPriority()).compareTo(other.isSetPriority());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetPriority()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.priority, typedOther.priority);
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.priority, other.priority);
if (lastComparison != 0) {
return lastComparison;
}
}
- lastComparison = Boolean.valueOf(isSetBody()).compareTo(typedOther.isSetBody());
+ lastComparison = Boolean.valueOf(isSetBody()).compareTo(other.isSetBody());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetBody()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.body, typedOther.body);
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.body, other.body);
if (lastComparison != 0) {
return lastComparison;
}
}
- lastComparison = Boolean.valueOf(isSetNanos()).compareTo(typedOther.isSetNanos());
+ lastComparison = Boolean.valueOf(isSetNanos()).compareTo(other.isSetNanos());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetNanos()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nanos, typedOther.nanos);
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nanos, other.nanos);
if (lastComparison != 0) {
return lastComparison;
}
}
- lastComparison = Boolean.valueOf(isSetHost()).compareTo(typedOther.isSetHost());
+ lastComparison = Boolean.valueOf(isSetHost()).compareTo(other.isSetHost());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetHost()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.host, typedOther.host);
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.host, other.host);
if (lastComparison != 0) {
return lastComparison;
}
}
- lastComparison = Boolean.valueOf(isSetFields()).compareTo(typedOther.isSetFields());
+ lastComparison = Boolean.valueOf(isSetFields()).compareTo(other.isSetFields());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetFields()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fields, typedOther.fields);
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fields, other.fields);
if (lastComparison != 0) {
return lastComparison;
}
@@ -691,122 +696,11 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven
}
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: // 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();
+ 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(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();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -859,6 +753,7 @@ 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 {
@@ -872,12 +767,245 @@ 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_bit_vector = new BitSet(1);
+ __isset_bitfield = 0;
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 = com.cloudera.flume.handlers.thrift.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);
+ String _key1;
+ ByteBuffer _val2;
+ for (int _i3 = 0; _i3 < _map0.size; ++_i3)
+ {
+ _key1 = iprot.readString();
+ _val2 = iprot.readBinary();
+ struct.fields.put(_key1, _val2);
+ }
+ 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 = com.cloudera.flume.handlers.thrift.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);
+ String _key7;
+ ByteBuffer _val8;
+ for (int _i9 = 0; _i9 < _map6.size; ++_i9)
+ {
+ _key7 = iprot.readString();
+ _val8 = iprot.readBinary();
+ struct.fields.put(_key7, _val8);
+ }
+ }
+ struct.setFieldsIsSet(true);
+ }
+ }
+ }
+
}
http://git-wip-us.apache.org/repos/asf/flume/blob/773555c5/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 3bf632a..dbc2417 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,13 +17,24 @@
* under the License.
*/
/**
- * Autogenerated by Thrift Compiler (0.7.0)
+ * Autogenerated by Thrift Compiler (0.9.3)
*
* 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 org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
@@ -36,9 +47,12 @@ import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
+import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2017-09-01")
public class ThriftFlumeEventServer {
public interface Iface {
@@ -51,9 +65,9 @@ public class ThriftFlumeEventServer {
public interface AsyncIface {
- public void append(ThriftFlumeEvent evt, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.append_call> resultHandler) throws org.apache.thrift.TException;
+ public void append(ThriftFlumeEvent evt, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
- public void close(org.apache.thrift.async.AsyncMethodCallback<AsyncClient.close_call> resultHandler) throws org.apache.thrift.TException;
+ public void close(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
}
@@ -86,7 +100,7 @@ public class ThriftFlumeEventServer {
{
append_args args = new append_args();
args.setEvt(evt);
- sendBase("append", args);
+ sendBaseOneway("append", args);
}
public void close() throws org.apache.thrift.TException
@@ -126,7 +140,7 @@ public class ThriftFlumeEventServer {
super(protocolFactory, clientManager, transport);
}
- public void append(ThriftFlumeEvent evt, org.apache.thrift.async.AsyncMethodCallback<append_call> resultHandler) throws org.apache.thrift.TException {
+ public void append(ThriftFlumeEvent evt, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
checkReady();
append_call method_call = new append_call(evt, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
@@ -135,13 +149,13 @@ public class ThriftFlumeEventServer {
public static class append_call extends org.apache.thrift.async.TAsyncMethodCall {
private ThriftFlumeEvent evt;
- public append_call(ThriftFlumeEvent evt, org.apache.thrift.async.AsyncMethodCallback<append_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ public append_call(ThriftFlumeEvent evt, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
super(client, protocolFactory, transport, resultHandler, true);
this.evt = evt;
}
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
- prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("append", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("append", org.apache.thrift.protocol.TMessageType.ONEWAY, 0));
append_args args = new append_args();
args.setEvt(evt);
args.write(prot);
@@ -157,7 +171,7 @@ public class ThriftFlumeEventServer {
}
}
- public void close(org.apache.thrift.async.AsyncMethodCallback<close_call> resultHandler) throws org.apache.thrift.TException {
+ public void close(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
checkReady();
close_call method_call = new close_call(resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
@@ -165,7 +179,7 @@ public class ThriftFlumeEventServer {
}
public static class close_call extends org.apache.thrift.async.TAsyncMethodCall {
- public close_call(org.apache.thrift.async.AsyncMethodCallback<close_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ public close_call(org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
super(client, protocolFactory, transport, resultHandler, false);
}
@@ -188,7 +202,7 @@ public class ThriftFlumeEventServer {
}
- public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor implements org.apache.thrift.TProcessor {
+ 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>>()));
@@ -204,7 +218,7 @@ public class ThriftFlumeEventServer {
return processMap;
}
- private static class append<I extends Iface> extends org.apache.thrift.ProcessFunction<I, append_args> {
+ public static class append<I extends Iface> extends org.apache.thrift.ProcessFunction<I, append_args> {
public append() {
super("append");
}
@@ -213,18 +227,17 @@ public class ThriftFlumeEventServer {
return new append_args();
}
- public org.apache.thrift.TBase getResult(I iface,
- append_args args) throws org.apache.thrift.TException {
- iface.append(args.evt);
- return null;
+ protected boolean isOneway() {
+ return true;
}
- public boolean isOneway() {
- return false;
+ public org.apache.thrift.TBase getResult(I iface, append_args args) throws org.apache.thrift.TException {
+ iface.append(args.evt);
+ return null;
}
}
- private static class close<I extends Iface> extends org.apache.thrift.ProcessFunction<I, close_args> {
+ public static class close<I extends Iface> extends org.apache.thrift.ProcessFunction<I, close_args> {
public close() {
super("close");
}
@@ -233,25 +246,126 @@ public class ThriftFlumeEventServer {
return new close_args();
}
- public close_result getResult(I iface, close_args args) throws org.apache
- .thrift.TException {
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public close_result getResult(I iface, close_args args) throws org.apache.thrift.TException {
close_result result = new close_result();
iface.close();
return result;
}
+ }
+
+ }
+
+ public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
+ private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName());
+ public AsyncProcessor(I iface) {
+ super(iface, getProcessMap(new HashMap<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>()));
+ }
+
+ protected AsyncProcessor(I iface, Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) {
+ super(iface, getProcessMap(processMap));
+ }
+
+ private static <I extends AsyncIface> Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase,?>> getProcessMap(Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) {
+ processMap.put("append", new append());
+ processMap.put("close", new close());
+ return processMap;
+ }
- public boolean isOneway() {
+ public static class append<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, append_args, Void> {
+ public append() {
+ super("append");
+ }
+
+ public append_args getEmptyArgsInstance() {
+ return new append_args();
+ }
+
+ public AsyncMethodCallback<Void> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback<Void>() {
+ public void onComplete(Void o) {
+ }
+ public void onError(Exception e) {
+ }
+ };
+ }
+
+ protected boolean isOneway() {
+ return true;
+ }
+
+ public void start(I iface, append_args args, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws TException {
+ iface.append(args.evt,resultHandler);
+ }
+ }
+
+ public static class close<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, close_args, Void> {
+ public close() {
+ super("close");
+ }
+
+ public close_args getEmptyArgsInstance() {
+ return new close_args();
+ }
+
+ public AsyncMethodCallback<Void> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback<Void>() {
+ public void onComplete(Void o) {
+ close_result result = new close_result();
+ try {
+ fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+ return;
+ } catch (Exception e) {
+ LOGGER.error("Exception writing to internal frame buffer", e);
+ }
+ fb.close();
+ }
+ public void onError(Exception e) {
+ byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+ org.apache.thrift.TBase msg;
+ close_result result = new close_result();
+ {
+ msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+ msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+ }
+ try {
+ fcall.sendResponse(fb,msg,msgType,seqid);
+ return;
+ } catch (Exception ex) {
+ LOGGER.error("Exception writing to internal frame buffer", ex);
+ }
+ fb.close();
+ }
+ };
+ }
+
+ protected boolean isOneway() {
return false;
}
+
+ public void start(I iface, close_args args, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws TException {
+ iface.close(resultHandler);
+ }
}
}
- public static class append_args implements org.apache.thrift.TBase<append_args, append_args._Fields>, java.io.Serializable, Cloneable {
+ public static class append_args implements org.apache.thrift.TBase<append_args, append_args._Fields>, java.io.Serializable, Cloneable, Comparable<append_args> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("append_args");
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. */
@@ -313,7 +427,6 @@ 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);
@@ -437,30 +550,30 @@ public class ThriftFlumeEventServer {
@Override
public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
+ List<Object> list = new ArrayList<Object>();
boolean present_evt = true && (isSetEvt());
- builder.append(present_evt);
+ list.add(present_evt);
if (present_evt)
- builder.append(evt);
+ list.add(evt);
- return builder.toHashCode();
+ return list.hashCode();
}
+ @Override
public int compareTo(append_args other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
- append_args typedOther = (append_args)other;
- lastComparison = Boolean.valueOf(isSetEvt()).compareTo(typedOther.isSetEvt());
+ lastComparison = Boolean.valueOf(isSetEvt()).compareTo(other.isSetEvt());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetEvt()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.evt, typedOther.evt);
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.evt, other.evt);
if (lastComparison != 0) {
return lastComparison;
}
@@ -473,45 +586,11 @@ public class ThriftFlumeEventServer {
}
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: // 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();
+ 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.evt != null) {
- oprot.writeFieldBegin(EVT_FIELD_DESC);
- this.evt.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -532,6 +611,10 @@ 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 {
@@ -550,12 +633,104 @@ 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 {
+ public static class close_args implements org.apache.thrift.TBase<close_args, close_args._Fields>, java.io.Serializable, Cloneable, Comparable<close_args> {
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 {
@@ -676,18 +851,18 @@ public class ThriftFlumeEventServer {
@Override
public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
+ List<Object> list = new ArrayList<Object>();
- return builder.toHashCode();
+ return list.hashCode();
}
+ @Override
public int compareTo(close_args other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
- close_args typedOther = (close_args)other;
return 0;
}
@@ -697,32 +872,11 @@ public class ThriftFlumeEventServer {
}
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) {
- 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.writeFieldStop();
- oprot.writeStructEnd();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -736,6 +890,7 @@ 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 {
@@ -754,12 +909,76 @@ 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 {
+ public static class close_result implements org.apache.thrift.TBase<close_result, close_result._Fields>, java.io.Serializable, Cloneable, Comparable<close_result> {
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 {
@@ -880,18 +1099,18 @@ public class ThriftFlumeEventServer {
@Override
public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
+ List<Object> list = new ArrayList<Object>();
- return builder.toHashCode();
+ return list.hashCode();
}
+ @Override
public int compareTo(close_result other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
- close_result typedOther = (close_result)other;
return 0;
}
@@ -901,32 +1120,12 @@ public class ThriftFlumeEventServer {
}
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) {
- 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 {
- oprot.writeStructBegin(STRUCT_DESC);
-
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+ }
@Override
public String toString() {
@@ -939,6 +1138,7 @@ 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 {
@@ -957,6 +1157,64 @@ 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/773555c5/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 634c323..9118d35 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,9 +17,10 @@
* under the License.
*/
/**
- * Autogenerated by Thrift Compiler (0.7.0)
+ * Autogenerated by Thrift Compiler (0.9.3)
*
* 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/773555c5/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 fc0b678..1eeea84 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,13 +17,24 @@
* under the License.
*/
/**
- * Autogenerated by Thrift Compiler (0.7.0)
+ * Autogenerated by Thrift Compiler (0.9.3)
*
* 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 org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
@@ -36,15 +47,24 @@ import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
+import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEvent, ThriftFlumeEvent._Fields>, java.io.Serializable, Cloneable {
+@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2017-09-01")
+public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEvent, ThriftFlumeEvent._Fields>, java.io.Serializable, Cloneable, Comparable<ThriftFlumeEvent> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ThriftFlumeEvent");
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
@@ -110,7 +130,6 @@ 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);
@@ -133,7 +152,7 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven
{
this();
this.headers = headers;
- this.body = body;
+ this.body = org.apache.thrift.TBaseHelper.copyBinary(body);
}
/**
@@ -141,23 +160,11 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven
*/
public ThriftFlumeEvent(ThriftFlumeEvent other) {
if (other.isSetHeaders()) {
- Map<String,String> __this__headers = new HashMap<String,String>();
- for (Map.Entry<String, String> other_element : other.headers.entrySet()) {
-
- String other_element_key = other_element.getKey();
- String other_element_value = other_element.getValue();
-
- String __this__headers_copy_key = other_element_key;
-
- String __this__headers_copy_value = other_element_value;
-
- __this__headers.put(__this__headers_copy_key, __this__headers_copy_value);
- }
+ Map<String,String> __this__headers = new HashMap<String,String>(other.headers);
this.headers = __this__headers;
}
if (other.isSetBody()) {
this.body = org.apache.thrift.TBaseHelper.copyBinary(other.body);
-;
}
}
@@ -212,16 +219,16 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven
}
public ByteBuffer bufferForBody() {
- return body;
+ return org.apache.thrift.TBaseHelper.copyBinary(body);
}
public ThriftFlumeEvent setBody(byte[] body) {
- setBody(body == null ? (ByteBuffer)null : ByteBuffer.wrap(body));
+ this.body = body == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(body, body.length));
return this;
}
public ThriftFlumeEvent setBody(ByteBuffer body) {
- this.body = body;
+ this.body = org.apache.thrift.TBaseHelper.copyBinary(body);
return this;
}
@@ -324,45 +331,45 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven
@Override
public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
+ List<Object> list = new ArrayList<Object>();
boolean present_headers = true && (isSetHeaders());
- builder.append(present_headers);
+ list.add(present_headers);
if (present_headers)
- builder.append(headers);
+ list.add(headers);
boolean present_body = true && (isSetBody());
- builder.append(present_body);
+ list.add(present_body);
if (present_body)
- builder.append(body);
+ list.add(body);
- return builder.toHashCode();
+ return list.hashCode();
}
+ @Override
public int compareTo(ThriftFlumeEvent other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
- ThriftFlumeEvent typedOther = (ThriftFlumeEvent)other;
- lastComparison = Boolean.valueOf(isSetHeaders()).compareTo(typedOther.isSetHeaders());
+ lastComparison = Boolean.valueOf(isSetHeaders()).compareTo(other.isSetHeaders());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetHeaders()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.headers, typedOther.headers);
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.headers, other.headers);
if (lastComparison != 0) {
return lastComparison;
}
}
- lastComparison = Boolean.valueOf(isSetBody()).compareTo(typedOther.isSetBody());
+ lastComparison = Boolean.valueOf(isSetBody()).compareTo(other.isSetBody());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetBody()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.body, typedOther.body);
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.body, other.body);
if (lastComparison != 0) {
return lastComparison;
}
@@ -375,76 +382,11 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven
}
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: // 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();
+ 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.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();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -479,6 +421,7 @@ 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 {
@@ -497,5 +440,133 @@ 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);
+ String _key1;
+ String _val2;
+ for (int _i3 = 0; _i3 < _map0.size; ++_i3)
+ {
+ _key1 = iprot.readString();
+ _val2 = iprot.readString();
+ struct.headers.put(_key1, _val2);
+ }
+ 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);
+ String _key7;
+ String _val8;
+ for (int _i9 = 0; _i9 < _map6.size; ++_i9)
+ {
+ _key7 = iprot.readString();
+ _val8 = iprot.readString();
+ struct.headers.put(_key7, _val8);
+ }
+ }
+ struct.setHeadersIsSet(true);
+ struct.body = iprot.readBinary();
+ struct.setBodyIsSet(true);
+ }
+ }
+
}