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>
