All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.snappydata.thrift.LocatorService Maven / Gradle / Ivy

There is a newer version: 1.6.7
Show newest version
/**
 * Autogenerated by Thrift Compiler (0.9.3)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package io.snappydata.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"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2019-08-09")
public class LocatorService {

  public interface Iface {

    public HostAddress getPreferredServer(Set serverTypes, Set serverGroups, Set failedServers) throws SnappyException, org.apache.thrift.TException;

    public List getAllServersWithPreferredServer(Set serverTypes, Set serverGroups, Set failedServers) throws SnappyException, org.apache.thrift.TException;

  }

  public static class Client extends org.apache.thrift.TServiceClient implements Iface {
    public static class Factory implements org.apache.thrift.TServiceClientFactory {
      public Factory() {}
      public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
        return new Client(prot);
      }
      public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
        return new Client(iprot, oprot);
      }
    }

    public Client(org.apache.thrift.protocol.TProtocol prot)
    {
      super(prot, prot);
    }

    public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
      super(iprot, oprot);
    }

    public HostAddress getPreferredServer(Set serverTypes, Set serverGroups, Set failedServers) throws SnappyException, org.apache.thrift.TException
    {
      send_getPreferredServer(serverTypes, serverGroups, failedServers);
      return recv_getPreferredServer();
    }

    public void send_getPreferredServer(Set serverTypes, Set serverGroups, Set failedServers) throws org.apache.thrift.TException
    {
      getPreferredServer_args args = new getPreferredServer_args();
      args.setServerTypes(serverTypes);
      args.setServerGroups(serverGroups);
      args.setFailedServers(failedServers);
      sendBase("getPreferredServer", args);
    }

    public HostAddress recv_getPreferredServer() throws SnappyException, org.apache.thrift.TException
    {
      getPreferredServer_result result = new getPreferredServer_result();
      receiveBase(result, "getPreferredServer");
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.error != null) {
        throw result.error;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getPreferredServer failed: unknown result");
    }

    public List getAllServersWithPreferredServer(Set serverTypes, Set serverGroups, Set failedServers) throws SnappyException, org.apache.thrift.TException
    {
      send_getAllServersWithPreferredServer(serverTypes, serverGroups, failedServers);
      return recv_getAllServersWithPreferredServer();
    }

    public void send_getAllServersWithPreferredServer(Set serverTypes, Set serverGroups, Set failedServers) throws org.apache.thrift.TException
    {
      getAllServersWithPreferredServer_args args = new getAllServersWithPreferredServer_args();
      args.setServerTypes(serverTypes);
      args.setServerGroups(serverGroups);
      args.setFailedServers(failedServers);
      sendBase("getAllServersWithPreferredServer", args);
    }

    public List recv_getAllServersWithPreferredServer() throws SnappyException, org.apache.thrift.TException
    {
      getAllServersWithPreferredServer_result result = new getAllServersWithPreferredServer_result();
      receiveBase(result, "getAllServersWithPreferredServer");
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.error != null) {
        throw result.error;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getAllServersWithPreferredServer failed: unknown result");
    }

  }
  public static class Processor extends org.apache.thrift.TBaseProcessor implements org.apache.thrift.TProcessor {
    private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
    public Processor(I iface) {
      super(iface, getProcessMap(new HashMap>()));
    }

    protected Processor(I iface, Map> processMap) {
      super(iface, getProcessMap(processMap));
    }

    private static  Map> getProcessMap(Map> processMap) {
      processMap.put("getPreferredServer", new getPreferredServer());
      processMap.put("getAllServersWithPreferredServer", new getAllServersWithPreferredServer());
      return processMap;
    }

    public static class getPreferredServer extends org.apache.thrift.ProcessFunction {
      public getPreferredServer() {
        super("getPreferredServer");
      }

      public getPreferredServer_args getEmptyArgsInstance() {
        return new getPreferredServer_args();
      }

      protected boolean isOneway() {
        return false;
      }

      public getPreferredServer_result getResult(I iface, getPreferredServer_args args) throws org.apache.thrift.TException {
        getPreferredServer_result result = new getPreferredServer_result();
        try {
          result.success = iface.getPreferredServer(args.serverTypes, args.serverGroups, args.failedServers);
        } catch (SnappyException error) {
          result.error = error;
        }
        return result;
      }
    }

    public static class getAllServersWithPreferredServer extends org.apache.thrift.ProcessFunction {
      public getAllServersWithPreferredServer() {
        super("getAllServersWithPreferredServer");
      }

      public getAllServersWithPreferredServer_args getEmptyArgsInstance() {
        return new getAllServersWithPreferredServer_args();
      }

      protected boolean isOneway() {
        return false;
      }

      public getAllServersWithPreferredServer_result getResult(I iface, getAllServersWithPreferredServer_args args) throws org.apache.thrift.TException {
        getAllServersWithPreferredServer_result result = new getAllServersWithPreferredServer_result();
        try {
          result.success = iface.getAllServersWithPreferredServer(args.serverTypes, args.serverGroups, args.failedServers);
        } catch (SnappyException error) {
          result.error = error;
        }
        return result;
      }
    }

  }

  public static class getPreferredServer_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getPreferredServer_args");

    private static final org.apache.thrift.protocol.TField SERVER_TYPES_FIELD_DESC = new org.apache.thrift.protocol.TField("serverTypes", org.apache.thrift.protocol.TType.SET, (short)1);
    private static final org.apache.thrift.protocol.TField SERVER_GROUPS_FIELD_DESC = new org.apache.thrift.protocol.TField("serverGroups", org.apache.thrift.protocol.TType.SET, (short)2);
    private static final org.apache.thrift.protocol.TField FAILED_SERVERS_FIELD_DESC = new org.apache.thrift.protocol.TField("failedServers", org.apache.thrift.protocol.TType.SET, (short)3);

    private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new getPreferredServer_argsStandardSchemeFactory());
      schemes.put(TupleScheme.class, new getPreferredServer_argsTupleSchemeFactory());
    }

    public Set serverTypes; // required
    public Set serverGroups; // required
    public Set failedServers; // 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 {
      SERVER_TYPES((short)1, "serverTypes"),
      SERVER_GROUPS((short)2, "serverGroups"),
      FAILED_SERVERS((short)3, "failedServers");

      private static final Map byName = new HashMap();

      static {
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
          byName.put(field.getFieldName(), field);
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static _Fields findByThriftId(int fieldId) {
        switch(fieldId) {
          case 1: // SERVER_TYPES
            return SERVER_TYPES;
          case 2: // SERVER_GROUPS
            return SERVER_GROUPS;
          case 3: // FAILED_SERVERS
            return FAILED_SERVERS;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, throwing an exception
       * if it is not found.
       */
      public static _Fields findByThriftIdOrThrow(int fieldId) {
        _Fields fields = findByThriftId(fieldId);
        if (fields == null) throw new 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) {
        return byName.get(name);
      }

      private final short _thriftId;
      private final String _fieldName;

      _Fields(short thriftId, String fieldName) {
        _thriftId = thriftId;
        _fieldName = fieldName;
      }

      public short getThriftFieldId() {
        return _thriftId;
      }

      public String getFieldName() {
        return _fieldName;
      }
    }

    // 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);
      tmpMap.put(_Fields.SERVER_TYPES, new org.apache.thrift.meta_data.FieldMetaData("serverTypes", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET, 
              new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, ServerType.class))));
      tmpMap.put(_Fields.SERVER_GROUPS, new org.apache.thrift.meta_data.FieldMetaData("serverGroups", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET, 
              new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
      tmpMap.put(_Fields.FAILED_SERVERS, new org.apache.thrift.meta_data.FieldMetaData("failedServers", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET, 
              new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, HostAddress.class))));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getPreferredServer_args.class, metaDataMap);
    }

    public getPreferredServer_args() {
    }

    public getPreferredServer_args(
      Set serverTypes,
      Set serverGroups,
      Set failedServers)
    {
      this();
      this.serverTypes = serverTypes;
      this.serverGroups = serverGroups;
      this.failedServers = failedServers;
    }

    /**
     * Performs a deep copy on other.
     */
    public getPreferredServer_args(getPreferredServer_args other) {
      if (other.isSetServerTypes()) {
        Set __this__serverTypes = new HashSet(other.serverTypes.size());
        for (ServerType other_element : other.serverTypes) {
          __this__serverTypes.add(other_element);
        }
        this.serverTypes = __this__serverTypes;
      }
      if (other.isSetServerGroups()) {
        Set __this__serverGroups = new HashSet(other.serverGroups);
        this.serverGroups = __this__serverGroups;
      }
      if (other.isSetFailedServers()) {
        Set __this__failedServers = new HashSet(other.failedServers.size());
        for (HostAddress other_element : other.failedServers) {
          __this__failedServers.add(new HostAddress(other_element));
        }
        this.failedServers = __this__failedServers;
      }
    }

    public getPreferredServer_args deepCopy() {
      return new getPreferredServer_args(this);
    }

    @Override
    public void clear() {
      this.serverTypes = null;
      this.serverGroups = null;
      this.failedServers = null;
    }

    public int getServerTypesSize() {
      return (this.serverTypes == null) ? 0 : this.serverTypes.size();
    }

    public java.util.Iterator getServerTypesIterator() {
      return (this.serverTypes == null) ? null : this.serverTypes.iterator();
    }

    public void addToServerTypes(ServerType elem) {
      if (this.serverTypes == null) {
        this.serverTypes = new HashSet();
      }
      this.serverTypes.add(elem);
    }

    public Set getServerTypes() {
      return this.serverTypes;
    }

    public getPreferredServer_args setServerTypes(Set serverTypes) {
      this.serverTypes = serverTypes;
      return this;
    }

    public void unsetServerTypes() {
      this.serverTypes = null;
    }

    /** Returns true if field serverTypes is set (has been assigned a value) and false otherwise */
    public boolean isSetServerTypes() {
      return this.serverTypes != null;
    }

    public void setServerTypesIsSet(boolean value) {
      if (!value) {
        this.serverTypes = null;
      }
    }

    public int getServerGroupsSize() {
      return (this.serverGroups == null) ? 0 : this.serverGroups.size();
    }

    public java.util.Iterator getServerGroupsIterator() {
      return (this.serverGroups == null) ? null : this.serverGroups.iterator();
    }

    public void addToServerGroups(String elem) {
      if (this.serverGroups == null) {
        this.serverGroups = new HashSet();
      }
      this.serverGroups.add(elem);
    }

    public Set getServerGroups() {
      return this.serverGroups;
    }

    public getPreferredServer_args setServerGroups(Set serverGroups) {
      this.serverGroups = serverGroups;
      return this;
    }

    public void unsetServerGroups() {
      this.serverGroups = null;
    }

    /** Returns true if field serverGroups is set (has been assigned a value) and false otherwise */
    public boolean isSetServerGroups() {
      return this.serverGroups != null;
    }

    public void setServerGroupsIsSet(boolean value) {
      if (!value) {
        this.serverGroups = null;
      }
    }

    public int getFailedServersSize() {
      return (this.failedServers == null) ? 0 : this.failedServers.size();
    }

    public java.util.Iterator getFailedServersIterator() {
      return (this.failedServers == null) ? null : this.failedServers.iterator();
    }

    public void addToFailedServers(HostAddress elem) {
      if (this.failedServers == null) {
        this.failedServers = new HashSet();
      }
      this.failedServers.add(elem);
    }

    public Set getFailedServers() {
      return this.failedServers;
    }

    public getPreferredServer_args setFailedServers(Set failedServers) {
      this.failedServers = failedServers;
      return this;
    }

    public void unsetFailedServers() {
      this.failedServers = null;
    }

    /** Returns true if field failedServers is set (has been assigned a value) and false otherwise */
    public boolean isSetFailedServers() {
      return this.failedServers != null;
    }

    public void setFailedServersIsSet(boolean value) {
      if (!value) {
        this.failedServers = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SERVER_TYPES:
        if (value == null) {
          unsetServerTypes();
        } else {
          setServerTypes((Set)value);
        }
        break;

      case SERVER_GROUPS:
        if (value == null) {
          unsetServerGroups();
        } else {
          setServerGroups((Set)value);
        }
        break;

      case FAILED_SERVERS:
        if (value == null) {
          unsetFailedServers();
        } else {
          setFailedServers((Set)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SERVER_TYPES:
        return getServerTypes();

      case SERVER_GROUPS:
        return getServerGroups();

      case FAILED_SERVERS:
        return getFailedServers();

      }
      throw new 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();
      }

      switch (field) {
      case SERVER_TYPES:
        return isSetServerTypes();
      case SERVER_GROUPS:
        return isSetServerGroups();
      case FAILED_SERVERS:
        return isSetFailedServers();
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (that instanceof getPreferredServer_args)
        return this.equals((getPreferredServer_args)that);
      return false;
    }

    public boolean equals(getPreferredServer_args that) {
      if (that == null)
        return false;

      boolean this_present_serverTypes = true && this.isSetServerTypes();
      boolean that_present_serverTypes = true && that.isSetServerTypes();
      if (this_present_serverTypes || that_present_serverTypes) {
        if (!(this_present_serverTypes && that_present_serverTypes))
          return false;
        if (!this.serverTypes.equals(that.serverTypes))
          return false;
      }

      boolean this_present_serverGroups = true && this.isSetServerGroups();
      boolean that_present_serverGroups = true && that.isSetServerGroups();
      if (this_present_serverGroups || that_present_serverGroups) {
        if (!(this_present_serverGroups && that_present_serverGroups))
          return false;
        if (!this.serverGroups.equals(that.serverGroups))
          return false;
      }

      boolean this_present_failedServers = true && this.isSetFailedServers();
      boolean that_present_failedServers = true && that.isSetFailedServers();
      if (this_present_failedServers || that_present_failedServers) {
        if (!(this_present_failedServers && that_present_failedServers))
          return false;
        if (!this.failedServers.equals(that.failedServers))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      List list = new ArrayList();

      boolean present_serverTypes = true && (isSetServerTypes());
      list.add(present_serverTypes);
      if (present_serverTypes)
        list.add(serverTypes);

      boolean present_serverGroups = true && (isSetServerGroups());
      list.add(present_serverGroups);
      if (present_serverGroups)
        list.add(serverGroups);

      boolean present_failedServers = true && (isSetFailedServers());
      list.add(present_failedServers);
      if (present_failedServers)
        list.add(failedServers);

      return list.hashCode();
    }

    @Override
    public int compareTo(getPreferredServer_args other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetServerTypes()).compareTo(other.isSetServerTypes());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetServerTypes()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.serverTypes, other.serverTypes);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetServerGroups()).compareTo(other.isSetServerGroups());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetServerGroups()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.serverGroups, other.serverGroups);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetFailedServers()).compareTo(other.isSetFailedServers());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetFailedServers()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.failedServers, other.failedServers);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }

    public _Fields fieldForId(int fieldId) {
      return _Fields.findByThriftId(fieldId);
    }

    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
      schemes.get(iprot.getScheme()).getScheme().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);
    }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("getPreferredServer_args(");
      boolean first = true;

      sb.append("serverTypes:");
      if (this.serverTypes == null) {
        sb.append("null");
      } else {
        sb.append(this.serverTypes);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("serverGroups:");
      if (this.serverGroups == null) {
        sb.append("null");
      } else {
        sb.append(this.serverGroups);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("failedServers:");
      if (this.failedServers == null) {
        sb.append("null");
      } else {
        sb.append(this.failedServers);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

    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 {
      try {
        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
      try {
        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private static class getPreferredServer_argsStandardSchemeFactory implements SchemeFactory {
      public getPreferredServer_argsStandardScheme getScheme() {
        return new getPreferredServer_argsStandardScheme();
      }
    }

    private static class getPreferredServer_argsStandardScheme extends StandardScheme {

      public void read(org.apache.thrift.protocol.TProtocol iprot, getPreferredServer_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: // SERVER_TYPES
              if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
                {
                  org.apache.thrift.protocol.TSet _set480 = iprot.readSetBegin();
                  struct.serverTypes = new HashSet(2*_set480.size);
                  ServerType _elem481;
                  for (int _i482 = 0; _i482 < _set480.size; ++_i482)
                  {
                    _elem481 = io.snappydata.thrift.ServerType.findByValue(iprot.readI32());
                    struct.serverTypes.add(_elem481);
                  }
                  iprot.readSetEnd();
                }
                struct.setServerTypesIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 2: // SERVER_GROUPS
              if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
                {
                  org.apache.thrift.protocol.TSet _set483 = iprot.readSetBegin();
                  struct.serverGroups = new HashSet(2*_set483.size);
                  String _elem484;
                  for (int _i485 = 0; _i485 < _set483.size; ++_i485)
                  {
                    _elem484 = iprot.readString();
                    struct.serverGroups.add(_elem484);
                  }
                  iprot.readSetEnd();
                }
                struct.setServerGroupsIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 3: // FAILED_SERVERS
              if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
                {
                  org.apache.thrift.protocol.TSet _set486 = iprot.readSetBegin();
                  struct.failedServers = new HashSet(2*_set486.size);
                  HostAddress _elem487;
                  for (int _i488 = 0; _i488 < _set486.size; ++_i488)
                  {
                    _elem487 = new HostAddress();
                    _elem487.read(iprot);
                    struct.failedServers.add(_elem487);
                  }
                  iprot.readSetEnd();
                }
                struct.setFailedServersIsSet(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, getPreferredServer_args struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.serverTypes != null) {
          oprot.writeFieldBegin(SERVER_TYPES_FIELD_DESC);
          {
            oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.I32, struct.serverTypes.size()));
            for (ServerType _iter489 : struct.serverTypes)
            {
              oprot.writeI32(_iter489.getValue());
            }
            oprot.writeSetEnd();
          }
          oprot.writeFieldEnd();
        }
        if (struct.serverGroups != null) {
          oprot.writeFieldBegin(SERVER_GROUPS_FIELD_DESC);
          {
            oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.serverGroups.size()));
            for (String _iter490 : struct.serverGroups)
            {
              oprot.writeString(_iter490);
            }
            oprot.writeSetEnd();
          }
          oprot.writeFieldEnd();
        }
        if (struct.failedServers != null) {
          oprot.writeFieldBegin(FAILED_SERVERS_FIELD_DESC);
          {
            oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.failedServers.size()));
            for (HostAddress _iter491 : struct.failedServers)
            {
              _iter491.write(oprot);
            }
            oprot.writeSetEnd();
          }
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class getPreferredServer_argsTupleSchemeFactory implements SchemeFactory {
      public getPreferredServer_argsTupleScheme getScheme() {
        return new getPreferredServer_argsTupleScheme();
      }
    }

    private static class getPreferredServer_argsTupleScheme extends TupleScheme {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, getPreferredServer_args struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetServerTypes()) {
          optionals.set(0);
        }
        if (struct.isSetServerGroups()) {
          optionals.set(1);
        }
        if (struct.isSetFailedServers()) {
          optionals.set(2);
        }
        oprot.writeBitSet(optionals, 3);
        if (struct.isSetServerTypes()) {
          {
            oprot.writeI32(struct.serverTypes.size());
            for (ServerType _iter492 : struct.serverTypes)
            {
              oprot.writeI32(_iter492.getValue());
            }
          }
        }
        if (struct.isSetServerGroups()) {
          {
            oprot.writeI32(struct.serverGroups.size());
            for (String _iter493 : struct.serverGroups)
            {
              oprot.writeString(_iter493);
            }
          }
        }
        if (struct.isSetFailedServers()) {
          {
            oprot.writeI32(struct.failedServers.size());
            for (HostAddress _iter494 : struct.failedServers)
            {
              _iter494.write(oprot);
            }
          }
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, getPreferredServer_args struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(3);
        if (incoming.get(0)) {
          {
            org.apache.thrift.protocol.TSet _set495 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.I32, iprot.readI32());
            struct.serverTypes = new HashSet(2*_set495.size);
            ServerType _elem496;
            for (int _i497 = 0; _i497 < _set495.size; ++_i497)
            {
              _elem496 = io.snappydata.thrift.ServerType.findByValue(iprot.readI32());
              struct.serverTypes.add(_elem496);
            }
          }
          struct.setServerTypesIsSet(true);
        }
        if (incoming.get(1)) {
          {
            org.apache.thrift.protocol.TSet _set498 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
            struct.serverGroups = new HashSet(2*_set498.size);
            String _elem499;
            for (int _i500 = 0; _i500 < _set498.size; ++_i500)
            {
              _elem499 = iprot.readString();
              struct.serverGroups.add(_elem499);
            }
          }
          struct.setServerGroupsIsSet(true);
        }
        if (incoming.get(2)) {
          {
            org.apache.thrift.protocol.TSet _set501 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
            struct.failedServers = new HashSet(2*_set501.size);
            HostAddress _elem502;
            for (int _i503 = 0; _i503 < _set501.size; ++_i503)
            {
              _elem502 = new HostAddress();
              _elem502.read(iprot);
              struct.failedServers.add(_elem502);
            }
          }
          struct.setFailedServersIsSet(true);
        }
      }
    }

  }

  public static class getPreferredServer_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getPreferredServer_result");

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0);
    private static final org.apache.thrift.protocol.TField ERROR_FIELD_DESC = new org.apache.thrift.protocol.TField("error", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new getPreferredServer_resultStandardSchemeFactory());
      schemes.put(TupleScheme.class, new getPreferredServer_resultTupleSchemeFactory());
    }

    public HostAddress success; // required
    public SnappyException error; // 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 {
      SUCCESS((short)0, "success"),
      ERROR((short)1, "error");

      private static final Map byName = new HashMap();

      static {
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
          byName.put(field.getFieldName(), field);
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static _Fields findByThriftId(int fieldId) {
        switch(fieldId) {
          case 0: // SUCCESS
            return SUCCESS;
          case 1: // ERROR
            return ERROR;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, throwing an exception
       * if it is not found.
       */
      public static _Fields findByThriftIdOrThrow(int fieldId) {
        _Fields fields = findByThriftId(fieldId);
        if (fields == null) throw new 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) {
        return byName.get(name);
      }

      private final short _thriftId;
      private final String _fieldName;

      _Fields(short thriftId, String fieldName) {
        _thriftId = thriftId;
        _fieldName = fieldName;
      }

      public short getThriftFieldId() {
        return _thriftId;
      }

      public String getFieldName() {
        return _fieldName;
      }
    }

    // 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);
      tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, HostAddress.class)));
      tmpMap.put(_Fields.ERROR, new org.apache.thrift.meta_data.FieldMetaData("error", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getPreferredServer_result.class, metaDataMap);
    }

    public getPreferredServer_result() {
    }

    public getPreferredServer_result(
      HostAddress success,
      SnappyException error)
    {
      this();
      this.success = success;
      this.error = error;
    }

    /**
     * Performs a deep copy on other.
     */
    public getPreferredServer_result(getPreferredServer_result other) {
      if (other.isSetSuccess()) {
        this.success = new HostAddress(other.success);
      }
      if (other.isSetError()) {
        this.error = new SnappyException(other.error);
      }
    }

    public getPreferredServer_result deepCopy() {
      return new getPreferredServer_result(this);
    }

    @Override
    public void clear() {
      this.success = null;
      this.error = null;
    }

    public HostAddress getSuccess() {
      return this.success;
    }

    public getPreferredServer_result setSuccess(HostAddress success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

    /** Returns true if field success is set (has been assigned a value) and false otherwise */
    public boolean isSetSuccess() {
      return this.success != null;
    }

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public SnappyException getError() {
      return this.error;
    }

    public getPreferredServer_result setError(SnappyException error) {
      this.error = error;
      return this;
    }

    public void unsetError() {
      this.error = null;
    }

    /** Returns true if field error is set (has been assigned a value) and false otherwise */
    public boolean isSetError() {
      return this.error != null;
    }

    public void setErrorIsSet(boolean value) {
      if (!value) {
        this.error = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((HostAddress)value);
        }
        break;

      case ERROR:
        if (value == null) {
          unsetError();
        } else {
          setError((SnappyException)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case ERROR:
        return getError();

      }
      throw new 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();
      }

      switch (field) {
      case SUCCESS:
        return isSetSuccess();
      case ERROR:
        return isSetError();
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (that instanceof getPreferredServer_result)
        return this.equals((getPreferredServer_result)that);
      return false;
    }

    public boolean equals(getPreferredServer_result that) {
      if (that == null)
        return false;

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_error = true && this.isSetError();
      boolean that_present_error = true && that.isSetError();
      if (this_present_error || that_present_error) {
        if (!(this_present_error && that_present_error))
          return false;
        if (!this.error.equals(that.error))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      List list = new ArrayList();

      boolean present_success = true && (isSetSuccess());
      list.add(present_success);
      if (present_success)
        list.add(success);

      boolean present_error = true && (isSetError());
      list.add(present_error);
      if (present_error)
        list.add(error);

      return list.hashCode();
    }

    @Override
    public int compareTo(getPreferredServer_result other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetError()).compareTo(other.isSetError());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetError()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.error, other.error);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }

    public _Fields fieldForId(int fieldId) {
      return _Fields.findByThriftId(fieldId);
    }

    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
      schemes.get(iprot.getScheme()).getScheme().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);
      }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("getPreferredServer_result(");
      boolean first = true;

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("error:");
      if (this.error == null) {
        sb.append("null");
      } else {
        sb.append(this.error);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws org.apache.thrift.TException {
      // check for required fields
      // check for sub-struct validity
      if (success != null) {
        success.validate();
      }
    }

    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
      try {
        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
      try {
        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private static class getPreferredServer_resultStandardSchemeFactory implements SchemeFactory {
      public getPreferredServer_resultStandardScheme getScheme() {
        return new getPreferredServer_resultStandardScheme();
      }
    }

    private static class getPreferredServer_resultStandardScheme extends StandardScheme {

      public void read(org.apache.thrift.protocol.TProtocol iprot, getPreferredServer_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.STRUCT) {
                struct.success = new HostAddress();
                struct.success.read(iprot);
                struct.setSuccessIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 1: // ERROR
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.error = new SnappyException();
                struct.error.read(iprot);
                struct.setErrorIsSet(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, getPreferredServer_result struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.success != null) {
          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
          struct.success.write(oprot);
          oprot.writeFieldEnd();
        }
        if (struct.error != null) {
          oprot.writeFieldBegin(ERROR_FIELD_DESC);
          struct.error.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class getPreferredServer_resultTupleSchemeFactory implements SchemeFactory {
      public getPreferredServer_resultTupleScheme getScheme() {
        return new getPreferredServer_resultTupleScheme();
      }
    }

    private static class getPreferredServer_resultTupleScheme extends TupleScheme {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, getPreferredServer_result struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetSuccess()) {
          optionals.set(0);
        }
        if (struct.isSetError()) {
          optionals.set(1);
        }
        oprot.writeBitSet(optionals, 2);
        if (struct.isSetSuccess()) {
          struct.success.write(oprot);
        }
        if (struct.isSetError()) {
          struct.error.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, getPreferredServer_result struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(2);
        if (incoming.get(0)) {
          struct.success = new HostAddress();
          struct.success.read(iprot);
          struct.setSuccessIsSet(true);
        }
        if (incoming.get(1)) {
          struct.error = new SnappyException();
          struct.error.read(iprot);
          struct.setErrorIsSet(true);
        }
      }
    }

  }

  public static class getAllServersWithPreferredServer_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getAllServersWithPreferredServer_args");

    private static final org.apache.thrift.protocol.TField SERVER_TYPES_FIELD_DESC = new org.apache.thrift.protocol.TField("serverTypes", org.apache.thrift.protocol.TType.SET, (short)1);
    private static final org.apache.thrift.protocol.TField SERVER_GROUPS_FIELD_DESC = new org.apache.thrift.protocol.TField("serverGroups", org.apache.thrift.protocol.TType.SET, (short)2);
    private static final org.apache.thrift.protocol.TField FAILED_SERVERS_FIELD_DESC = new org.apache.thrift.protocol.TField("failedServers", org.apache.thrift.protocol.TType.SET, (short)3);

    private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new getAllServersWithPreferredServer_argsStandardSchemeFactory());
      schemes.put(TupleScheme.class, new getAllServersWithPreferredServer_argsTupleSchemeFactory());
    }

    public Set serverTypes; // required
    public Set serverGroups; // required
    public Set failedServers; // 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 {
      SERVER_TYPES((short)1, "serverTypes"),
      SERVER_GROUPS((short)2, "serverGroups"),
      FAILED_SERVERS((short)3, "failedServers");

      private static final Map byName = new HashMap();

      static {
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
          byName.put(field.getFieldName(), field);
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static _Fields findByThriftId(int fieldId) {
        switch(fieldId) {
          case 1: // SERVER_TYPES
            return SERVER_TYPES;
          case 2: // SERVER_GROUPS
            return SERVER_GROUPS;
          case 3: // FAILED_SERVERS
            return FAILED_SERVERS;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, throwing an exception
       * if it is not found.
       */
      public static _Fields findByThriftIdOrThrow(int fieldId) {
        _Fields fields = findByThriftId(fieldId);
        if (fields == null) throw new 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) {
        return byName.get(name);
      }

      private final short _thriftId;
      private final String _fieldName;

      _Fields(short thriftId, String fieldName) {
        _thriftId = thriftId;
        _fieldName = fieldName;
      }

      public short getThriftFieldId() {
        return _thriftId;
      }

      public String getFieldName() {
        return _fieldName;
      }
    }

    // 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);
      tmpMap.put(_Fields.SERVER_TYPES, new org.apache.thrift.meta_data.FieldMetaData("serverTypes", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET, 
              new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, ServerType.class))));
      tmpMap.put(_Fields.SERVER_GROUPS, new org.apache.thrift.meta_data.FieldMetaData("serverGroups", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET, 
              new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
      tmpMap.put(_Fields.FAILED_SERVERS, new org.apache.thrift.meta_data.FieldMetaData("failedServers", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET, 
              new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, HostAddress.class))));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getAllServersWithPreferredServer_args.class, metaDataMap);
    }

    public getAllServersWithPreferredServer_args() {
    }

    public getAllServersWithPreferredServer_args(
      Set serverTypes,
      Set serverGroups,
      Set failedServers)
    {
      this();
      this.serverTypes = serverTypes;
      this.serverGroups = serverGroups;
      this.failedServers = failedServers;
    }

    /**
     * Performs a deep copy on other.
     */
    public getAllServersWithPreferredServer_args(getAllServersWithPreferredServer_args other) {
      if (other.isSetServerTypes()) {
        Set __this__serverTypes = new HashSet(other.serverTypes.size());
        for (ServerType other_element : other.serverTypes) {
          __this__serverTypes.add(other_element);
        }
        this.serverTypes = __this__serverTypes;
      }
      if (other.isSetServerGroups()) {
        Set __this__serverGroups = new HashSet(other.serverGroups);
        this.serverGroups = __this__serverGroups;
      }
      if (other.isSetFailedServers()) {
        Set __this__failedServers = new HashSet(other.failedServers.size());
        for (HostAddress other_element : other.failedServers) {
          __this__failedServers.add(new HostAddress(other_element));
        }
        this.failedServers = __this__failedServers;
      }
    }

    public getAllServersWithPreferredServer_args deepCopy() {
      return new getAllServersWithPreferredServer_args(this);
    }

    @Override
    public void clear() {
      this.serverTypes = null;
      this.serverGroups = null;
      this.failedServers = null;
    }

    public int getServerTypesSize() {
      return (this.serverTypes == null) ? 0 : this.serverTypes.size();
    }

    public java.util.Iterator getServerTypesIterator() {
      return (this.serverTypes == null) ? null : this.serverTypes.iterator();
    }

    public void addToServerTypes(ServerType elem) {
      if (this.serverTypes == null) {
        this.serverTypes = new HashSet();
      }
      this.serverTypes.add(elem);
    }

    public Set getServerTypes() {
      return this.serverTypes;
    }

    public getAllServersWithPreferredServer_args setServerTypes(Set serverTypes) {
      this.serverTypes = serverTypes;
      return this;
    }

    public void unsetServerTypes() {
      this.serverTypes = null;
    }

    /** Returns true if field serverTypes is set (has been assigned a value) and false otherwise */
    public boolean isSetServerTypes() {
      return this.serverTypes != null;
    }

    public void setServerTypesIsSet(boolean value) {
      if (!value) {
        this.serverTypes = null;
      }
    }

    public int getServerGroupsSize() {
      return (this.serverGroups == null) ? 0 : this.serverGroups.size();
    }

    public java.util.Iterator getServerGroupsIterator() {
      return (this.serverGroups == null) ? null : this.serverGroups.iterator();
    }

    public void addToServerGroups(String elem) {
      if (this.serverGroups == null) {
        this.serverGroups = new HashSet();
      }
      this.serverGroups.add(elem);
    }

    public Set getServerGroups() {
      return this.serverGroups;
    }

    public getAllServersWithPreferredServer_args setServerGroups(Set serverGroups) {
      this.serverGroups = serverGroups;
      return this;
    }

    public void unsetServerGroups() {
      this.serverGroups = null;
    }

    /** Returns true if field serverGroups is set (has been assigned a value) and false otherwise */
    public boolean isSetServerGroups() {
      return this.serverGroups != null;
    }

    public void setServerGroupsIsSet(boolean value) {
      if (!value) {
        this.serverGroups = null;
      }
    }

    public int getFailedServersSize() {
      return (this.failedServers == null) ? 0 : this.failedServers.size();
    }

    public java.util.Iterator getFailedServersIterator() {
      return (this.failedServers == null) ? null : this.failedServers.iterator();
    }

    public void addToFailedServers(HostAddress elem) {
      if (this.failedServers == null) {
        this.failedServers = new HashSet();
      }
      this.failedServers.add(elem);
    }

    public Set getFailedServers() {
      return this.failedServers;
    }

    public getAllServersWithPreferredServer_args setFailedServers(Set failedServers) {
      this.failedServers = failedServers;
      return this;
    }

    public void unsetFailedServers() {
      this.failedServers = null;
    }

    /** Returns true if field failedServers is set (has been assigned a value) and false otherwise */
    public boolean isSetFailedServers() {
      return this.failedServers != null;
    }

    public void setFailedServersIsSet(boolean value) {
      if (!value) {
        this.failedServers = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SERVER_TYPES:
        if (value == null) {
          unsetServerTypes();
        } else {
          setServerTypes((Set)value);
        }
        break;

      case SERVER_GROUPS:
        if (value == null) {
          unsetServerGroups();
        } else {
          setServerGroups((Set)value);
        }
        break;

      case FAILED_SERVERS:
        if (value == null) {
          unsetFailedServers();
        } else {
          setFailedServers((Set)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SERVER_TYPES:
        return getServerTypes();

      case SERVER_GROUPS:
        return getServerGroups();

      case FAILED_SERVERS:
        return getFailedServers();

      }
      throw new 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();
      }

      switch (field) {
      case SERVER_TYPES:
        return isSetServerTypes();
      case SERVER_GROUPS:
        return isSetServerGroups();
      case FAILED_SERVERS:
        return isSetFailedServers();
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (that instanceof getAllServersWithPreferredServer_args)
        return this.equals((getAllServersWithPreferredServer_args)that);
      return false;
    }

    public boolean equals(getAllServersWithPreferredServer_args that) {
      if (that == null)
        return false;

      boolean this_present_serverTypes = true && this.isSetServerTypes();
      boolean that_present_serverTypes = true && that.isSetServerTypes();
      if (this_present_serverTypes || that_present_serverTypes) {
        if (!(this_present_serverTypes && that_present_serverTypes))
          return false;
        if (!this.serverTypes.equals(that.serverTypes))
          return false;
      }

      boolean this_present_serverGroups = true && this.isSetServerGroups();
      boolean that_present_serverGroups = true && that.isSetServerGroups();
      if (this_present_serverGroups || that_present_serverGroups) {
        if (!(this_present_serverGroups && that_present_serverGroups))
          return false;
        if (!this.serverGroups.equals(that.serverGroups))
          return false;
      }

      boolean this_present_failedServers = true && this.isSetFailedServers();
      boolean that_present_failedServers = true && that.isSetFailedServers();
      if (this_present_failedServers || that_present_failedServers) {
        if (!(this_present_failedServers && that_present_failedServers))
          return false;
        if (!this.failedServers.equals(that.failedServers))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      List list = new ArrayList();

      boolean present_serverTypes = true && (isSetServerTypes());
      list.add(present_serverTypes);
      if (present_serverTypes)
        list.add(serverTypes);

      boolean present_serverGroups = true && (isSetServerGroups());
      list.add(present_serverGroups);
      if (present_serverGroups)
        list.add(serverGroups);

      boolean present_failedServers = true && (isSetFailedServers());
      list.add(present_failedServers);
      if (present_failedServers)
        list.add(failedServers);

      return list.hashCode();
    }

    @Override
    public int compareTo(getAllServersWithPreferredServer_args other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetServerTypes()).compareTo(other.isSetServerTypes());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetServerTypes()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.serverTypes, other.serverTypes);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetServerGroups()).compareTo(other.isSetServerGroups());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetServerGroups()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.serverGroups, other.serverGroups);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetFailedServers()).compareTo(other.isSetFailedServers());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetFailedServers()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.failedServers, other.failedServers);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }

    public _Fields fieldForId(int fieldId) {
      return _Fields.findByThriftId(fieldId);
    }

    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
      schemes.get(iprot.getScheme()).getScheme().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);
    }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("getAllServersWithPreferredServer_args(");
      boolean first = true;

      sb.append("serverTypes:");
      if (this.serverTypes == null) {
        sb.append("null");
      } else {
        sb.append(this.serverTypes);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("serverGroups:");
      if (this.serverGroups == null) {
        sb.append("null");
      } else {
        sb.append(this.serverGroups);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("failedServers:");
      if (this.failedServers == null) {
        sb.append("null");
      } else {
        sb.append(this.failedServers);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

    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 {
      try {
        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
      try {
        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private static class getAllServersWithPreferredServer_argsStandardSchemeFactory implements SchemeFactory {
      public getAllServersWithPreferredServer_argsStandardScheme getScheme() {
        return new getAllServersWithPreferredServer_argsStandardScheme();
      }
    }

    private static class getAllServersWithPreferredServer_argsStandardScheme extends StandardScheme {

      public void read(org.apache.thrift.protocol.TProtocol iprot, getAllServersWithPreferredServer_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: // SERVER_TYPES
              if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
                {
                  org.apache.thrift.protocol.TSet _set504 = iprot.readSetBegin();
                  struct.serverTypes = new HashSet(2*_set504.size);
                  ServerType _elem505;
                  for (int _i506 = 0; _i506 < _set504.size; ++_i506)
                  {
                    _elem505 = io.snappydata.thrift.ServerType.findByValue(iprot.readI32());
                    struct.serverTypes.add(_elem505);
                  }
                  iprot.readSetEnd();
                }
                struct.setServerTypesIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 2: // SERVER_GROUPS
              if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
                {
                  org.apache.thrift.protocol.TSet _set507 = iprot.readSetBegin();
                  struct.serverGroups = new HashSet(2*_set507.size);
                  String _elem508;
                  for (int _i509 = 0; _i509 < _set507.size; ++_i509)
                  {
                    _elem508 = iprot.readString();
                    struct.serverGroups.add(_elem508);
                  }
                  iprot.readSetEnd();
                }
                struct.setServerGroupsIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 3: // FAILED_SERVERS
              if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
                {
                  org.apache.thrift.protocol.TSet _set510 = iprot.readSetBegin();
                  struct.failedServers = new HashSet(2*_set510.size);
                  HostAddress _elem511;
                  for (int _i512 = 0; _i512 < _set510.size; ++_i512)
                  {
                    _elem511 = new HostAddress();
                    _elem511.read(iprot);
                    struct.failedServers.add(_elem511);
                  }
                  iprot.readSetEnd();
                }
                struct.setFailedServersIsSet(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, getAllServersWithPreferredServer_args struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.serverTypes != null) {
          oprot.writeFieldBegin(SERVER_TYPES_FIELD_DESC);
          {
            oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.I32, struct.serverTypes.size()));
            for (ServerType _iter513 : struct.serverTypes)
            {
              oprot.writeI32(_iter513.getValue());
            }
            oprot.writeSetEnd();
          }
          oprot.writeFieldEnd();
        }
        if (struct.serverGroups != null) {
          oprot.writeFieldBegin(SERVER_GROUPS_FIELD_DESC);
          {
            oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.serverGroups.size()));
            for (String _iter514 : struct.serverGroups)
            {
              oprot.writeString(_iter514);
            }
            oprot.writeSetEnd();
          }
          oprot.writeFieldEnd();
        }
        if (struct.failedServers != null) {
          oprot.writeFieldBegin(FAILED_SERVERS_FIELD_DESC);
          {
            oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.failedServers.size()));
            for (HostAddress _iter515 : struct.failedServers)
            {
              _iter515.write(oprot);
            }
            oprot.writeSetEnd();
          }
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class getAllServersWithPreferredServer_argsTupleSchemeFactory implements SchemeFactory {
      public getAllServersWithPreferredServer_argsTupleScheme getScheme() {
        return new getAllServersWithPreferredServer_argsTupleScheme();
      }
    }

    private static class getAllServersWithPreferredServer_argsTupleScheme extends TupleScheme {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, getAllServersWithPreferredServer_args struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetServerTypes()) {
          optionals.set(0);
        }
        if (struct.isSetServerGroups()) {
          optionals.set(1);
        }
        if (struct.isSetFailedServers()) {
          optionals.set(2);
        }
        oprot.writeBitSet(optionals, 3);
        if (struct.isSetServerTypes()) {
          {
            oprot.writeI32(struct.serverTypes.size());
            for (ServerType _iter516 : struct.serverTypes)
            {
              oprot.writeI32(_iter516.getValue());
            }
          }
        }
        if (struct.isSetServerGroups()) {
          {
            oprot.writeI32(struct.serverGroups.size());
            for (String _iter517 : struct.serverGroups)
            {
              oprot.writeString(_iter517);
            }
          }
        }
        if (struct.isSetFailedServers()) {
          {
            oprot.writeI32(struct.failedServers.size());
            for (HostAddress _iter518 : struct.failedServers)
            {
              _iter518.write(oprot);
            }
          }
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, getAllServersWithPreferredServer_args struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(3);
        if (incoming.get(0)) {
          {
            org.apache.thrift.protocol.TSet _set519 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.I32, iprot.readI32());
            struct.serverTypes = new HashSet(2*_set519.size);
            ServerType _elem520;
            for (int _i521 = 0; _i521 < _set519.size; ++_i521)
            {
              _elem520 = io.snappydata.thrift.ServerType.findByValue(iprot.readI32());
              struct.serverTypes.add(_elem520);
            }
          }
          struct.setServerTypesIsSet(true);
        }
        if (incoming.get(1)) {
          {
            org.apache.thrift.protocol.TSet _set522 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
            struct.serverGroups = new HashSet(2*_set522.size);
            String _elem523;
            for (int _i524 = 0; _i524 < _set522.size; ++_i524)
            {
              _elem523 = iprot.readString();
              struct.serverGroups.add(_elem523);
            }
          }
          struct.setServerGroupsIsSet(true);
        }
        if (incoming.get(2)) {
          {
            org.apache.thrift.protocol.TSet _set525 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
            struct.failedServers = new HashSet(2*_set525.size);
            HostAddress _elem526;
            for (int _i527 = 0; _i527 < _set525.size; ++_i527)
            {
              _elem526 = new HostAddress();
              _elem526.read(iprot);
              struct.failedServers.add(_elem526);
            }
          }
          struct.setFailedServersIsSet(true);
        }
      }
    }

  }

  public static class getAllServersWithPreferredServer_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getAllServersWithPreferredServer_result");

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.LIST, (short)0);
    private static final org.apache.thrift.protocol.TField ERROR_FIELD_DESC = new org.apache.thrift.protocol.TField("error", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new getAllServersWithPreferredServer_resultStandardSchemeFactory());
      schemes.put(TupleScheme.class, new getAllServersWithPreferredServer_resultTupleSchemeFactory());
    }

    public List success; // required
    public SnappyException error; // 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 {
      SUCCESS((short)0, "success"),
      ERROR((short)1, "error");

      private static final Map byName = new HashMap();

      static {
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
          byName.put(field.getFieldName(), field);
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static _Fields findByThriftId(int fieldId) {
        switch(fieldId) {
          case 0: // SUCCESS
            return SUCCESS;
          case 1: // ERROR
            return ERROR;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, throwing an exception
       * if it is not found.
       */
      public static _Fields findByThriftIdOrThrow(int fieldId) {
        _Fields fields = findByThriftId(fieldId);
        if (fields == null) throw new 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) {
        return byName.get(name);
      }

      private final short _thriftId;
      private final String _fieldName;

      _Fields(short thriftId, String fieldName) {
        _thriftId = thriftId;
        _fieldName = fieldName;
      }

      public short getThriftFieldId() {
        return _thriftId;
      }

      public String getFieldName() {
        return _fieldName;
      }
    }

    // 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);
      tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
              new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, HostAddress.class))));
      tmpMap.put(_Fields.ERROR, new org.apache.thrift.meta_data.FieldMetaData("error", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getAllServersWithPreferredServer_result.class, metaDataMap);
    }

    public getAllServersWithPreferredServer_result() {
    }

    public getAllServersWithPreferredServer_result(
      List success,
      SnappyException error)
    {
      this();
      this.success = success;
      this.error = error;
    }

    /**
     * Performs a deep copy on other.
     */
    public getAllServersWithPreferredServer_result(getAllServersWithPreferredServer_result other) {
      if (other.isSetSuccess()) {
        List __this__success = new ArrayList(other.success.size());
        for (HostAddress other_element : other.success) {
          __this__success.add(new HostAddress(other_element));
        }
        this.success = __this__success;
      }
      if (other.isSetError()) {
        this.error = new SnappyException(other.error);
      }
    }

    public getAllServersWithPreferredServer_result deepCopy() {
      return new getAllServersWithPreferredServer_result(this);
    }

    @Override
    public void clear() {
      this.success = null;
      this.error = null;
    }

    public int getSuccessSize() {
      return (this.success == null) ? 0 : this.success.size();
    }

    public java.util.Iterator getSuccessIterator() {
      return (this.success == null) ? null : this.success.iterator();
    }

    public void addToSuccess(HostAddress elem) {
      if (this.success == null) {
        this.success = new ArrayList();
      }
      this.success.add(elem);
    }

    public List getSuccess() {
      return this.success;
    }

    public getAllServersWithPreferredServer_result setSuccess(List success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

    /** Returns true if field success is set (has been assigned a value) and false otherwise */
    public boolean isSetSuccess() {
      return this.success != null;
    }

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public SnappyException getError() {
      return this.error;
    }

    public getAllServersWithPreferredServer_result setError(SnappyException error) {
      this.error = error;
      return this;
    }

    public void unsetError() {
      this.error = null;
    }

    /** Returns true if field error is set (has been assigned a value) and false otherwise */
    public boolean isSetError() {
      return this.error != null;
    }

    public void setErrorIsSet(boolean value) {
      if (!value) {
        this.error = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((List)value);
        }
        break;

      case ERROR:
        if (value == null) {
          unsetError();
        } else {
          setError((SnappyException)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case ERROR:
        return getError();

      }
      throw new 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();
      }

      switch (field) {
      case SUCCESS:
        return isSetSuccess();
      case ERROR:
        return isSetError();
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (that instanceof getAllServersWithPreferredServer_result)
        return this.equals((getAllServersWithPreferredServer_result)that);
      return false;
    }

    public boolean equals(getAllServersWithPreferredServer_result that) {
      if (that == null)
        return false;

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_error = true && this.isSetError();
      boolean that_present_error = true && that.isSetError();
      if (this_present_error || that_present_error) {
        if (!(this_present_error && that_present_error))
          return false;
        if (!this.error.equals(that.error))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      List list = new ArrayList();

      boolean present_success = true && (isSetSuccess());
      list.add(present_success);
      if (present_success)
        list.add(success);

      boolean present_error = true && (isSetError());
      list.add(present_error);
      if (present_error)
        list.add(error);

      return list.hashCode();
    }

    @Override
    public int compareTo(getAllServersWithPreferredServer_result other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetError()).compareTo(other.isSetError());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetError()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.error, other.error);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }

    public _Fields fieldForId(int fieldId) {
      return _Fields.findByThriftId(fieldId);
    }

    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
      schemes.get(iprot.getScheme()).getScheme().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);
      }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("getAllServersWithPreferredServer_result(");
      boolean first = true;

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("error:");
      if (this.error == null) {
        sb.append("null");
      } else {
        sb.append(this.error);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

    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 {
      try {
        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
      try {
        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private static class getAllServersWithPreferredServer_resultStandardSchemeFactory implements SchemeFactory {
      public getAllServersWithPreferredServer_resultStandardScheme getScheme() {
        return new getAllServersWithPreferredServer_resultStandardScheme();
      }
    }

    private static class getAllServersWithPreferredServer_resultStandardScheme extends StandardScheme {

      public void read(org.apache.thrift.protocol.TProtocol iprot, getAllServersWithPreferredServer_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.LIST) {
                {
                  org.apache.thrift.protocol.TList _list528 = iprot.readListBegin();
                  struct.success = new ArrayList(_list528.size);
                  HostAddress _elem529;
                  for (int _i530 = 0; _i530 < _list528.size; ++_i530)
                  {
                    _elem529 = new HostAddress();
                    _elem529.read(iprot);
                    struct.success.add(_elem529);
                  }
                  iprot.readListEnd();
                }
                struct.setSuccessIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 1: // ERROR
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.error = new SnappyException();
                struct.error.read(iprot);
                struct.setErrorIsSet(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, getAllServersWithPreferredServer_result struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.success != null) {
          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size()));
            for (HostAddress _iter531 : struct.success)
            {
              _iter531.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
        if (struct.error != null) {
          oprot.writeFieldBegin(ERROR_FIELD_DESC);
          struct.error.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class getAllServersWithPreferredServer_resultTupleSchemeFactory implements SchemeFactory {
      public getAllServersWithPreferredServer_resultTupleScheme getScheme() {
        return new getAllServersWithPreferredServer_resultTupleScheme();
      }
    }

    private static class getAllServersWithPreferredServer_resultTupleScheme extends TupleScheme {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, getAllServersWithPreferredServer_result struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetSuccess()) {
          optionals.set(0);
        }
        if (struct.isSetError()) {
          optionals.set(1);
        }
        oprot.writeBitSet(optionals, 2);
        if (struct.isSetSuccess()) {
          {
            oprot.writeI32(struct.success.size());
            for (HostAddress _iter532 : struct.success)
            {
              _iter532.write(oprot);
            }
          }
        }
        if (struct.isSetError()) {
          struct.error.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, getAllServersWithPreferredServer_result struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(2);
        if (incoming.get(0)) {
          {
            org.apache.thrift.protocol.TList _list533 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
            struct.success = new ArrayList(_list533.size);
            HostAddress _elem534;
            for (int _i535 = 0; _i535 < _list533.size; ++_i535)
            {
              _elem534 = new HostAddress();
              _elem534.read(iprot);
              struct.success.add(_elem534);
            }
          }
          struct.setSuccessIsSet(true);
        }
        if (incoming.get(1)) {
          struct.error = new SnappyException();
          struct.error.read(iprot);
          struct.setErrorIsSet(true);
        }
      }
    }

  }

}