http://git-wip-us.apache.org/repos/asf/accumulo/blob/62bbce43/core/src/main/java/org/apache/accumulo/core/replication/thrift/ReplicationCoordinator.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/replication/thrift/ReplicationCoordinator.java b/core/src/main/java/org/apache/accumulo/core/replication/thrift/ReplicationCoordinator.java index 0ceabcf..c15ba25 100644 --- a/core/src/main/java/org/apache/accumulo/core/replication/thrift/ReplicationCoordinator.java +++ b/core/src/main/java/org/apache/accumulo/core/replication/thrift/ReplicationCoordinator.java @@ -15,57 +15,30 @@ * limitations under the License. */ /** - * Autogenerated by Thrift Compiler (0.9.3) + * Autogenerated by Thrift Compiler (0.10.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package org.apache.accumulo.core.replication.thrift; -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; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import javax.annotation.Generated; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.10.0)") public class ReplicationCoordinator { public interface Iface { - public String getServicerAddress(String remoteTableId, org.apache.accumulo.core.security.thrift.TCredentials credentials) throws ReplicationCoordinatorException, org.apache.thrift.TException; + public java.lang.String getServicerAddress(java.lang.String remoteTableId, org.apache.accumulo.core.security.thrift.TCredentials credentials) throws ReplicationCoordinatorException, org.apache.thrift.TException; } public interface AsyncIface { - public void getServicerAddress(String remoteTableId, org.apache.accumulo.core.security.thrift.TCredentials credentials, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void getServicerAddress(java.lang.String remoteTableId, org.apache.accumulo.core.security.thrift.TCredentials credentials, org.apache.thrift.async.AsyncMethodCallback<java.lang.String> resultHandler) throws org.apache.thrift.TException; } - public static class Client extends org.apache.thrift.TServiceClient implements Iface { + public static class Client extends org.apache.accumulo.core.rpc.TServiceClientWrapper implements Iface { public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> { public Factory() {} public Client getClient(org.apache.thrift.protocol.TProtocol prot) { @@ -85,13 +58,13 @@ public class ReplicationCoordinator { super(iprot, oprot); } - public String getServicerAddress(String remoteTableId, org.apache.accumulo.core.security.thrift.TCredentials credentials) throws ReplicationCoordinatorException, org.apache.thrift.TException + public java.lang.String getServicerAddress(java.lang.String remoteTableId, org.apache.accumulo.core.security.thrift.TCredentials credentials) throws ReplicationCoordinatorException, org.apache.thrift.TException { send_getServicerAddress(remoteTableId, credentials); return recv_getServicerAddress(); } - public void send_getServicerAddress(String remoteTableId, org.apache.accumulo.core.security.thrift.TCredentials credentials) throws org.apache.thrift.TException + public void send_getServicerAddress(java.lang.String remoteTableId, org.apache.accumulo.core.security.thrift.TCredentials credentials) throws org.apache.thrift.TException { getServicerAddress_args args = new getServicerAddress_args(); args.setRemoteTableId(remoteTableId); @@ -99,7 +72,7 @@ public class ReplicationCoordinator { sendBase("getServicerAddress", args); } - public String recv_getServicerAddress() throws ReplicationCoordinatorException, org.apache.thrift.TException + public java.lang.String recv_getServicerAddress() throws ReplicationCoordinatorException, org.apache.thrift.TException { getServicerAddress_result result = new getServicerAddress_result(); receiveBase(result, "getServicerAddress"); @@ -130,17 +103,17 @@ public class ReplicationCoordinator { super(protocolFactory, clientManager, transport); } - public void getServicerAddress(String remoteTableId, org.apache.accumulo.core.security.thrift.TCredentials credentials, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + public void getServicerAddress(java.lang.String remoteTableId, org.apache.accumulo.core.security.thrift.TCredentials credentials, org.apache.thrift.async.AsyncMethodCallback<java.lang.String> resultHandler) throws org.apache.thrift.TException { checkReady(); getServicerAddress_call method_call = new getServicerAddress_call(remoteTableId, credentials, resultHandler, this, ___protocolFactory, ___transport); this.___currentMethod = method_call; ___manager.call(method_call); } - public static class getServicerAddress_call extends org.apache.thrift.async.TAsyncMethodCall { - private String remoteTableId; + public static class getServicerAddress_call extends org.apache.thrift.async.TAsyncMethodCall<java.lang.String> { + private java.lang.String remoteTableId; private org.apache.accumulo.core.security.thrift.TCredentials credentials; - public getServicerAddress_call(String remoteTableId, org.apache.accumulo.core.security.thrift.TCredentials credentials, 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 { + public getServicerAddress_call(java.lang.String remoteTableId, org.apache.accumulo.core.security.thrift.TCredentials credentials, org.apache.thrift.async.AsyncMethodCallback<java.lang.String> 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.remoteTableId = remoteTableId; this.credentials = credentials; @@ -155,9 +128,9 @@ public class ReplicationCoordinator { prot.writeMessageEnd(); } - public String getResult() throws ReplicationCoordinatorException, org.apache.thrift.TException { + public java.lang.String getResult() throws ReplicationCoordinatorException, org.apache.thrift.TException { if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); + throw new java.lang.IllegalStateException("Method call not finished!"); } org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); @@ -168,16 +141,16 @@ public class ReplicationCoordinator { } 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()); + private static final org.slf4j.Logger _LOGGER = org.slf4j.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>>())); + super(iface, getProcessMap(new java.util.HashMap<java.lang.String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>())); } - protected Processor(I iface, Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) { + protected Processor(I iface, java.util.Map<java.lang.String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) { super(iface, getProcessMap(processMap)); } - private static <I extends Iface> Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> getProcessMap(Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) { + private static <I extends Iface> java.util.Map<java.lang.String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> getProcessMap(java.util.Map<java.lang.String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) { processMap.put("getServicerAddress", new getServicerAddress()); return processMap; } @@ -209,21 +182,21 @@ public class ReplicationCoordinator { } public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> { - private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); + private static final org.slf4j.Logger _LOGGER = org.slf4j.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, ?>>())); + super(iface, getProcessMap(new java.util.HashMap<java.lang.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) { + protected AsyncProcessor(I iface, java.util.Map<java.lang.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) { + private static <I extends AsyncIface> java.util.Map<java.lang.String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase,?>> getProcessMap(java.util.Map<java.lang.String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) { processMap.put("getServicerAddress", new getServicerAddress()); return processMap; } - public static class getServicerAddress<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getServicerAddress_args, String> { + public static class getServicerAddress<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getServicerAddress_args, java.lang.String> { public getServicerAddress() { super("getServicerAddress"); } @@ -232,41 +205,49 @@ public class ReplicationCoordinator { return new getServicerAddress_args(); } - public AsyncMethodCallback<String> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + public org.apache.thrift.async.AsyncMethodCallback<java.lang.String> getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) { final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback<String>() { - public void onComplete(String o) { + return new org.apache.thrift.async.AsyncMethodCallback<java.lang.String>() { + public void onComplete(java.lang.String o) { getServicerAddress_result result = new getServicerAddress_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); + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); } - fb.close(); } - public void onError(Exception e) { + public void onError(java.lang.Exception e) { byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; + org.apache.thrift.TSerializable msg; getServicerAddress_result result = new getServicerAddress_result(); if (e instanceof ReplicationCoordinatorException) { - result.e = (ReplicationCoordinatorException) e; - result.setEIsSet(true); - msg = result; - } - else - { + result.e = (ReplicationCoordinatorException) e; + result.setEIsSet(true); + msg = result; + } else if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException)e; + } else { + _LOGGER.error("Exception inside handler", e); 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()); + msg = 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); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); } - fb.close(); } }; } @@ -275,7 +256,7 @@ public class ReplicationCoordinator { return false; } - public void start(I iface, getServicerAddress_args args, org.apache.thrift.async.AsyncMethodCallback<String> resultHandler) throws TException { + public void start(I iface, getServicerAddress_args args, org.apache.thrift.async.AsyncMethodCallback<java.lang.String> resultHandler) throws org.apache.thrift.TException { iface.getServicerAddress(args.remoteTableId, args.credentials,resultHandler); } } @@ -288,13 +269,10 @@ public class ReplicationCoordinator { private static final org.apache.thrift.protocol.TField REMOTE_TABLE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("remoteTableId", org.apache.thrift.protocol.TType.STRING, (short)1); private static final org.apache.thrift.protocol.TField CREDENTIALS_FIELD_DESC = new org.apache.thrift.protocol.TField("credentials", org.apache.thrift.protocol.TType.STRUCT, (short)2); - private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new getServicerAddress_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new getServicerAddress_argsTupleSchemeFactory()); - } + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new getServicerAddress_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new getServicerAddress_argsTupleSchemeFactory(); - public String remoteTableId; // required + public java.lang.String remoteTableId; // required public org.apache.accumulo.core.security.thrift.TCredentials credentials; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ @@ -302,10 +280,10 @@ public class ReplicationCoordinator { REMOTE_TABLE_ID((short)1, "remoteTableId"), CREDENTIALS((short)2, "credentials"); - private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>(); static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { byName.put(field.getFieldName(), field); } } @@ -330,21 +308,21 @@ public class ReplicationCoordinator { */ public static _Fields findByThriftIdOrThrow(int fieldId) { _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); return fields; } /** * Find the _Fields constant that matches name, or null if its not found. */ - public static _Fields findByName(String name) { + public static _Fields findByName(java.lang.String name) { return byName.get(name); } private final short _thriftId; - private final String _fieldName; + private final java.lang.String _fieldName; - _Fields(short thriftId, String fieldName) { + _Fields(short thriftId, java.lang.String fieldName) { _thriftId = thriftId; _fieldName = fieldName; } @@ -353,20 +331,20 @@ public class ReplicationCoordinator { return _thriftId; } - public String getFieldName() { + public java.lang.String getFieldName() { return _fieldName; } } // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + public static final java.util.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); + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.REMOTE_TABLE_ID, new org.apache.thrift.meta_data.FieldMetaData("remoteTableId", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.CREDENTIALS, new org.apache.thrift.meta_data.FieldMetaData("credentials", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.accumulo.core.security.thrift.TCredentials.class))); - metaDataMap = Collections.unmodifiableMap(tmpMap); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getServicerAddress_args.class, metaDataMap); } @@ -374,7 +352,7 @@ public class ReplicationCoordinator { } public getServicerAddress_args( - String remoteTableId, + java.lang.String remoteTableId, org.apache.accumulo.core.security.thrift.TCredentials credentials) { this(); @@ -404,11 +382,11 @@ public class ReplicationCoordinator { this.credentials = null; } - public String getRemoteTableId() { + public java.lang.String getRemoteTableId() { return this.remoteTableId; } - public getServicerAddress_args setRemoteTableId(String remoteTableId) { + public getServicerAddress_args setRemoteTableId(java.lang.String remoteTableId) { this.remoteTableId = remoteTableId; return this; } @@ -452,13 +430,13 @@ public class ReplicationCoordinator { } } - public void setFieldValue(_Fields field, Object value) { + public void setFieldValue(_Fields field, java.lang.Object value) { switch (field) { case REMOTE_TABLE_ID: if (value == null) { unsetRemoteTableId(); } else { - setRemoteTableId((String)value); + setRemoteTableId((java.lang.String)value); } break; @@ -473,7 +451,7 @@ public class ReplicationCoordinator { } } - public Object getFieldValue(_Fields field) { + public java.lang.Object getFieldValue(_Fields field) { switch (field) { case REMOTE_TABLE_ID: return getRemoteTableId(); @@ -482,13 +460,13 @@ public class ReplicationCoordinator { return getCredentials(); } - throw new IllegalStateException(); + throw new java.lang.IllegalStateException(); } /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { - throw new IllegalArgumentException(); + throw new java.lang.IllegalArgumentException(); } switch (field) { @@ -497,11 +475,11 @@ public class ReplicationCoordinator { case CREDENTIALS: return isSetCredentials(); } - throw new IllegalStateException(); + throw new java.lang.IllegalStateException(); } @Override - public boolean equals(Object that) { + public boolean equals(java.lang.Object that) { if (that == null) return false; if (that instanceof getServicerAddress_args) @@ -512,6 +490,8 @@ public class ReplicationCoordinator { public boolean equals(getServicerAddress_args that) { if (that == null) return false; + if (this == that) + return true; boolean this_present_remoteTableId = true && this.isSetRemoteTableId(); boolean that_present_remoteTableId = true && that.isSetRemoteTableId(); @@ -536,19 +516,17 @@ public class ReplicationCoordinator { @Override public int hashCode() { - List<Object> list = new ArrayList<Object>(); + int hashCode = 1; - boolean present_remoteTableId = true && (isSetRemoteTableId()); - list.add(present_remoteTableId); - if (present_remoteTableId) - list.add(remoteTableId); + hashCode = hashCode * 8191 + ((isSetRemoteTableId()) ? 131071 : 524287); + if (isSetRemoteTableId()) + hashCode = hashCode * 8191 + remoteTableId.hashCode(); - boolean present_credentials = true && (isSetCredentials()); - list.add(present_credentials); - if (present_credentials) - list.add(credentials); + hashCode = hashCode * 8191 + ((isSetCredentials()) ? 131071 : 524287); + if (isSetCredentials()) + hashCode = hashCode * 8191 + credentials.hashCode(); - return list.hashCode(); + return hashCode; } @Override @@ -559,7 +537,7 @@ public class ReplicationCoordinator { int lastComparison = 0; - lastComparison = Boolean.valueOf(isSetRemoteTableId()).compareTo(other.isSetRemoteTableId()); + lastComparison = java.lang.Boolean.valueOf(isSetRemoteTableId()).compareTo(other.isSetRemoteTableId()); if (lastComparison != 0) { return lastComparison; } @@ -569,7 +547,7 @@ public class ReplicationCoordinator { return lastComparison; } } - lastComparison = Boolean.valueOf(isSetCredentials()).compareTo(other.isSetCredentials()); + lastComparison = java.lang.Boolean.valueOf(isSetCredentials()).compareTo(other.isSetCredentials()); if (lastComparison != 0) { return lastComparison; } @@ -587,16 +565,16 @@ public class ReplicationCoordinator { } public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + scheme(iprot).read(iprot, this); } public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + scheme(oprot).write(oprot, this); } @Override - public String toString() { - StringBuilder sb = new StringBuilder("getServicerAddress_args("); + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("getServicerAddress_args("); boolean first = true; sb.append("remoteTableId:"); @@ -634,7 +612,7 @@ public class ReplicationCoordinator { } } - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException { try { read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { @@ -642,13 +620,13 @@ public class ReplicationCoordinator { } } - private static class getServicerAddress_argsStandardSchemeFactory implements SchemeFactory { + private static class getServicerAddress_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { public getServicerAddress_argsStandardScheme getScheme() { return new getServicerAddress_argsStandardScheme(); } } - private static class getServicerAddress_argsStandardScheme extends StandardScheme<getServicerAddress_args> { + private static class getServicerAddress_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme<getServicerAddress_args> { public void read(org.apache.thrift.protocol.TProtocol iprot, getServicerAddress_args struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; @@ -708,18 +686,18 @@ public class ReplicationCoordinator { } - private static class getServicerAddress_argsTupleSchemeFactory implements SchemeFactory { + private static class getServicerAddress_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { public getServicerAddress_argsTupleScheme getScheme() { return new getServicerAddress_argsTupleScheme(); } } - private static class getServicerAddress_argsTupleScheme extends TupleScheme<getServicerAddress_args> { + private static class getServicerAddress_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme<getServicerAddress_args> { @Override public void write(org.apache.thrift.protocol.TProtocol prot, getServicerAddress_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); + org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); if (struct.isSetRemoteTableId()) { optionals.set(0); } @@ -737,8 +715,8 @@ public class ReplicationCoordinator { @Override public void read(org.apache.thrift.protocol.TProtocol prot, getServicerAddress_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(2); + org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { struct.remoteTableId = iprot.readString(); struct.setRemoteTableIdIsSet(true); @@ -751,6 +729,9 @@ public class ReplicationCoordinator { } } + private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme(); + } } public static class getServicerAddress_result implements org.apache.thrift.TBase<getServicerAddress_result, getServicerAddress_result._Fields>, java.io.Serializable, Cloneable, Comparable<getServicerAddress_result> { @@ -759,13 +740,10 @@ public class ReplicationCoordinator { private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0); private static final org.apache.thrift.protocol.TField E_FIELD_DESC = new org.apache.thrift.protocol.TField("e", 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 getServicerAddress_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new getServicerAddress_resultTupleSchemeFactory()); - } + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new getServicerAddress_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new getServicerAddress_resultTupleSchemeFactory(); - public String success; // required + public java.lang.String success; // required public ReplicationCoordinatorException e; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ @@ -773,10 +751,10 @@ public class ReplicationCoordinator { SUCCESS((short)0, "success"), E((short)1, "e"); - private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>(); static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { byName.put(field.getFieldName(), field); } } @@ -801,21 +779,21 @@ public class ReplicationCoordinator { */ public static _Fields findByThriftIdOrThrow(int fieldId) { _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); return fields; } /** * Find the _Fields constant that matches name, or null if its not found. */ - public static _Fields findByName(String name) { + public static _Fields findByName(java.lang.String name) { return byName.get(name); } private final short _thriftId; - private final String _fieldName; + private final java.lang.String _fieldName; - _Fields(short thriftId, String fieldName) { + _Fields(short thriftId, java.lang.String fieldName) { _thriftId = thriftId; _fieldName = fieldName; } @@ -824,20 +802,20 @@ public class ReplicationCoordinator { return _thriftId; } - public String getFieldName() { + public java.lang.String getFieldName() { return _fieldName; } } // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + public static final java.util.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); + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.E, new org.apache.thrift.meta_data.FieldMetaData("e", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT))); - metaDataMap = Collections.unmodifiableMap(tmpMap); + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ReplicationCoordinatorException.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getServicerAddress_result.class, metaDataMap); } @@ -845,7 +823,7 @@ public class ReplicationCoordinator { } public getServicerAddress_result( - String success, + java.lang.String success, ReplicationCoordinatorException e) { this(); @@ -875,11 +853,11 @@ public class ReplicationCoordinator { this.e = null; } - public String getSuccess() { + public java.lang.String getSuccess() { return this.success; } - public getServicerAddress_result setSuccess(String success) { + public getServicerAddress_result setSuccess(java.lang.String success) { this.success = success; return this; } @@ -923,13 +901,13 @@ public class ReplicationCoordinator { } } - public void setFieldValue(_Fields field, Object value) { + public void setFieldValue(_Fields field, java.lang.Object value) { switch (field) { case SUCCESS: if (value == null) { unsetSuccess(); } else { - setSuccess((String)value); + setSuccess((java.lang.String)value); } break; @@ -944,7 +922,7 @@ public class ReplicationCoordinator { } } - public Object getFieldValue(_Fields field) { + public java.lang.Object getFieldValue(_Fields field) { switch (field) { case SUCCESS: return getSuccess(); @@ -953,13 +931,13 @@ public class ReplicationCoordinator { return getE(); } - throw new IllegalStateException(); + throw new java.lang.IllegalStateException(); } /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { - throw new IllegalArgumentException(); + throw new java.lang.IllegalArgumentException(); } switch (field) { @@ -968,11 +946,11 @@ public class ReplicationCoordinator { case E: return isSetE(); } - throw new IllegalStateException(); + throw new java.lang.IllegalStateException(); } @Override - public boolean equals(Object that) { + public boolean equals(java.lang.Object that) { if (that == null) return false; if (that instanceof getServicerAddress_result) @@ -983,6 +961,8 @@ public class ReplicationCoordinator { public boolean equals(getServicerAddress_result that) { if (that == null) return false; + if (this == that) + return true; boolean this_present_success = true && this.isSetSuccess(); boolean that_present_success = true && that.isSetSuccess(); @@ -1007,19 +987,17 @@ public class ReplicationCoordinator { @Override public int hashCode() { - List<Object> list = new ArrayList<Object>(); + int hashCode = 1; - boolean present_success = true && (isSetSuccess()); - list.add(present_success); - if (present_success) - list.add(success); + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) + hashCode = hashCode * 8191 + success.hashCode(); - boolean present_e = true && (isSetE()); - list.add(present_e); - if (present_e) - list.add(e); + hashCode = hashCode * 8191 + ((isSetE()) ? 131071 : 524287); + if (isSetE()) + hashCode = hashCode * 8191 + e.hashCode(); - return list.hashCode(); + return hashCode; } @Override @@ -1030,7 +1008,7 @@ public class ReplicationCoordinator { int lastComparison = 0; - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); if (lastComparison != 0) { return lastComparison; } @@ -1040,7 +1018,7 @@ public class ReplicationCoordinator { return lastComparison; } } - lastComparison = Boolean.valueOf(isSetE()).compareTo(other.isSetE()); + lastComparison = java.lang.Boolean.valueOf(isSetE()).compareTo(other.isSetE()); if (lastComparison != 0) { return lastComparison; } @@ -1058,16 +1036,16 @@ public class ReplicationCoordinator { } public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + scheme(iprot).read(iprot, this); } public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + scheme(oprot).write(oprot, this); } @Override - public String toString() { - StringBuilder sb = new StringBuilder("getServicerAddress_result("); + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("getServicerAddress_result("); boolean first = true; sb.append("success:"); @@ -1102,7 +1080,7 @@ public class ReplicationCoordinator { } } - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException { try { read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { @@ -1110,13 +1088,13 @@ public class ReplicationCoordinator { } } - private static class getServicerAddress_resultStandardSchemeFactory implements SchemeFactory { + private static class getServicerAddress_resultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { public getServicerAddress_resultStandardScheme getScheme() { return new getServicerAddress_resultStandardScheme(); } } - private static class getServicerAddress_resultStandardScheme extends StandardScheme<getServicerAddress_result> { + private static class getServicerAddress_resultStandardScheme extends org.apache.thrift.scheme.StandardScheme<getServicerAddress_result> { public void read(org.apache.thrift.protocol.TProtocol iprot, getServicerAddress_result struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; @@ -1176,18 +1154,18 @@ public class ReplicationCoordinator { } - private static class getServicerAddress_resultTupleSchemeFactory implements SchemeFactory { + private static class getServicerAddress_resultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { public getServicerAddress_resultTupleScheme getScheme() { return new getServicerAddress_resultTupleScheme(); } } - private static class getServicerAddress_resultTupleScheme extends TupleScheme<getServicerAddress_result> { + private static class getServicerAddress_resultTupleScheme extends org.apache.thrift.scheme.TupleScheme<getServicerAddress_result> { @Override public void write(org.apache.thrift.protocol.TProtocol prot, getServicerAddress_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); + org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); if (struct.isSetSuccess()) { optionals.set(0); } @@ -1205,8 +1183,8 @@ public class ReplicationCoordinator { @Override public void read(org.apache.thrift.protocol.TProtocol prot, getServicerAddress_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(2); + org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { struct.success = iprot.readString(); struct.setSuccessIsSet(true); @@ -1219,6 +1197,10 @@ public class ReplicationCoordinator { } } + private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme(); + } } + private static void unusedMethod() {} }
http://git-wip-us.apache.org/repos/asf/accumulo/blob/62bbce43/core/src/main/java/org/apache/accumulo/core/replication/thrift/ReplicationCoordinatorErrorCode.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/replication/thrift/ReplicationCoordinatorErrorCode.java b/core/src/main/java/org/apache/accumulo/core/replication/thrift/ReplicationCoordinatorErrorCode.java index 545656b..57e0139 100644 --- a/core/src/main/java/org/apache/accumulo/core/replication/thrift/ReplicationCoordinatorErrorCode.java +++ b/core/src/main/java/org/apache/accumulo/core/replication/thrift/ReplicationCoordinatorErrorCode.java @@ -15,7 +15,7 @@ * limitations under the License. */ /** - * Autogenerated by Thrift Compiler (0.9.3) + * Autogenerated by Thrift Compiler (0.10.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -23,11 +23,8 @@ package org.apache.accumulo.core.replication.thrift; -import java.util.Map; -import java.util.HashMap; -import org.apache.thrift.TEnum; -@SuppressWarnings({"unused"}) public enum ReplicationCoordinatorErrorCode implements org.apache.thrift.TEnum { +public enum ReplicationCoordinatorErrorCode implements org.apache.thrift.TEnum { NO_AVAILABLE_SERVERS(0), SERVICE_CONFIGURATION_UNAVAILABLE(1), CANNOT_AUTHENTICATE(2); http://git-wip-us.apache.org/repos/asf/accumulo/blob/62bbce43/core/src/main/java/org/apache/accumulo/core/replication/thrift/ReplicationCoordinatorException.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/replication/thrift/ReplicationCoordinatorException.java b/core/src/main/java/org/apache/accumulo/core/replication/thrift/ReplicationCoordinatorException.java index 5e3b99d..5820029 100644 --- a/core/src/main/java/org/apache/accumulo/core/replication/thrift/ReplicationCoordinatorException.java +++ b/core/src/main/java/org/apache/accumulo/core/replication/thrift/ReplicationCoordinatorException.java @@ -15,60 +15,30 @@ * limitations under the License. */ /** - * Autogenerated by Thrift Compiler (0.9.3) + * Autogenerated by Thrift Compiler (0.10.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package org.apache.accumulo.core.replication.thrift; -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; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import javax.annotation.Generated; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)") -public class ReplicationCoordinatorException extends TException implements org.apache.thrift.TBase<ReplicationCoordinatorException, ReplicationCoordinatorException._Fields>, java.io.Serializable, Cloneable, Comparable<ReplicationCoordinatorException> { +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.10.0)") +public class ReplicationCoordinatorException extends org.apache.thrift.TException implements org.apache.thrift.TBase<ReplicationCoordinatorException, ReplicationCoordinatorException._Fields>, java.io.Serializable, Cloneable, Comparable<ReplicationCoordinatorException> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ReplicationCoordinatorException"); private static final org.apache.thrift.protocol.TField CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("code", org.apache.thrift.protocol.TType.I32, (short)1); private static final org.apache.thrift.protocol.TField REASON_FIELD_DESC = new org.apache.thrift.protocol.TField("reason", 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 ReplicationCoordinatorExceptionStandardSchemeFactory()); - schemes.put(TupleScheme.class, new ReplicationCoordinatorExceptionTupleSchemeFactory()); - } + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new ReplicationCoordinatorExceptionStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new ReplicationCoordinatorExceptionTupleSchemeFactory(); /** * * @see ReplicationCoordinatorErrorCode */ public ReplicationCoordinatorErrorCode code; // required - public String reason; // required + public java.lang.String reason; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { @@ -79,10 +49,10 @@ public class ReplicationCoordinatorException extends TException implements org.a CODE((short)1, "code"), REASON((short)2, "reason"); - private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>(); static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { byName.put(field.getFieldName(), field); } } @@ -107,21 +77,21 @@ public class ReplicationCoordinatorException extends TException implements org.a */ public static _Fields findByThriftIdOrThrow(int fieldId) { _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); return fields; } /** * Find the _Fields constant that matches name, or null if its not found. */ - public static _Fields findByName(String name) { + public static _Fields findByName(java.lang.String name) { return byName.get(name); } private final short _thriftId; - private final String _fieldName; + private final java.lang.String _fieldName; - _Fields(short thriftId, String fieldName) { + _Fields(short thriftId, java.lang.String fieldName) { _thriftId = thriftId; _fieldName = fieldName; } @@ -130,20 +100,20 @@ public class ReplicationCoordinatorException extends TException implements org.a return _thriftId; } - public String getFieldName() { + public java.lang.String getFieldName() { return _fieldName; } } // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + public static final java.util.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); + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.CODE, new org.apache.thrift.meta_data.FieldMetaData("code", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, ReplicationCoordinatorErrorCode.class))); tmpMap.put(_Fields.REASON, new org.apache.thrift.meta_data.FieldMetaData("reason", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ReplicationCoordinatorException.class, metaDataMap); } @@ -152,7 +122,7 @@ public class ReplicationCoordinatorException extends TException implements org.a public ReplicationCoordinatorException( ReplicationCoordinatorErrorCode code, - String reason) + java.lang.String reason) { this(); this.code = code; @@ -213,11 +183,11 @@ public class ReplicationCoordinatorException extends TException implements org.a } } - public String getReason() { + public java.lang.String getReason() { return this.reason; } - public ReplicationCoordinatorException setReason(String reason) { + public ReplicationCoordinatorException setReason(java.lang.String reason) { this.reason = reason; return this; } @@ -237,7 +207,7 @@ public class ReplicationCoordinatorException extends TException implements org.a } } - public void setFieldValue(_Fields field, Object value) { + public void setFieldValue(_Fields field, java.lang.Object value) { switch (field) { case CODE: if (value == null) { @@ -251,14 +221,14 @@ public class ReplicationCoordinatorException extends TException implements org.a if (value == null) { unsetReason(); } else { - setReason((String)value); + setReason((java.lang.String)value); } break; } } - public Object getFieldValue(_Fields field) { + public java.lang.Object getFieldValue(_Fields field) { switch (field) { case CODE: return getCode(); @@ -267,13 +237,13 @@ public class ReplicationCoordinatorException extends TException implements org.a return getReason(); } - throw new IllegalStateException(); + throw new java.lang.IllegalStateException(); } /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { - throw new IllegalArgumentException(); + throw new java.lang.IllegalArgumentException(); } switch (field) { @@ -282,11 +252,11 @@ public class ReplicationCoordinatorException extends TException implements org.a case REASON: return isSetReason(); } - throw new IllegalStateException(); + throw new java.lang.IllegalStateException(); } @Override - public boolean equals(Object that) { + public boolean equals(java.lang.Object that) { if (that == null) return false; if (that instanceof ReplicationCoordinatorException) @@ -297,6 +267,8 @@ public class ReplicationCoordinatorException extends TException implements org.a public boolean equals(ReplicationCoordinatorException that) { if (that == null) return false; + if (this == that) + return true; boolean this_present_code = true && this.isSetCode(); boolean that_present_code = true && that.isSetCode(); @@ -321,19 +293,17 @@ public class ReplicationCoordinatorException extends TException implements org.a @Override public int hashCode() { - List<Object> list = new ArrayList<Object>(); + int hashCode = 1; - boolean present_code = true && (isSetCode()); - list.add(present_code); - if (present_code) - list.add(code.getValue()); + hashCode = hashCode * 8191 + ((isSetCode()) ? 131071 : 524287); + if (isSetCode()) + hashCode = hashCode * 8191 + code.getValue(); - boolean present_reason = true && (isSetReason()); - list.add(present_reason); - if (present_reason) - list.add(reason); + hashCode = hashCode * 8191 + ((isSetReason()) ? 131071 : 524287); + if (isSetReason()) + hashCode = hashCode * 8191 + reason.hashCode(); - return list.hashCode(); + return hashCode; } @Override @@ -344,7 +314,7 @@ public class ReplicationCoordinatorException extends TException implements org.a int lastComparison = 0; - lastComparison = Boolean.valueOf(isSetCode()).compareTo(other.isSetCode()); + lastComparison = java.lang.Boolean.valueOf(isSetCode()).compareTo(other.isSetCode()); if (lastComparison != 0) { return lastComparison; } @@ -354,7 +324,7 @@ public class ReplicationCoordinatorException extends TException implements org.a return lastComparison; } } - lastComparison = Boolean.valueOf(isSetReason()).compareTo(other.isSetReason()); + lastComparison = java.lang.Boolean.valueOf(isSetReason()).compareTo(other.isSetReason()); if (lastComparison != 0) { return lastComparison; } @@ -372,16 +342,16 @@ public class ReplicationCoordinatorException extends TException implements org.a } public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + scheme(iprot).read(iprot, this); } public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + scheme(oprot).write(oprot, this); } @Override - public String toString() { - StringBuilder sb = new StringBuilder("ReplicationCoordinatorException("); + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("ReplicationCoordinatorException("); boolean first = true; sb.append("code:"); @@ -416,7 +386,7 @@ public class ReplicationCoordinatorException extends TException implements org.a } } - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException { try { read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { @@ -424,13 +394,13 @@ public class ReplicationCoordinatorException extends TException implements org.a } } - private static class ReplicationCoordinatorExceptionStandardSchemeFactory implements SchemeFactory { + private static class ReplicationCoordinatorExceptionStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { public ReplicationCoordinatorExceptionStandardScheme getScheme() { return new ReplicationCoordinatorExceptionStandardScheme(); } } - private static class ReplicationCoordinatorExceptionStandardScheme extends StandardScheme<ReplicationCoordinatorException> { + private static class ReplicationCoordinatorExceptionStandardScheme extends org.apache.thrift.scheme.StandardScheme<ReplicationCoordinatorException> { public void read(org.apache.thrift.protocol.TProtocol iprot, ReplicationCoordinatorException struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; @@ -489,18 +459,18 @@ public class ReplicationCoordinatorException extends TException implements org.a } - private static class ReplicationCoordinatorExceptionTupleSchemeFactory implements SchemeFactory { + private static class ReplicationCoordinatorExceptionTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { public ReplicationCoordinatorExceptionTupleScheme getScheme() { return new ReplicationCoordinatorExceptionTupleScheme(); } } - private static class ReplicationCoordinatorExceptionTupleScheme extends TupleScheme<ReplicationCoordinatorException> { + private static class ReplicationCoordinatorExceptionTupleScheme extends org.apache.thrift.scheme.TupleScheme<ReplicationCoordinatorException> { @Override public void write(org.apache.thrift.protocol.TProtocol prot, ReplicationCoordinatorException struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); + org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); if (struct.isSetCode()) { optionals.set(0); } @@ -518,8 +488,8 @@ public class ReplicationCoordinatorException extends TException implements org.a @Override public void read(org.apache.thrift.protocol.TProtocol prot, ReplicationCoordinatorException struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(2); + org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { struct.code = org.apache.accumulo.core.replication.thrift.ReplicationCoordinatorErrorCode.findByValue(iprot.readI32()); struct.setCodeIsSet(true); @@ -531,5 +501,9 @@ public class ReplicationCoordinatorException extends TException implements org.a } } + private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme(); + } + private static void unusedMethod() {} }