/**
 * Autogenerated by Thrift Compiler (0.9.1)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.curator.generated;

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 org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class DiscoveryService {

  public interface Iface {

    public List<DiscoveryInstance> getAllInstances(CuratorProjection projection, DiscoveryProviderProjection providerProjection) throws CuratorException, org.apache.thrift.TException;

    public DiscoveryInstance getInstance(CuratorProjection projection, DiscoveryProviderProjection providerProjection) throws CuratorException, org.apache.thrift.TException;

    public DiscoveryInstance makeDiscoveryInstance(String name, ByteBuffer payload, int port) throws CuratorException, org.apache.thrift.TException;

    public void noteError(CuratorProjection projection, DiscoveryProviderProjection providerProjection, String instanceId) throws CuratorException, org.apache.thrift.TException;

    public DiscoveryProjection startDiscovery(CuratorProjection projection, String basePath, DiscoveryInstance yourInstance) throws CuratorException, org.apache.thrift.TException;

    public DiscoveryProviderProjection startProvider(CuratorProjection projection, DiscoveryProjection discoveryProjection, String serviceName, ProviderStrategyType providerStrategy, int downTimeoutMs, int downErrorThreshold) throws CuratorException, org.apache.thrift.TException;

  }

  public interface AsyncIface {

    public void getAllInstances(CuratorProjection projection, DiscoveryProviderProjection providerProjection, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;

    public void getInstance(CuratorProjection projection, DiscoveryProviderProjection providerProjection, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;

    public void makeDiscoveryInstance(String name, ByteBuffer payload, int port, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;

    public void noteError(CuratorProjection projection, DiscoveryProviderProjection providerProjection, String instanceId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;

    public void startDiscovery(CuratorProjection projection, String basePath, DiscoveryInstance yourInstance, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;

    public void startProvider(CuratorProjection projection, DiscoveryProjection discoveryProjection, String serviceName, ProviderStrategyType providerStrategy, int downTimeoutMs, int downErrorThreshold, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;

  }

  public static class Client extends org.apache.thrift.TServiceClient implements Iface {
    public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
      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 List<DiscoveryInstance> getAllInstances(CuratorProjection projection, DiscoveryProviderProjection providerProjection) throws CuratorException, org.apache.thrift.TException
    {
      send_getAllInstances(projection, providerProjection);
      return recv_getAllInstances();
    }

    public void send_getAllInstances(CuratorProjection projection, DiscoveryProviderProjection providerProjection) throws org.apache.thrift.TException
    {
      getAllInstances_args args = new getAllInstances_args();
      args.setProjection(projection);
      args.setProviderProjection(providerProjection);
      sendBase("getAllInstances", args);
    }

    public List<DiscoveryInstance> recv_getAllInstances() throws CuratorException, org.apache.thrift.TException
    {
      getAllInstances_result result = new getAllInstances_result();
      receiveBase(result, "getAllInstances");
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.ex1 != null) {
        throw result.ex1;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getAllInstances failed: unknown result");
    }

    public DiscoveryInstance getInstance(CuratorProjection projection, DiscoveryProviderProjection providerProjection) throws CuratorException, org.apache.thrift.TException
    {
      send_getInstance(projection, providerProjection);
      return recv_getInstance();
    }

    public void send_getInstance(CuratorProjection projection, DiscoveryProviderProjection providerProjection) throws org.apache.thrift.TException
    {
      getInstance_args args = new getInstance_args();
      args.setProjection(projection);
      args.setProviderProjection(providerProjection);
      sendBase("getInstance", args);
    }

    public DiscoveryInstance recv_getInstance() throws CuratorException, org.apache.thrift.TException
    {
      getInstance_result result = new getInstance_result();
      receiveBase(result, "getInstance");
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.ex1 != null) {
        throw result.ex1;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getInstance failed: unknown result");
    }

    public DiscoveryInstance makeDiscoveryInstance(String name, ByteBuffer payload, int port) throws CuratorException, org.apache.thrift.TException
    {
      send_makeDiscoveryInstance(name, payload, port);
      return recv_makeDiscoveryInstance();
    }

    public void send_makeDiscoveryInstance(String name, ByteBuffer payload, int port) throws org.apache.thrift.TException
    {
      makeDiscoveryInstance_args args = new makeDiscoveryInstance_args();
      args.setName(name);
      args.setPayload(payload);
      args.setPort(port);
      sendBase("makeDiscoveryInstance", args);
    }

    public DiscoveryInstance recv_makeDiscoveryInstance() throws CuratorException, org.apache.thrift.TException
    {
      makeDiscoveryInstance_result result = new makeDiscoveryInstance_result();
      receiveBase(result, "makeDiscoveryInstance");
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.ex1 != null) {
        throw result.ex1;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "makeDiscoveryInstance failed: unknown result");
    }

    public void noteError(CuratorProjection projection, DiscoveryProviderProjection providerProjection, String instanceId) throws CuratorException, org.apache.thrift.TException
    {
      send_noteError(projection, providerProjection, instanceId);
      recv_noteError();
    }

    public void send_noteError(CuratorProjection projection, DiscoveryProviderProjection providerProjection, String instanceId) throws org.apache.thrift.TException
    {
      noteError_args args = new noteError_args();
      args.setProjection(projection);
      args.setProviderProjection(providerProjection);
      args.setInstanceId(instanceId);
      sendBase("noteError", args);
    }

    public void recv_noteError() throws CuratorException, org.apache.thrift.TException
    {
      noteError_result result = new noteError_result();
      receiveBase(result, "noteError");
      if (result.ex1 != null) {
        throw result.ex1;
      }
      return;
    }

    public DiscoveryProjection startDiscovery(CuratorProjection projection, String basePath, DiscoveryInstance yourInstance) throws CuratorException, org.apache.thrift.TException
    {
      send_startDiscovery(projection, basePath, yourInstance);
      return recv_startDiscovery();
    }

    public void send_startDiscovery(CuratorProjection projection, String basePath, DiscoveryInstance yourInstance) throws org.apache.thrift.TException
    {
      startDiscovery_args args = new startDiscovery_args();
      args.setProjection(projection);
      args.setBasePath(basePath);
      args.setYourInstance(yourInstance);
      sendBase("startDiscovery", args);
    }

    public DiscoveryProjection recv_startDiscovery() throws CuratorException, org.apache.thrift.TException
    {
      startDiscovery_result result = new startDiscovery_result();
      receiveBase(result, "startDiscovery");
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.ex1 != null) {
        throw result.ex1;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "startDiscovery failed: unknown result");
    }

    public DiscoveryProviderProjection startProvider(CuratorProjection projection, DiscoveryProjection discoveryProjection, String serviceName, ProviderStrategyType providerStrategy, int downTimeoutMs, int downErrorThreshold) throws CuratorException, org.apache.thrift.TException
    {
      send_startProvider(projection, discoveryProjection, serviceName, providerStrategy, downTimeoutMs, downErrorThreshold);
      return recv_startProvider();
    }

    public void send_startProvider(CuratorProjection projection, DiscoveryProjection discoveryProjection, String serviceName, ProviderStrategyType providerStrategy, int downTimeoutMs, int downErrorThreshold) throws org.apache.thrift.TException
    {
      startProvider_args args = new startProvider_args();
      args.setProjection(projection);
      args.setDiscoveryProjection(discoveryProjection);
      args.setServiceName(serviceName);
      args.setProviderStrategy(providerStrategy);
      args.setDownTimeoutMs(downTimeoutMs);
      args.setDownErrorThreshold(downErrorThreshold);
      sendBase("startProvider", args);
    }

    public DiscoveryProviderProjection recv_startProvider() throws CuratorException, org.apache.thrift.TException
    {
      startProvider_result result = new startProvider_result();
      receiveBase(result, "startProvider");
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.ex1 != null) {
        throw result.ex1;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "startProvider failed: unknown result");
    }

  }
  public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
    public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
      private org.apache.thrift.async.TAsyncClientManager clientManager;
      private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
      public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
        this.clientManager = clientManager;
        this.protocolFactory = protocolFactory;
      }
      public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
        return new AsyncClient(protocolFactory, clientManager, transport);
      }
    }

    public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) {
      super(protocolFactory, clientManager, transport);
    }

    public void getAllInstances(CuratorProjection projection, DiscoveryProviderProjection providerProjection, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
      checkReady();
      getAllInstances_call method_call = new getAllInstances_call(projection, providerProjection, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class getAllInstances_call extends org.apache.thrift.async.TAsyncMethodCall {
      private CuratorProjection projection;
      private DiscoveryProviderProjection providerProjection;
      public getAllInstances_call(CuratorProjection projection, DiscoveryProviderProjection providerProjection, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.projection = projection;
        this.providerProjection = providerProjection;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getAllInstances", org.apache.thrift.protocol.TMessageType.CALL, 0));
        getAllInstances_args args = new getAllInstances_args();
        args.setProjection(projection);
        args.setProviderProjection(providerProjection);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public List<DiscoveryInstance> getResult() throws CuratorException, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new 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);
        return (new Client(prot)).recv_getAllInstances();
      }
    }

    public void getInstance(CuratorProjection projection, DiscoveryProviderProjection providerProjection, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
      checkReady();
      getInstance_call method_call = new getInstance_call(projection, providerProjection, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class getInstance_call extends org.apache.thrift.async.TAsyncMethodCall {
      private CuratorProjection projection;
      private DiscoveryProviderProjection providerProjection;
      public getInstance_call(CuratorProjection projection, DiscoveryProviderProjection providerProjection, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.projection = projection;
        this.providerProjection = providerProjection;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getInstance", org.apache.thrift.protocol.TMessageType.CALL, 0));
        getInstance_args args = new getInstance_args();
        args.setProjection(projection);
        args.setProviderProjection(providerProjection);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public DiscoveryInstance getResult() throws CuratorException, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new 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);
        return (new Client(prot)).recv_getInstance();
      }
    }

    public void makeDiscoveryInstance(String name, ByteBuffer payload, int port, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
      checkReady();
      makeDiscoveryInstance_call method_call = new makeDiscoveryInstance_call(name, payload, port, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class makeDiscoveryInstance_call extends org.apache.thrift.async.TAsyncMethodCall {
      private String name;
      private ByteBuffer payload;
      private int port;
      public makeDiscoveryInstance_call(String name, ByteBuffer payload, int port, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.name = name;
        this.payload = payload;
        this.port = port;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("makeDiscoveryInstance", org.apache.thrift.protocol.TMessageType.CALL, 0));
        makeDiscoveryInstance_args args = new makeDiscoveryInstance_args();
        args.setName(name);
        args.setPayload(payload);
        args.setPort(port);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public DiscoveryInstance getResult() throws CuratorException, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new 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);
        return (new Client(prot)).recv_makeDiscoveryInstance();
      }
    }

    public void noteError(CuratorProjection projection, DiscoveryProviderProjection providerProjection, String instanceId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
      checkReady();
      noteError_call method_call = new noteError_call(projection, providerProjection, instanceId, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class noteError_call extends org.apache.thrift.async.TAsyncMethodCall {
      private CuratorProjection projection;
      private DiscoveryProviderProjection providerProjection;
      private String instanceId;
      public noteError_call(CuratorProjection projection, DiscoveryProviderProjection providerProjection, String instanceId, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.projection = projection;
        this.providerProjection = providerProjection;
        this.instanceId = instanceId;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("noteError", org.apache.thrift.protocol.TMessageType.CALL, 0));
        noteError_args args = new noteError_args();
        args.setProjection(projection);
        args.setProviderProjection(providerProjection);
        args.setInstanceId(instanceId);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public void getResult() throws CuratorException, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new 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);
        (new Client(prot)).recv_noteError();
      }
    }

    public void startDiscovery(CuratorProjection projection, String basePath, DiscoveryInstance yourInstance, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
      checkReady();
      startDiscovery_call method_call = new startDiscovery_call(projection, basePath, yourInstance, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class startDiscovery_call extends org.apache.thrift.async.TAsyncMethodCall {
      private CuratorProjection projection;
      private String basePath;
      private DiscoveryInstance yourInstance;
      public startDiscovery_call(CuratorProjection projection, String basePath, DiscoveryInstance yourInstance, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.projection = projection;
        this.basePath = basePath;
        this.yourInstance = yourInstance;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("startDiscovery", org.apache.thrift.protocol.TMessageType.CALL, 0));
        startDiscovery_args args = new startDiscovery_args();
        args.setProjection(projection);
        args.setBasePath(basePath);
        args.setYourInstance(yourInstance);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public DiscoveryProjection getResult() throws CuratorException, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new 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);
        return (new Client(prot)).recv_startDiscovery();
      }
    }

    public void startProvider(CuratorProjection projection, DiscoveryProjection discoveryProjection, String serviceName, ProviderStrategyType providerStrategy, int downTimeoutMs, int downErrorThreshold, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
      checkReady();
      startProvider_call method_call = new startProvider_call(projection, discoveryProjection, serviceName, providerStrategy, downTimeoutMs, downErrorThreshold, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class startProvider_call extends org.apache.thrift.async.TAsyncMethodCall {
      private CuratorProjection projection;
      private DiscoveryProjection discoveryProjection;
      private String serviceName;
      private ProviderStrategyType providerStrategy;
      private int downTimeoutMs;
      private int downErrorThreshold;
      public startProvider_call(CuratorProjection projection, DiscoveryProjection discoveryProjection, String serviceName, ProviderStrategyType providerStrategy, int downTimeoutMs, int downErrorThreshold, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.projection = projection;
        this.discoveryProjection = discoveryProjection;
        this.serviceName = serviceName;
        this.providerStrategy = providerStrategy;
        this.downTimeoutMs = downTimeoutMs;
        this.downErrorThreshold = downErrorThreshold;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("startProvider", org.apache.thrift.protocol.TMessageType.CALL, 0));
        startProvider_args args = new startProvider_args();
        args.setProjection(projection);
        args.setDiscoveryProjection(discoveryProjection);
        args.setServiceName(serviceName);
        args.setProviderStrategy(providerStrategy);
        args.setDownTimeoutMs(downTimeoutMs);
        args.setDownErrorThreshold(downErrorThreshold);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public DiscoveryProviderProjection getResult() throws CuratorException, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new 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);
        return (new Client(prot)).recv_startProvider();
      }
    }

  }

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

    protected Processor(I iface, Map<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) {
      processMap.put("getAllInstances", new getAllInstances());
      processMap.put("getInstance", new getInstance());
      processMap.put("makeDiscoveryInstance", new makeDiscoveryInstance());
      processMap.put("noteError", new noteError());
      processMap.put("startDiscovery", new startDiscovery());
      processMap.put("startProvider", new startProvider());
      return processMap;
    }

    public static class getAllInstances<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getAllInstances_args> {
      public getAllInstances() {
        super("getAllInstances");
      }

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

      protected boolean isOneway() {
        return false;
      }

      public getAllInstances_result getResult(I iface, getAllInstances_args args) throws org.apache.thrift.TException {
        getAllInstances_result result = new getAllInstances_result();
        try {
          result.success = iface.getAllInstances(args.projection, args.providerProjection);
        } catch (CuratorException ex1) {
          result.ex1 = ex1;
        }
        return result;
      }
    }

    public static class getInstance<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getInstance_args> {
      public getInstance() {
        super("getInstance");
      }

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

      protected boolean isOneway() {
        return false;
      }

      public getInstance_result getResult(I iface, getInstance_args args) throws org.apache.thrift.TException {
        getInstance_result result = new getInstance_result();
        try {
          result.success = iface.getInstance(args.projection, args.providerProjection);
        } catch (CuratorException ex1) {
          result.ex1 = ex1;
        }
        return result;
      }
    }

    public static class makeDiscoveryInstance<I extends Iface> extends org.apache.thrift.ProcessFunction<I, makeDiscoveryInstance_args> {
      public makeDiscoveryInstance() {
        super("makeDiscoveryInstance");
      }

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

      protected boolean isOneway() {
        return false;
      }

      public makeDiscoveryInstance_result getResult(I iface, makeDiscoveryInstance_args args) throws org.apache.thrift.TException {
        makeDiscoveryInstance_result result = new makeDiscoveryInstance_result();
        try {
          result.success = iface.makeDiscoveryInstance(args.name, args.payload, args.port);
        } catch (CuratorException ex1) {
          result.ex1 = ex1;
        }
        return result;
      }
    }

    public static class noteError<I extends Iface> extends org.apache.thrift.ProcessFunction<I, noteError_args> {
      public noteError() {
        super("noteError");
      }

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

      protected boolean isOneway() {
        return false;
      }

      public noteError_result getResult(I iface, noteError_args args) throws org.apache.thrift.TException {
        noteError_result result = new noteError_result();
        try {
          iface.noteError(args.projection, args.providerProjection, args.instanceId);
        } catch (CuratorException ex1) {
          result.ex1 = ex1;
        }
        return result;
      }
    }

    public static class startDiscovery<I extends Iface> extends org.apache.thrift.ProcessFunction<I, startDiscovery_args> {
      public startDiscovery() {
        super("startDiscovery");
      }

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

      protected boolean isOneway() {
        return false;
      }

      public startDiscovery_result getResult(I iface, startDiscovery_args args) throws org.apache.thrift.TException {
        startDiscovery_result result = new startDiscovery_result();
        try {
          result.success = iface.startDiscovery(args.projection, args.basePath, args.yourInstance);
        } catch (CuratorException ex1) {
          result.ex1 = ex1;
        }
        return result;
      }
    }

    public static class startProvider<I extends Iface> extends org.apache.thrift.ProcessFunction<I, startProvider_args> {
      public startProvider() {
        super("startProvider");
      }

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

      protected boolean isOneway() {
        return false;
      }

      public startProvider_result getResult(I iface, startProvider_args args) throws org.apache.thrift.TException {
        startProvider_result result = new startProvider_result();
        try {
          result.success = iface.startProvider(args.projection, args.discoveryProjection, args.serviceName, args.providerStrategy, args.downTimeoutMs, args.downErrorThreshold);
        } catch (CuratorException ex1) {
          result.ex1 = ex1;
        }
        return result;
      }
    }

  }

  public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
    private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName());
    public AsyncProcessor(I iface) {
      super(iface, getProcessMap(new HashMap<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>()));
    }

    protected AsyncProcessor(I iface, Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase, ?>> processMap) {
      super(iface, getProcessMap(processMap));
    }

    private static <I extends AsyncIface> Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase,?>> getProcessMap(Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase, ?>> processMap) {
      processMap.put("getAllInstances", new getAllInstances());
      processMap.put("getInstance", new getInstance());
      processMap.put("makeDiscoveryInstance", new makeDiscoveryInstance());
      processMap.put("noteError", new noteError());
      processMap.put("startDiscovery", new startDiscovery());
      processMap.put("startProvider", new startProvider());
      return processMap;
    }

    public static class getAllInstances<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getAllInstances_args, List<DiscoveryInstance>> {
      public getAllInstances() {
        super("getAllInstances");
      }

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

      public AsyncMethodCallback<List<DiscoveryInstance>> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new AsyncMethodCallback<List<DiscoveryInstance>>() { 
          public void onComplete(List<DiscoveryInstance> o) {
            getAllInstances_result result = new getAllInstances_result();
            result.success = o;
            try {
              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
              return;
            } catch (Exception e) {
              LOGGER.error("Exception writing to internal frame buffer", e);
            }
            fb.close();
          }
          public void onError(Exception e) {
            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TBase msg;
            getAllInstances_result result = new getAllInstances_result();
            if (e instanceof CuratorException) {
                        result.ex1 = (CuratorException) e;
                        result.setEx1IsSet(true);
                        msg = result;
            }
             else 
            {
              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
            }
            try {
              fcall.sendResponse(fb,msg,msgType,seqid);
              return;
            } catch (Exception ex) {
              LOGGER.error("Exception writing to internal frame buffer", ex);
            }
            fb.close();
          }
        };
      }

      protected boolean isOneway() {
        return false;
      }

      public void start(I iface, getAllInstances_args args, org.apache.thrift.async.AsyncMethodCallback<List<DiscoveryInstance>> resultHandler) throws TException {
        iface.getAllInstances(args.projection, args.providerProjection,resultHandler);
      }
    }

    public static class getInstance<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getInstance_args, DiscoveryInstance> {
      public getInstance() {
        super("getInstance");
      }

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

      public AsyncMethodCallback<DiscoveryInstance> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new AsyncMethodCallback<DiscoveryInstance>() { 
          public void onComplete(DiscoveryInstance o) {
            getInstance_result result = new getInstance_result();
            result.success = o;
            try {
              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
              return;
            } catch (Exception e) {
              LOGGER.error("Exception writing to internal frame buffer", e);
            }
            fb.close();
          }
          public void onError(Exception e) {
            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TBase msg;
            getInstance_result result = new getInstance_result();
            if (e instanceof CuratorException) {
                        result.ex1 = (CuratorException) e;
                        result.setEx1IsSet(true);
                        msg = result;
            }
             else 
            {
              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
            }
            try {
              fcall.sendResponse(fb,msg,msgType,seqid);
              return;
            } catch (Exception ex) {
              LOGGER.error("Exception writing to internal frame buffer", ex);
            }
            fb.close();
          }
        };
      }

      protected boolean isOneway() {
        return false;
      }

      public void start(I iface, getInstance_args args, org.apache.thrift.async.AsyncMethodCallback<DiscoveryInstance> resultHandler) throws TException {
        iface.getInstance(args.projection, args.providerProjection,resultHandler);
      }
    }

    public static class makeDiscoveryInstance<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, makeDiscoveryInstance_args, DiscoveryInstance> {
      public makeDiscoveryInstance() {
        super("makeDiscoveryInstance");
      }

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

      public AsyncMethodCallback<DiscoveryInstance> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new AsyncMethodCallback<DiscoveryInstance>() { 
          public void onComplete(DiscoveryInstance o) {
            makeDiscoveryInstance_result result = new makeDiscoveryInstance_result();
            result.success = o;
            try {
              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
              return;
            } catch (Exception e) {
              LOGGER.error("Exception writing to internal frame buffer", e);
            }
            fb.close();
          }
          public void onError(Exception e) {
            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TBase msg;
            makeDiscoveryInstance_result result = new makeDiscoveryInstance_result();
            if (e instanceof CuratorException) {
                        result.ex1 = (CuratorException) e;
                        result.setEx1IsSet(true);
                        msg = result;
            }
             else 
            {
              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
            }
            try {
              fcall.sendResponse(fb,msg,msgType,seqid);
              return;
            } catch (Exception ex) {
              LOGGER.error("Exception writing to internal frame buffer", ex);
            }
            fb.close();
          }
        };
      }

      protected boolean isOneway() {
        return false;
      }

      public void start(I iface, makeDiscoveryInstance_args args, org.apache.thrift.async.AsyncMethodCallback<DiscoveryInstance> resultHandler) throws TException {
        iface.makeDiscoveryInstance(args.name, args.payload, args.port,resultHandler);
      }
    }

    public static class noteError<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, noteError_args, Void> {
      public noteError() {
        super("noteError");
      }

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

      public AsyncMethodCallback<Void> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new AsyncMethodCallback<Void>() { 
          public void onComplete(Void o) {
            noteError_result result = new noteError_result();
            try {
              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
              return;
            } catch (Exception e) {
              LOGGER.error("Exception writing to internal frame buffer", e);
            }
            fb.close();
          }
          public void onError(Exception e) {
            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TBase msg;
            noteError_result result = new noteError_result();
            if (e instanceof CuratorException) {
                        result.ex1 = (CuratorException) e;
                        result.setEx1IsSet(true);
                        msg = result;
            }
             else 
            {
              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
            }
            try {
              fcall.sendResponse(fb,msg,msgType,seqid);
              return;
            } catch (Exception ex) {
              LOGGER.error("Exception writing to internal frame buffer", ex);
            }
            fb.close();
          }
        };
      }

      protected boolean isOneway() {
        return false;
      }

      public void start(I iface, noteError_args args, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws TException {
        iface.noteError(args.projection, args.providerProjection, args.instanceId,resultHandler);
      }
    }

    public static class startDiscovery<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, startDiscovery_args, DiscoveryProjection> {
      public startDiscovery() {
        super("startDiscovery");
      }

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

      public AsyncMethodCallback<DiscoveryProjection> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new AsyncMethodCallback<DiscoveryProjection>() { 
          public void onComplete(DiscoveryProjection o) {
            startDiscovery_result result = new startDiscovery_result();
            result.success = o;
            try {
              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
              return;
            } catch (Exception e) {
              LOGGER.error("Exception writing to internal frame buffer", e);
            }
            fb.close();
          }
          public void onError(Exception e) {
            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TBase msg;
            startDiscovery_result result = new startDiscovery_result();
            if (e instanceof CuratorException) {
                        result.ex1 = (CuratorException) e;
                        result.setEx1IsSet(true);
                        msg = result;
            }
             else 
            {
              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
            }
            try {
              fcall.sendResponse(fb,msg,msgType,seqid);
              return;
            } catch (Exception ex) {
              LOGGER.error("Exception writing to internal frame buffer", ex);
            }
            fb.close();
          }
        };
      }

      protected boolean isOneway() {
        return false;
      }

      public void start(I iface, startDiscovery_args args, org.apache.thrift.async.AsyncMethodCallback<DiscoveryProjection> resultHandler) throws TException {
        iface.startDiscovery(args.projection, args.basePath, args.yourInstance,resultHandler);
      }
    }

    public static class startProvider<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, startProvider_args, DiscoveryProviderProjection> {
      public startProvider() {
        super("startProvider");
      }

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

      public AsyncMethodCallback<DiscoveryProviderProjection> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new AsyncMethodCallback<DiscoveryProviderProjection>() { 
          public void onComplete(DiscoveryProviderProjection o) {
            startProvider_result result = new startProvider_result();
            result.success = o;
            try {
              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
              return;
            } catch (Exception e) {
              LOGGER.error("Exception writing to internal frame buffer", e);
            }
            fb.close();
          }
          public void onError(Exception e) {
            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TBase msg;
            startProvider_result result = new startProvider_result();
            if (e instanceof CuratorException) {
                        result.ex1 = (CuratorException) e;
                        result.setEx1IsSet(true);
                        msg = result;
            }
             else 
            {
              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
            }
            try {
              fcall.sendResponse(fb,msg,msgType,seqid);
              return;
            } catch (Exception ex) {
              LOGGER.error("Exception writing to internal frame buffer", ex);
            }
            fb.close();
          }
        };
      }

      protected boolean isOneway() {
        return false;
      }

      public void start(I iface, startProvider_args args, org.apache.thrift.async.AsyncMethodCallback<DiscoveryProviderProjection> resultHandler) throws TException {
        iface.startProvider(args.projection, args.discoveryProjection, args.serviceName, args.providerStrategy, args.downTimeoutMs, args.downErrorThreshold,resultHandler);
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("projection", org.apache.thrift.protocol.TType.STRUCT, (short)1);
    private static final org.apache.thrift.protocol.TField PROVIDER_PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("providerProjection", 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 getAllInstances_argsStandardSchemeFactory());
      schemes.put(TupleScheme.class, new getAllInstances_argsTupleSchemeFactory());
    }

    public CuratorProjection projection; // required
    public DiscoveryProviderProjection providerProjection; // 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 {
      PROJECTION((short)1, "projection"),
      PROVIDER_PROJECTION((short)2, "providerProjection");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      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: // PROJECTION
            return PROJECTION;
          case 2: // PROVIDER_PROJECTION
            return PROVIDER_PROJECTION;
          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.PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("projection", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CuratorProjection.class)));
      tmpMap.put(_Fields.PROVIDER_PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("providerProjection", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, DiscoveryProviderProjection.class)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getAllInstances_args.class, metaDataMap);
    }

    public getAllInstances_args() {
    }

    public getAllInstances_args(
      CuratorProjection projection,
      DiscoveryProviderProjection providerProjection)
    {
      this();
      this.projection = projection;
      this.providerProjection = providerProjection;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getAllInstances_args(getAllInstances_args other) {
      if (other.isSetProjection()) {
        this.projection = new CuratorProjection(other.projection);
      }
      if (other.isSetProviderProjection()) {
        this.providerProjection = new DiscoveryProviderProjection(other.providerProjection);
      }
    }

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

    @Override
    public void clear() {
      this.projection = null;
      this.providerProjection = null;
    }

    public CuratorProjection getProjection() {
      return this.projection;
    }

    public getAllInstances_args setProjection(CuratorProjection projection) {
      this.projection = projection;
      return this;
    }

    public void unsetProjection() {
      this.projection = null;
    }

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

    public void setProjectionIsSet(boolean value) {
      if (!value) {
        this.projection = null;
      }
    }

    public DiscoveryProviderProjection getProviderProjection() {
      return this.providerProjection;
    }

    public getAllInstances_args setProviderProjection(DiscoveryProviderProjection providerProjection) {
      this.providerProjection = providerProjection;
      return this;
    }

    public void unsetProviderProjection() {
      this.providerProjection = null;
    }

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

    public void setProviderProjectionIsSet(boolean value) {
      if (!value) {
        this.providerProjection = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case PROJECTION:
        if (value == null) {
          unsetProjection();
        } else {
          setProjection((CuratorProjection)value);
        }
        break;

      case PROVIDER_PROJECTION:
        if (value == null) {
          unsetProviderProjection();
        } else {
          setProviderProjection((DiscoveryProviderProjection)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case PROJECTION:
        return getProjection();

      case PROVIDER_PROJECTION:
        return getProviderProjection();

      }
      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 PROJECTION:
        return isSetProjection();
      case PROVIDER_PROJECTION:
        return isSetProviderProjection();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_projection = true && this.isSetProjection();
      boolean that_present_projection = true && that.isSetProjection();
      if (this_present_projection || that_present_projection) {
        if (!(this_present_projection && that_present_projection))
          return false;
        if (!this.projection.equals(that.projection))
          return false;
      }

      boolean this_present_providerProjection = true && this.isSetProviderProjection();
      boolean that_present_providerProjection = true && that.isSetProviderProjection();
      if (this_present_providerProjection || that_present_providerProjection) {
        if (!(this_present_providerProjection && that_present_providerProjection))
          return false;
        if (!this.providerProjection.equals(that.providerProjection))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

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

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetProjection()).compareTo(other.isSetProjection());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetProjection()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.projection, other.projection);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetProviderProjection()).compareTo(other.isSetProviderProjection());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetProviderProjection()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.providerProjection, other.providerProjection);
        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("getAllInstances_args(");
      boolean first = true;

      sb.append("projection:");
      if (this.projection == null) {
        sb.append("null");
      } else {
        sb.append(this.projection);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("providerProjection:");
      if (this.providerProjection == null) {
        sb.append("null");
      } else {
        sb.append(this.providerProjection);
      }
      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 (projection != null) {
        projection.validate();
      }
      if (providerProjection != null) {
        providerProjection.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 getAllInstances_argsStandardSchemeFactory implements SchemeFactory {
      public getAllInstances_argsStandardScheme getScheme() {
        return new getAllInstances_argsStandardScheme();
      }
    }

    private static class getAllInstances_argsStandardScheme extends StandardScheme<getAllInstances_args> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, getAllInstances_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: // PROJECTION
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.projection = new CuratorProjection();
                struct.projection.read(iprot);
                struct.setProjectionIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 2: // PROVIDER_PROJECTION
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.providerProjection = new DiscoveryProviderProjection();
                struct.providerProjection.read(iprot);
                struct.setProviderProjectionIsSet(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, getAllInstances_args struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.projection != null) {
          oprot.writeFieldBegin(PROJECTION_FIELD_DESC);
          struct.projection.write(oprot);
          oprot.writeFieldEnd();
        }
        if (struct.providerProjection != null) {
          oprot.writeFieldBegin(PROVIDER_PROJECTION_FIELD_DESC);
          struct.providerProjection.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class getAllInstances_argsTupleSchemeFactory implements SchemeFactory {
      public getAllInstances_argsTupleScheme getScheme() {
        return new getAllInstances_argsTupleScheme();
      }
    }

    private static class getAllInstances_argsTupleScheme extends TupleScheme<getAllInstances_args> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, getAllInstances_args struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetProjection()) {
          optionals.set(0);
        }
        if (struct.isSetProviderProjection()) {
          optionals.set(1);
        }
        oprot.writeBitSet(optionals, 2);
        if (struct.isSetProjection()) {
          struct.projection.write(oprot);
        }
        if (struct.isSetProviderProjection()) {
          struct.providerProjection.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, getAllInstances_args struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(2);
        if (incoming.get(0)) {
          struct.projection = new CuratorProjection();
          struct.projection.read(iprot);
          struct.setProjectionIsSet(true);
        }
        if (incoming.get(1)) {
          struct.providerProjection = new DiscoveryProviderProjection();
          struct.providerProjection.read(iprot);
          struct.setProviderProjectionIsSet(true);
        }
      }
    }

  }

  public static class getAllInstances_result implements org.apache.thrift.TBase<getAllInstances_result, getAllInstances_result._Fields>, java.io.Serializable, Cloneable, Comparable<getAllInstances_result>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getAllInstances_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 EX1_FIELD_DESC = new org.apache.thrift.protocol.TField("ex1", 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 getAllInstances_resultStandardSchemeFactory());
      schemes.put(TupleScheme.class, new getAllInstances_resultTupleSchemeFactory());
    }

    public List<DiscoveryInstance> success; // required
    public CuratorException ex1; // 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"),
      EX1((short)1, "ex1");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      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: // EX1
            return EX1;
          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, DiscoveryInstance.class))));
      tmpMap.put(_Fields.EX1, new org.apache.thrift.meta_data.FieldMetaData("ex1", 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(getAllInstances_result.class, metaDataMap);
    }

    public getAllInstances_result() {
    }

    public getAllInstances_result(
      List<DiscoveryInstance> success,
      CuratorException ex1)
    {
      this();
      this.success = success;
      this.ex1 = ex1;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getAllInstances_result(getAllInstances_result other) {
      if (other.isSetSuccess()) {
        List<DiscoveryInstance> __this__success = new ArrayList<DiscoveryInstance>(other.success.size());
        for (DiscoveryInstance other_element : other.success) {
          __this__success.add(new DiscoveryInstance(other_element));
        }
        this.success = __this__success;
      }
      if (other.isSetEx1()) {
        this.ex1 = new CuratorException(other.ex1);
      }
    }

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

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

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

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

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

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

    public getAllInstances_result setSuccess(List<DiscoveryInstance> 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 CuratorException getEx1() {
      return this.ex1;
    }

    public getAllInstances_result setEx1(CuratorException ex1) {
      this.ex1 = ex1;
      return this;
    }

    public void unsetEx1() {
      this.ex1 = null;
    }

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

    public void setEx1IsSet(boolean value) {
      if (!value) {
        this.ex1 = null;
      }
    }

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

      case EX1:
        if (value == null) {
          unsetEx1();
        } else {
          setEx1((CuratorException)value);
        }
        break;

      }
    }

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

      case EX1:
        return getEx1();

      }
      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 EX1:
        return isSetEx1();
      }
      throw new IllegalStateException();
    }

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

    public boolean equals(getAllInstances_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_ex1 = true && this.isSetEx1();
      boolean that_present_ex1 = true && that.isSetEx1();
      if (this_present_ex1 || that_present_ex1) {
        if (!(this_present_ex1 && that_present_ex1))
          return false;
        if (!this.ex1.equals(that.ex1))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

    @Override
    public int compareTo(getAllInstances_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(isSetEx1()).compareTo(other.isSetEx1());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetEx1()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ex1, other.ex1);
        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("getAllInstances_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("ex1:");
      if (this.ex1 == null) {
        sb.append("null");
      } else {
        sb.append(this.ex1);
      }
      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 getAllInstances_resultStandardSchemeFactory implements SchemeFactory {
      public getAllInstances_resultStandardScheme getScheme() {
        return new getAllInstances_resultStandardScheme();
      }
    }

    private static class getAllInstances_resultStandardScheme extends StandardScheme<getAllInstances_result> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, getAllInstances_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 _list48 = iprot.readListBegin();
                  struct.success = new ArrayList<DiscoveryInstance>(_list48.size);
                  for (int _i49 = 0; _i49 < _list48.size; ++_i49)
                  {
                    DiscoveryInstance _elem50;
                    _elem50 = new DiscoveryInstance();
                    _elem50.read(iprot);
                    struct.success.add(_elem50);
                  }
                  iprot.readListEnd();
                }
                struct.setSuccessIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 1: // EX1
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.ex1 = new CuratorException();
                struct.ex1.read(iprot);
                struct.setEx1IsSet(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, getAllInstances_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 (DiscoveryInstance _iter51 : struct.success)
            {
              _iter51.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
        if (struct.ex1 != null) {
          oprot.writeFieldBegin(EX1_FIELD_DESC);
          struct.ex1.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class getAllInstances_resultTupleSchemeFactory implements SchemeFactory {
      public getAllInstances_resultTupleScheme getScheme() {
        return new getAllInstances_resultTupleScheme();
      }
    }

    private static class getAllInstances_resultTupleScheme extends TupleScheme<getAllInstances_result> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, getAllInstances_result struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetSuccess()) {
          optionals.set(0);
        }
        if (struct.isSetEx1()) {
          optionals.set(1);
        }
        oprot.writeBitSet(optionals, 2);
        if (struct.isSetSuccess()) {
          {
            oprot.writeI32(struct.success.size());
            for (DiscoveryInstance _iter52 : struct.success)
            {
              _iter52.write(oprot);
            }
          }
        }
        if (struct.isSetEx1()) {
          struct.ex1.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, getAllInstances_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 _list53 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
            struct.success = new ArrayList<DiscoveryInstance>(_list53.size);
            for (int _i54 = 0; _i54 < _list53.size; ++_i54)
            {
              DiscoveryInstance _elem55;
              _elem55 = new DiscoveryInstance();
              _elem55.read(iprot);
              struct.success.add(_elem55);
            }
          }
          struct.setSuccessIsSet(true);
        }
        if (incoming.get(1)) {
          struct.ex1 = new CuratorException();
          struct.ex1.read(iprot);
          struct.setEx1IsSet(true);
        }
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("projection", org.apache.thrift.protocol.TType.STRUCT, (short)1);
    private static final org.apache.thrift.protocol.TField PROVIDER_PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("providerProjection", 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 getInstance_argsStandardSchemeFactory());
      schemes.put(TupleScheme.class, new getInstance_argsTupleSchemeFactory());
    }

    public CuratorProjection projection; // required
    public DiscoveryProviderProjection providerProjection; // 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 {
      PROJECTION((short)1, "projection"),
      PROVIDER_PROJECTION((short)2, "providerProjection");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      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: // PROJECTION
            return PROJECTION;
          case 2: // PROVIDER_PROJECTION
            return PROVIDER_PROJECTION;
          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.PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("projection", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CuratorProjection.class)));
      tmpMap.put(_Fields.PROVIDER_PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("providerProjection", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, DiscoveryProviderProjection.class)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getInstance_args.class, metaDataMap);
    }

    public getInstance_args() {
    }

    public getInstance_args(
      CuratorProjection projection,
      DiscoveryProviderProjection providerProjection)
    {
      this();
      this.projection = projection;
      this.providerProjection = providerProjection;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getInstance_args(getInstance_args other) {
      if (other.isSetProjection()) {
        this.projection = new CuratorProjection(other.projection);
      }
      if (other.isSetProviderProjection()) {
        this.providerProjection = new DiscoveryProviderProjection(other.providerProjection);
      }
    }

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

    @Override
    public void clear() {
      this.projection = null;
      this.providerProjection = null;
    }

    public CuratorProjection getProjection() {
      return this.projection;
    }

    public getInstance_args setProjection(CuratorProjection projection) {
      this.projection = projection;
      return this;
    }

    public void unsetProjection() {
      this.projection = null;
    }

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

    public void setProjectionIsSet(boolean value) {
      if (!value) {
        this.projection = null;
      }
    }

    public DiscoveryProviderProjection getProviderProjection() {
      return this.providerProjection;
    }

    public getInstance_args setProviderProjection(DiscoveryProviderProjection providerProjection) {
      this.providerProjection = providerProjection;
      return this;
    }

    public void unsetProviderProjection() {
      this.providerProjection = null;
    }

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

    public void setProviderProjectionIsSet(boolean value) {
      if (!value) {
        this.providerProjection = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case PROJECTION:
        if (value == null) {
          unsetProjection();
        } else {
          setProjection((CuratorProjection)value);
        }
        break;

      case PROVIDER_PROJECTION:
        if (value == null) {
          unsetProviderProjection();
        } else {
          setProviderProjection((DiscoveryProviderProjection)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case PROJECTION:
        return getProjection();

      case PROVIDER_PROJECTION:
        return getProviderProjection();

      }
      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 PROJECTION:
        return isSetProjection();
      case PROVIDER_PROJECTION:
        return isSetProviderProjection();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_projection = true && this.isSetProjection();
      boolean that_present_projection = true && that.isSetProjection();
      if (this_present_projection || that_present_projection) {
        if (!(this_present_projection && that_present_projection))
          return false;
        if (!this.projection.equals(that.projection))
          return false;
      }

      boolean this_present_providerProjection = true && this.isSetProviderProjection();
      boolean that_present_providerProjection = true && that.isSetProviderProjection();
      if (this_present_providerProjection || that_present_providerProjection) {
        if (!(this_present_providerProjection && that_present_providerProjection))
          return false;
        if (!this.providerProjection.equals(that.providerProjection))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

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

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetProjection()).compareTo(other.isSetProjection());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetProjection()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.projection, other.projection);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetProviderProjection()).compareTo(other.isSetProviderProjection());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetProviderProjection()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.providerProjection, other.providerProjection);
        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("getInstance_args(");
      boolean first = true;

      sb.append("projection:");
      if (this.projection == null) {
        sb.append("null");
      } else {
        sb.append(this.projection);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("providerProjection:");
      if (this.providerProjection == null) {
        sb.append("null");
      } else {
        sb.append(this.providerProjection);
      }
      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 (projection != null) {
        projection.validate();
      }
      if (providerProjection != null) {
        providerProjection.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 getInstance_argsStandardSchemeFactory implements SchemeFactory {
      public getInstance_argsStandardScheme getScheme() {
        return new getInstance_argsStandardScheme();
      }
    }

    private static class getInstance_argsStandardScheme extends StandardScheme<getInstance_args> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, getInstance_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: // PROJECTION
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.projection = new CuratorProjection();
                struct.projection.read(iprot);
                struct.setProjectionIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 2: // PROVIDER_PROJECTION
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.providerProjection = new DiscoveryProviderProjection();
                struct.providerProjection.read(iprot);
                struct.setProviderProjectionIsSet(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, getInstance_args struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.projection != null) {
          oprot.writeFieldBegin(PROJECTION_FIELD_DESC);
          struct.projection.write(oprot);
          oprot.writeFieldEnd();
        }
        if (struct.providerProjection != null) {
          oprot.writeFieldBegin(PROVIDER_PROJECTION_FIELD_DESC);
          struct.providerProjection.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class getInstance_argsTupleSchemeFactory implements SchemeFactory {
      public getInstance_argsTupleScheme getScheme() {
        return new getInstance_argsTupleScheme();
      }
    }

    private static class getInstance_argsTupleScheme extends TupleScheme<getInstance_args> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, getInstance_args struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetProjection()) {
          optionals.set(0);
        }
        if (struct.isSetProviderProjection()) {
          optionals.set(1);
        }
        oprot.writeBitSet(optionals, 2);
        if (struct.isSetProjection()) {
          struct.projection.write(oprot);
        }
        if (struct.isSetProviderProjection()) {
          struct.providerProjection.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, getInstance_args struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(2);
        if (incoming.get(0)) {
          struct.projection = new CuratorProjection();
          struct.projection.read(iprot);
          struct.setProjectionIsSet(true);
        }
        if (incoming.get(1)) {
          struct.providerProjection = new DiscoveryProviderProjection();
          struct.providerProjection.read(iprot);
          struct.setProviderProjectionIsSet(true);
        }
      }
    }

  }

  public static class getInstance_result implements org.apache.thrift.TBase<getInstance_result, getInstance_result._Fields>, java.io.Serializable, Cloneable, Comparable<getInstance_result>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getInstance_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 EX1_FIELD_DESC = new org.apache.thrift.protocol.TField("ex1", 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 getInstance_resultStandardSchemeFactory());
      schemes.put(TupleScheme.class, new getInstance_resultTupleSchemeFactory());
    }

    public DiscoveryInstance success; // required
    public CuratorException ex1; // 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"),
      EX1((short)1, "ex1");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      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: // EX1
            return EX1;
          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, DiscoveryInstance.class)));
      tmpMap.put(_Fields.EX1, new org.apache.thrift.meta_data.FieldMetaData("ex1", 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(getInstance_result.class, metaDataMap);
    }

    public getInstance_result() {
    }

    public getInstance_result(
      DiscoveryInstance success,
      CuratorException ex1)
    {
      this();
      this.success = success;
      this.ex1 = ex1;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getInstance_result(getInstance_result other) {
      if (other.isSetSuccess()) {
        this.success = new DiscoveryInstance(other.success);
      }
      if (other.isSetEx1()) {
        this.ex1 = new CuratorException(other.ex1);
      }
    }

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

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

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

    public getInstance_result setSuccess(DiscoveryInstance 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 CuratorException getEx1() {
      return this.ex1;
    }

    public getInstance_result setEx1(CuratorException ex1) {
      this.ex1 = ex1;
      return this;
    }

    public void unsetEx1() {
      this.ex1 = null;
    }

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

    public void setEx1IsSet(boolean value) {
      if (!value) {
        this.ex1 = null;
      }
    }

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

      case EX1:
        if (value == null) {
          unsetEx1();
        } else {
          setEx1((CuratorException)value);
        }
        break;

      }
    }

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

      case EX1:
        return getEx1();

      }
      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 EX1:
        return isSetEx1();
      }
      throw new IllegalStateException();
    }

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

    public boolean equals(getInstance_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_ex1 = true && this.isSetEx1();
      boolean that_present_ex1 = true && that.isSetEx1();
      if (this_present_ex1 || that_present_ex1) {
        if (!(this_present_ex1 && that_present_ex1))
          return false;
        if (!this.ex1.equals(that.ex1))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

    @Override
    public int compareTo(getInstance_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(isSetEx1()).compareTo(other.isSetEx1());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetEx1()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ex1, other.ex1);
        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("getInstance_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("ex1:");
      if (this.ex1 == null) {
        sb.append("null");
      } else {
        sb.append(this.ex1);
      }
      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 getInstance_resultStandardSchemeFactory implements SchemeFactory {
      public getInstance_resultStandardScheme getScheme() {
        return new getInstance_resultStandardScheme();
      }
    }

    private static class getInstance_resultStandardScheme extends StandardScheme<getInstance_result> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, getInstance_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 DiscoveryInstance();
                struct.success.read(iprot);
                struct.setSuccessIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 1: // EX1
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.ex1 = new CuratorException();
                struct.ex1.read(iprot);
                struct.setEx1IsSet(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, getInstance_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.ex1 != null) {
          oprot.writeFieldBegin(EX1_FIELD_DESC);
          struct.ex1.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class getInstance_resultTupleSchemeFactory implements SchemeFactory {
      public getInstance_resultTupleScheme getScheme() {
        return new getInstance_resultTupleScheme();
      }
    }

    private static class getInstance_resultTupleScheme extends TupleScheme<getInstance_result> {

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

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, getInstance_result struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(2);
        if (incoming.get(0)) {
          struct.success = new DiscoveryInstance();
          struct.success.read(iprot);
          struct.setSuccessIsSet(true);
        }
        if (incoming.get(1)) {
          struct.ex1 = new CuratorException();
          struct.ex1.read(iprot);
          struct.setEx1IsSet(true);
        }
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)1);
    private static final org.apache.thrift.protocol.TField PAYLOAD_FIELD_DESC = new org.apache.thrift.protocol.TField("payload", org.apache.thrift.protocol.TType.STRING, (short)2);
    private static final org.apache.thrift.protocol.TField PORT_FIELD_DESC = new org.apache.thrift.protocol.TField("port", org.apache.thrift.protocol.TType.I32, (short)3);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new makeDiscoveryInstance_argsStandardSchemeFactory());
      schemes.put(TupleScheme.class, new makeDiscoveryInstance_argsTupleSchemeFactory());
    }

    public String name; // required
    public ByteBuffer payload; // required
    public int port; // 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 {
      NAME((short)1, "name"),
      PAYLOAD((short)2, "payload"),
      PORT((short)3, "port");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      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: // NAME
            return NAME;
          case 2: // PAYLOAD
            return PAYLOAD;
          case 3: // PORT
            return PORT;
          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
    private static final int __PORT_ISSET_ID = 0;
    private byte __isset_bitfield = 0;
    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    static {
      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
      tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      tmpMap.put(_Fields.PAYLOAD, new org.apache.thrift.meta_data.FieldMetaData("payload", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING          , true)));
      tmpMap.put(_Fields.PORT, new org.apache.thrift.meta_data.FieldMetaData("port", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(makeDiscoveryInstance_args.class, metaDataMap);
    }

    public makeDiscoveryInstance_args() {
    }

    public makeDiscoveryInstance_args(
      String name,
      ByteBuffer payload,
      int port)
    {
      this();
      this.name = name;
      this.payload = payload;
      this.port = port;
      setPortIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public makeDiscoveryInstance_args(makeDiscoveryInstance_args other) {
      __isset_bitfield = other.__isset_bitfield;
      if (other.isSetName()) {
        this.name = other.name;
      }
      if (other.isSetPayload()) {
        this.payload = org.apache.thrift.TBaseHelper.copyBinary(other.payload);
;
      }
      this.port = other.port;
    }

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

    @Override
    public void clear() {
      this.name = null;
      this.payload = null;
      setPortIsSet(false);
      this.port = 0;
    }

    public String getName() {
      return this.name;
    }

    public makeDiscoveryInstance_args setName(String name) {
      this.name = name;
      return this;
    }

    public void unsetName() {
      this.name = null;
    }

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

    public void setNameIsSet(boolean value) {
      if (!value) {
        this.name = null;
      }
    }

    public byte[] getPayload() {
      setPayload(org.apache.thrift.TBaseHelper.rightSize(payload));
      return payload == null ? null : payload.array();
    }

    public ByteBuffer bufferForPayload() {
      return payload;
    }

    public makeDiscoveryInstance_args setPayload(byte[] payload) {
      setPayload(payload == null ? (ByteBuffer)null : ByteBuffer.wrap(payload));
      return this;
    }

    public makeDiscoveryInstance_args setPayload(ByteBuffer payload) {
      this.payload = payload;
      return this;
    }

    public void unsetPayload() {
      this.payload = null;
    }

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

    public void setPayloadIsSet(boolean value) {
      if (!value) {
        this.payload = null;
      }
    }

    public int getPort() {
      return this.port;
    }

    public makeDiscoveryInstance_args setPort(int port) {
      this.port = port;
      setPortIsSet(true);
      return this;
    }

    public void unsetPort() {
      __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PORT_ISSET_ID);
    }

    /** Returns true if field port is set (has been assigned a value) and false otherwise */
    public boolean isSetPort() {
      return EncodingUtils.testBit(__isset_bitfield, __PORT_ISSET_ID);
    }

    public void setPortIsSet(boolean value) {
      __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PORT_ISSET_ID, value);
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case NAME:
        if (value == null) {
          unsetName();
        } else {
          setName((String)value);
        }
        break;

      case PAYLOAD:
        if (value == null) {
          unsetPayload();
        } else {
          setPayload((ByteBuffer)value);
        }
        break;

      case PORT:
        if (value == null) {
          unsetPort();
        } else {
          setPort((Integer)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case NAME:
        return getName();

      case PAYLOAD:
        return getPayload();

      case PORT:
        return Integer.valueOf(getPort());

      }
      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 NAME:
        return isSetName();
      case PAYLOAD:
        return isSetPayload();
      case PORT:
        return isSetPort();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_name = true && this.isSetName();
      boolean that_present_name = true && that.isSetName();
      if (this_present_name || that_present_name) {
        if (!(this_present_name && that_present_name))
          return false;
        if (!this.name.equals(that.name))
          return false;
      }

      boolean this_present_payload = true && this.isSetPayload();
      boolean that_present_payload = true && that.isSetPayload();
      if (this_present_payload || that_present_payload) {
        if (!(this_present_payload && that_present_payload))
          return false;
        if (!this.payload.equals(that.payload))
          return false;
      }

      boolean this_present_port = true;
      boolean that_present_port = true;
      if (this_present_port || that_present_port) {
        if (!(this_present_port && that_present_port))
          return false;
        if (this.port != that.port)
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

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

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetName()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetPayload()).compareTo(other.isSetPayload());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetPayload()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.payload, other.payload);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetPort()).compareTo(other.isSetPort());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetPort()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.port, other.port);
        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("makeDiscoveryInstance_args(");
      boolean first = true;

      sb.append("name:");
      if (this.name == null) {
        sb.append("null");
      } else {
        sb.append(this.name);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("payload:");
      if (this.payload == null) {
        sb.append("null");
      } else {
        org.apache.thrift.TBaseHelper.toString(this.payload, sb);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("port:");
      sb.append(this.port);
      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 {
        // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
        __isset_bitfield = 0;
        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 makeDiscoveryInstance_argsStandardSchemeFactory implements SchemeFactory {
      public makeDiscoveryInstance_argsStandardScheme getScheme() {
        return new makeDiscoveryInstance_argsStandardScheme();
      }
    }

    private static class makeDiscoveryInstance_argsStandardScheme extends StandardScheme<makeDiscoveryInstance_args> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, makeDiscoveryInstance_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: // NAME
              if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                struct.name = iprot.readString();
                struct.setNameIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 2: // PAYLOAD
              if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                struct.payload = iprot.readBinary();
                struct.setPayloadIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 3: // PORT
              if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
                struct.port = iprot.readI32();
                struct.setPortIsSet(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, makeDiscoveryInstance_args struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.name != null) {
          oprot.writeFieldBegin(NAME_FIELD_DESC);
          oprot.writeString(struct.name);
          oprot.writeFieldEnd();
        }
        if (struct.payload != null) {
          oprot.writeFieldBegin(PAYLOAD_FIELD_DESC);
          oprot.writeBinary(struct.payload);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldBegin(PORT_FIELD_DESC);
        oprot.writeI32(struct.port);
        oprot.writeFieldEnd();
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class makeDiscoveryInstance_argsTupleSchemeFactory implements SchemeFactory {
      public makeDiscoveryInstance_argsTupleScheme getScheme() {
        return new makeDiscoveryInstance_argsTupleScheme();
      }
    }

    private static class makeDiscoveryInstance_argsTupleScheme extends TupleScheme<makeDiscoveryInstance_args> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, makeDiscoveryInstance_args struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetName()) {
          optionals.set(0);
        }
        if (struct.isSetPayload()) {
          optionals.set(1);
        }
        if (struct.isSetPort()) {
          optionals.set(2);
        }
        oprot.writeBitSet(optionals, 3);
        if (struct.isSetName()) {
          oprot.writeString(struct.name);
        }
        if (struct.isSetPayload()) {
          oprot.writeBinary(struct.payload);
        }
        if (struct.isSetPort()) {
          oprot.writeI32(struct.port);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, makeDiscoveryInstance_args struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(3);
        if (incoming.get(0)) {
          struct.name = iprot.readString();
          struct.setNameIsSet(true);
        }
        if (incoming.get(1)) {
          struct.payload = iprot.readBinary();
          struct.setPayloadIsSet(true);
        }
        if (incoming.get(2)) {
          struct.port = iprot.readI32();
          struct.setPortIsSet(true);
        }
      }
    }

  }

  public static class makeDiscoveryInstance_result implements org.apache.thrift.TBase<makeDiscoveryInstance_result, makeDiscoveryInstance_result._Fields>, java.io.Serializable, Cloneable, Comparable<makeDiscoveryInstance_result>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("makeDiscoveryInstance_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 EX1_FIELD_DESC = new org.apache.thrift.protocol.TField("ex1", 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 makeDiscoveryInstance_resultStandardSchemeFactory());
      schemes.put(TupleScheme.class, new makeDiscoveryInstance_resultTupleSchemeFactory());
    }

    public DiscoveryInstance success; // required
    public CuratorException ex1; // 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"),
      EX1((short)1, "ex1");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      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: // EX1
            return EX1;
          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, DiscoveryInstance.class)));
      tmpMap.put(_Fields.EX1, new org.apache.thrift.meta_data.FieldMetaData("ex1", 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(makeDiscoveryInstance_result.class, metaDataMap);
    }

    public makeDiscoveryInstance_result() {
    }

    public makeDiscoveryInstance_result(
      DiscoveryInstance success,
      CuratorException ex1)
    {
      this();
      this.success = success;
      this.ex1 = ex1;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public makeDiscoveryInstance_result(makeDiscoveryInstance_result other) {
      if (other.isSetSuccess()) {
        this.success = new DiscoveryInstance(other.success);
      }
      if (other.isSetEx1()) {
        this.ex1 = new CuratorException(other.ex1);
      }
    }

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

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

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

    public makeDiscoveryInstance_result setSuccess(DiscoveryInstance 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 CuratorException getEx1() {
      return this.ex1;
    }

    public makeDiscoveryInstance_result setEx1(CuratorException ex1) {
      this.ex1 = ex1;
      return this;
    }

    public void unsetEx1() {
      this.ex1 = null;
    }

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

    public void setEx1IsSet(boolean value) {
      if (!value) {
        this.ex1 = null;
      }
    }

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

      case EX1:
        if (value == null) {
          unsetEx1();
        } else {
          setEx1((CuratorException)value);
        }
        break;

      }
    }

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

      case EX1:
        return getEx1();

      }
      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 EX1:
        return isSetEx1();
      }
      throw new IllegalStateException();
    }

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

    public boolean equals(makeDiscoveryInstance_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_ex1 = true && this.isSetEx1();
      boolean that_present_ex1 = true && that.isSetEx1();
      if (this_present_ex1 || that_present_ex1) {
        if (!(this_present_ex1 && that_present_ex1))
          return false;
        if (!this.ex1.equals(that.ex1))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

    @Override
    public int compareTo(makeDiscoveryInstance_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(isSetEx1()).compareTo(other.isSetEx1());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetEx1()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ex1, other.ex1);
        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("makeDiscoveryInstance_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("ex1:");
      if (this.ex1 == null) {
        sb.append("null");
      } else {
        sb.append(this.ex1);
      }
      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 makeDiscoveryInstance_resultStandardSchemeFactory implements SchemeFactory {
      public makeDiscoveryInstance_resultStandardScheme getScheme() {
        return new makeDiscoveryInstance_resultStandardScheme();
      }
    }

    private static class makeDiscoveryInstance_resultStandardScheme extends StandardScheme<makeDiscoveryInstance_result> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, makeDiscoveryInstance_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 DiscoveryInstance();
                struct.success.read(iprot);
                struct.setSuccessIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 1: // EX1
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.ex1 = new CuratorException();
                struct.ex1.read(iprot);
                struct.setEx1IsSet(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, makeDiscoveryInstance_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.ex1 != null) {
          oprot.writeFieldBegin(EX1_FIELD_DESC);
          struct.ex1.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class makeDiscoveryInstance_resultTupleSchemeFactory implements SchemeFactory {
      public makeDiscoveryInstance_resultTupleScheme getScheme() {
        return new makeDiscoveryInstance_resultTupleScheme();
      }
    }

    private static class makeDiscoveryInstance_resultTupleScheme extends TupleScheme<makeDiscoveryInstance_result> {

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

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, makeDiscoveryInstance_result struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(2);
        if (incoming.get(0)) {
          struct.success = new DiscoveryInstance();
          struct.success.read(iprot);
          struct.setSuccessIsSet(true);
        }
        if (incoming.get(1)) {
          struct.ex1 = new CuratorException();
          struct.ex1.read(iprot);
          struct.setEx1IsSet(true);
        }
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("projection", org.apache.thrift.protocol.TType.STRUCT, (short)1);
    private static final org.apache.thrift.protocol.TField PROVIDER_PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("providerProjection", org.apache.thrift.protocol.TType.STRUCT, (short)2);
    private static final org.apache.thrift.protocol.TField INSTANCE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("instanceId", org.apache.thrift.protocol.TType.STRING, (short)3);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new noteError_argsStandardSchemeFactory());
      schemes.put(TupleScheme.class, new noteError_argsTupleSchemeFactory());
    }

    public CuratorProjection projection; // required
    public DiscoveryProviderProjection providerProjection; // required
    public String instanceId; // 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 {
      PROJECTION((short)1, "projection"),
      PROVIDER_PROJECTION((short)2, "providerProjection"),
      INSTANCE_ID((short)3, "instanceId");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      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: // PROJECTION
            return PROJECTION;
          case 2: // PROVIDER_PROJECTION
            return PROVIDER_PROJECTION;
          case 3: // INSTANCE_ID
            return INSTANCE_ID;
          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.PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("projection", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CuratorProjection.class)));
      tmpMap.put(_Fields.PROVIDER_PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("providerProjection", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, DiscoveryProviderProjection.class)));
      tmpMap.put(_Fields.INSTANCE_ID, new org.apache.thrift.meta_data.FieldMetaData("instanceId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(noteError_args.class, metaDataMap);
    }

    public noteError_args() {
    }

    public noteError_args(
      CuratorProjection projection,
      DiscoveryProviderProjection providerProjection,
      String instanceId)
    {
      this();
      this.projection = projection;
      this.providerProjection = providerProjection;
      this.instanceId = instanceId;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public noteError_args(noteError_args other) {
      if (other.isSetProjection()) {
        this.projection = new CuratorProjection(other.projection);
      }
      if (other.isSetProviderProjection()) {
        this.providerProjection = new DiscoveryProviderProjection(other.providerProjection);
      }
      if (other.isSetInstanceId()) {
        this.instanceId = other.instanceId;
      }
    }

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

    @Override
    public void clear() {
      this.projection = null;
      this.providerProjection = null;
      this.instanceId = null;
    }

    public CuratorProjection getProjection() {
      return this.projection;
    }

    public noteError_args setProjection(CuratorProjection projection) {
      this.projection = projection;
      return this;
    }

    public void unsetProjection() {
      this.projection = null;
    }

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

    public void setProjectionIsSet(boolean value) {
      if (!value) {
        this.projection = null;
      }
    }

    public DiscoveryProviderProjection getProviderProjection() {
      return this.providerProjection;
    }

    public noteError_args setProviderProjection(DiscoveryProviderProjection providerProjection) {
      this.providerProjection = providerProjection;
      return this;
    }

    public void unsetProviderProjection() {
      this.providerProjection = null;
    }

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

    public void setProviderProjectionIsSet(boolean value) {
      if (!value) {
        this.providerProjection = null;
      }
    }

    public String getInstanceId() {
      return this.instanceId;
    }

    public noteError_args setInstanceId(String instanceId) {
      this.instanceId = instanceId;
      return this;
    }

    public void unsetInstanceId() {
      this.instanceId = null;
    }

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

    public void setInstanceIdIsSet(boolean value) {
      if (!value) {
        this.instanceId = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case PROJECTION:
        if (value == null) {
          unsetProjection();
        } else {
          setProjection((CuratorProjection)value);
        }
        break;

      case PROVIDER_PROJECTION:
        if (value == null) {
          unsetProviderProjection();
        } else {
          setProviderProjection((DiscoveryProviderProjection)value);
        }
        break;

      case INSTANCE_ID:
        if (value == null) {
          unsetInstanceId();
        } else {
          setInstanceId((String)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case PROJECTION:
        return getProjection();

      case PROVIDER_PROJECTION:
        return getProviderProjection();

      case INSTANCE_ID:
        return getInstanceId();

      }
      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 PROJECTION:
        return isSetProjection();
      case PROVIDER_PROJECTION:
        return isSetProviderProjection();
      case INSTANCE_ID:
        return isSetInstanceId();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_projection = true && this.isSetProjection();
      boolean that_present_projection = true && that.isSetProjection();
      if (this_present_projection || that_present_projection) {
        if (!(this_present_projection && that_present_projection))
          return false;
        if (!this.projection.equals(that.projection))
          return false;
      }

      boolean this_present_providerProjection = true && this.isSetProviderProjection();
      boolean that_present_providerProjection = true && that.isSetProviderProjection();
      if (this_present_providerProjection || that_present_providerProjection) {
        if (!(this_present_providerProjection && that_present_providerProjection))
          return false;
        if (!this.providerProjection.equals(that.providerProjection))
          return false;
      }

      boolean this_present_instanceId = true && this.isSetInstanceId();
      boolean that_present_instanceId = true && that.isSetInstanceId();
      if (this_present_instanceId || that_present_instanceId) {
        if (!(this_present_instanceId && that_present_instanceId))
          return false;
        if (!this.instanceId.equals(that.instanceId))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

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

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetProjection()).compareTo(other.isSetProjection());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetProjection()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.projection, other.projection);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetProviderProjection()).compareTo(other.isSetProviderProjection());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetProviderProjection()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.providerProjection, other.providerProjection);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetInstanceId()).compareTo(other.isSetInstanceId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetInstanceId()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.instanceId, other.instanceId);
        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("noteError_args(");
      boolean first = true;

      sb.append("projection:");
      if (this.projection == null) {
        sb.append("null");
      } else {
        sb.append(this.projection);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("providerProjection:");
      if (this.providerProjection == null) {
        sb.append("null");
      } else {
        sb.append(this.providerProjection);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("instanceId:");
      if (this.instanceId == null) {
        sb.append("null");
      } else {
        sb.append(this.instanceId);
      }
      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 (projection != null) {
        projection.validate();
      }
      if (providerProjection != null) {
        providerProjection.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 noteError_argsStandardSchemeFactory implements SchemeFactory {
      public noteError_argsStandardScheme getScheme() {
        return new noteError_argsStandardScheme();
      }
    }

    private static class noteError_argsStandardScheme extends StandardScheme<noteError_args> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, noteError_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: // PROJECTION
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.projection = new CuratorProjection();
                struct.projection.read(iprot);
                struct.setProjectionIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 2: // PROVIDER_PROJECTION
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.providerProjection = new DiscoveryProviderProjection();
                struct.providerProjection.read(iprot);
                struct.setProviderProjectionIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 3: // INSTANCE_ID
              if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                struct.instanceId = iprot.readString();
                struct.setInstanceIdIsSet(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, noteError_args struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.projection != null) {
          oprot.writeFieldBegin(PROJECTION_FIELD_DESC);
          struct.projection.write(oprot);
          oprot.writeFieldEnd();
        }
        if (struct.providerProjection != null) {
          oprot.writeFieldBegin(PROVIDER_PROJECTION_FIELD_DESC);
          struct.providerProjection.write(oprot);
          oprot.writeFieldEnd();
        }
        if (struct.instanceId != null) {
          oprot.writeFieldBegin(INSTANCE_ID_FIELD_DESC);
          oprot.writeString(struct.instanceId);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class noteError_argsTupleSchemeFactory implements SchemeFactory {
      public noteError_argsTupleScheme getScheme() {
        return new noteError_argsTupleScheme();
      }
    }

    private static class noteError_argsTupleScheme extends TupleScheme<noteError_args> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, noteError_args struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetProjection()) {
          optionals.set(0);
        }
        if (struct.isSetProviderProjection()) {
          optionals.set(1);
        }
        if (struct.isSetInstanceId()) {
          optionals.set(2);
        }
        oprot.writeBitSet(optionals, 3);
        if (struct.isSetProjection()) {
          struct.projection.write(oprot);
        }
        if (struct.isSetProviderProjection()) {
          struct.providerProjection.write(oprot);
        }
        if (struct.isSetInstanceId()) {
          oprot.writeString(struct.instanceId);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, noteError_args struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(3);
        if (incoming.get(0)) {
          struct.projection = new CuratorProjection();
          struct.projection.read(iprot);
          struct.setProjectionIsSet(true);
        }
        if (incoming.get(1)) {
          struct.providerProjection = new DiscoveryProviderProjection();
          struct.providerProjection.read(iprot);
          struct.setProviderProjectionIsSet(true);
        }
        if (incoming.get(2)) {
          struct.instanceId = iprot.readString();
          struct.setInstanceIdIsSet(true);
        }
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField EX1_FIELD_DESC = new org.apache.thrift.protocol.TField("ex1", 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 noteError_resultStandardSchemeFactory());
      schemes.put(TupleScheme.class, new noteError_resultTupleSchemeFactory());
    }

    public CuratorException ex1; // 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 {
      EX1((short)1, "ex1");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      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: // EX1
            return EX1;
          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.EX1, new org.apache.thrift.meta_data.FieldMetaData("ex1", 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(noteError_result.class, metaDataMap);
    }

    public noteError_result() {
    }

    public noteError_result(
      CuratorException ex1)
    {
      this();
      this.ex1 = ex1;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public noteError_result(noteError_result other) {
      if (other.isSetEx1()) {
        this.ex1 = new CuratorException(other.ex1);
      }
    }

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

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

    public CuratorException getEx1() {
      return this.ex1;
    }

    public noteError_result setEx1(CuratorException ex1) {
      this.ex1 = ex1;
      return this;
    }

    public void unsetEx1() {
      this.ex1 = null;
    }

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

    public void setEx1IsSet(boolean value) {
      if (!value) {
        this.ex1 = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case EX1:
        if (value == null) {
          unsetEx1();
        } else {
          setEx1((CuratorException)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case EX1:
        return getEx1();

      }
      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 EX1:
        return isSetEx1();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_ex1 = true && this.isSetEx1();
      boolean that_present_ex1 = true && that.isSetEx1();
      if (this_present_ex1 || that_present_ex1) {
        if (!(this_present_ex1 && that_present_ex1))
          return false;
        if (!this.ex1.equals(that.ex1))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

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

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetEx1()).compareTo(other.isSetEx1());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetEx1()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ex1, other.ex1);
        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("noteError_result(");
      boolean first = true;

      sb.append("ex1:");
      if (this.ex1 == null) {
        sb.append("null");
      } else {
        sb.append(this.ex1);
      }
      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 noteError_resultStandardSchemeFactory implements SchemeFactory {
      public noteError_resultStandardScheme getScheme() {
        return new noteError_resultStandardScheme();
      }
    }

    private static class noteError_resultStandardScheme extends StandardScheme<noteError_result> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, noteError_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 1: // EX1
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.ex1 = new CuratorException();
                struct.ex1.read(iprot);
                struct.setEx1IsSet(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, noteError_result struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.ex1 != null) {
          oprot.writeFieldBegin(EX1_FIELD_DESC);
          struct.ex1.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class noteError_resultTupleSchemeFactory implements SchemeFactory {
      public noteError_resultTupleScheme getScheme() {
        return new noteError_resultTupleScheme();
      }
    }

    private static class noteError_resultTupleScheme extends TupleScheme<noteError_result> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, noteError_result struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetEx1()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetEx1()) {
          struct.ex1.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, noteError_result struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          struct.ex1 = new CuratorException();
          struct.ex1.read(iprot);
          struct.setEx1IsSet(true);
        }
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("projection", org.apache.thrift.protocol.TType.STRUCT, (short)1);
    private static final org.apache.thrift.protocol.TField BASE_PATH_FIELD_DESC = new org.apache.thrift.protocol.TField("basePath", org.apache.thrift.protocol.TType.STRING, (short)2);
    private static final org.apache.thrift.protocol.TField YOUR_INSTANCE_FIELD_DESC = new org.apache.thrift.protocol.TField("yourInstance", org.apache.thrift.protocol.TType.STRUCT, (short)3);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new startDiscovery_argsStandardSchemeFactory());
      schemes.put(TupleScheme.class, new startDiscovery_argsTupleSchemeFactory());
    }

    public CuratorProjection projection; // required
    public String basePath; // required
    public DiscoveryInstance yourInstance; // 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 {
      PROJECTION((short)1, "projection"),
      BASE_PATH((short)2, "basePath"),
      YOUR_INSTANCE((short)3, "yourInstance");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      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: // PROJECTION
            return PROJECTION;
          case 2: // BASE_PATH
            return BASE_PATH;
          case 3: // YOUR_INSTANCE
            return YOUR_INSTANCE;
          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.PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("projection", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CuratorProjection.class)));
      tmpMap.put(_Fields.BASE_PATH, new org.apache.thrift.meta_data.FieldMetaData("basePath", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      tmpMap.put(_Fields.YOUR_INSTANCE, new org.apache.thrift.meta_data.FieldMetaData("yourInstance", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, DiscoveryInstance.class)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(startDiscovery_args.class, metaDataMap);
    }

    public startDiscovery_args() {
    }

    public startDiscovery_args(
      CuratorProjection projection,
      String basePath,
      DiscoveryInstance yourInstance)
    {
      this();
      this.projection = projection;
      this.basePath = basePath;
      this.yourInstance = yourInstance;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public startDiscovery_args(startDiscovery_args other) {
      if (other.isSetProjection()) {
        this.projection = new CuratorProjection(other.projection);
      }
      if (other.isSetBasePath()) {
        this.basePath = other.basePath;
      }
      if (other.isSetYourInstance()) {
        this.yourInstance = new DiscoveryInstance(other.yourInstance);
      }
    }

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

    @Override
    public void clear() {
      this.projection = null;
      this.basePath = null;
      this.yourInstance = null;
    }

    public CuratorProjection getProjection() {
      return this.projection;
    }

    public startDiscovery_args setProjection(CuratorProjection projection) {
      this.projection = projection;
      return this;
    }

    public void unsetProjection() {
      this.projection = null;
    }

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

    public void setProjectionIsSet(boolean value) {
      if (!value) {
        this.projection = null;
      }
    }

    public String getBasePath() {
      return this.basePath;
    }

    public startDiscovery_args setBasePath(String basePath) {
      this.basePath = basePath;
      return this;
    }

    public void unsetBasePath() {
      this.basePath = null;
    }

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

    public void setBasePathIsSet(boolean value) {
      if (!value) {
        this.basePath = null;
      }
    }

    public DiscoveryInstance getYourInstance() {
      return this.yourInstance;
    }

    public startDiscovery_args setYourInstance(DiscoveryInstance yourInstance) {
      this.yourInstance = yourInstance;
      return this;
    }

    public void unsetYourInstance() {
      this.yourInstance = null;
    }

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

    public void setYourInstanceIsSet(boolean value) {
      if (!value) {
        this.yourInstance = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case PROJECTION:
        if (value == null) {
          unsetProjection();
        } else {
          setProjection((CuratorProjection)value);
        }
        break;

      case BASE_PATH:
        if (value == null) {
          unsetBasePath();
        } else {
          setBasePath((String)value);
        }
        break;

      case YOUR_INSTANCE:
        if (value == null) {
          unsetYourInstance();
        } else {
          setYourInstance((DiscoveryInstance)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case PROJECTION:
        return getProjection();

      case BASE_PATH:
        return getBasePath();

      case YOUR_INSTANCE:
        return getYourInstance();

      }
      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 PROJECTION:
        return isSetProjection();
      case BASE_PATH:
        return isSetBasePath();
      case YOUR_INSTANCE:
        return isSetYourInstance();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_projection = true && this.isSetProjection();
      boolean that_present_projection = true && that.isSetProjection();
      if (this_present_projection || that_present_projection) {
        if (!(this_present_projection && that_present_projection))
          return false;
        if (!this.projection.equals(that.projection))
          return false;
      }

      boolean this_present_basePath = true && this.isSetBasePath();
      boolean that_present_basePath = true && that.isSetBasePath();
      if (this_present_basePath || that_present_basePath) {
        if (!(this_present_basePath && that_present_basePath))
          return false;
        if (!this.basePath.equals(that.basePath))
          return false;
      }

      boolean this_present_yourInstance = true && this.isSetYourInstance();
      boolean that_present_yourInstance = true && that.isSetYourInstance();
      if (this_present_yourInstance || that_present_yourInstance) {
        if (!(this_present_yourInstance && that_present_yourInstance))
          return false;
        if (!this.yourInstance.equals(that.yourInstance))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

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

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetProjection()).compareTo(other.isSetProjection());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetProjection()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.projection, other.projection);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetBasePath()).compareTo(other.isSetBasePath());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetBasePath()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.basePath, other.basePath);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetYourInstance()).compareTo(other.isSetYourInstance());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetYourInstance()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.yourInstance, other.yourInstance);
        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("startDiscovery_args(");
      boolean first = true;

      sb.append("projection:");
      if (this.projection == null) {
        sb.append("null");
      } else {
        sb.append(this.projection);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("basePath:");
      if (this.basePath == null) {
        sb.append("null");
      } else {
        sb.append(this.basePath);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("yourInstance:");
      if (this.yourInstance == null) {
        sb.append("null");
      } else {
        sb.append(this.yourInstance);
      }
      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 (projection != null) {
        projection.validate();
      }
      if (yourInstance != null) {
        yourInstance.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 startDiscovery_argsStandardSchemeFactory implements SchemeFactory {
      public startDiscovery_argsStandardScheme getScheme() {
        return new startDiscovery_argsStandardScheme();
      }
    }

    private static class startDiscovery_argsStandardScheme extends StandardScheme<startDiscovery_args> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, startDiscovery_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: // PROJECTION
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.projection = new CuratorProjection();
                struct.projection.read(iprot);
                struct.setProjectionIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 2: // BASE_PATH
              if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                struct.basePath = iprot.readString();
                struct.setBasePathIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 3: // YOUR_INSTANCE
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.yourInstance = new DiscoveryInstance();
                struct.yourInstance.read(iprot);
                struct.setYourInstanceIsSet(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, startDiscovery_args struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.projection != null) {
          oprot.writeFieldBegin(PROJECTION_FIELD_DESC);
          struct.projection.write(oprot);
          oprot.writeFieldEnd();
        }
        if (struct.basePath != null) {
          oprot.writeFieldBegin(BASE_PATH_FIELD_DESC);
          oprot.writeString(struct.basePath);
          oprot.writeFieldEnd();
        }
        if (struct.yourInstance != null) {
          oprot.writeFieldBegin(YOUR_INSTANCE_FIELD_DESC);
          struct.yourInstance.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class startDiscovery_argsTupleSchemeFactory implements SchemeFactory {
      public startDiscovery_argsTupleScheme getScheme() {
        return new startDiscovery_argsTupleScheme();
      }
    }

    private static class startDiscovery_argsTupleScheme extends TupleScheme<startDiscovery_args> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, startDiscovery_args struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetProjection()) {
          optionals.set(0);
        }
        if (struct.isSetBasePath()) {
          optionals.set(1);
        }
        if (struct.isSetYourInstance()) {
          optionals.set(2);
        }
        oprot.writeBitSet(optionals, 3);
        if (struct.isSetProjection()) {
          struct.projection.write(oprot);
        }
        if (struct.isSetBasePath()) {
          oprot.writeString(struct.basePath);
        }
        if (struct.isSetYourInstance()) {
          struct.yourInstance.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, startDiscovery_args struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(3);
        if (incoming.get(0)) {
          struct.projection = new CuratorProjection();
          struct.projection.read(iprot);
          struct.setProjectionIsSet(true);
        }
        if (incoming.get(1)) {
          struct.basePath = iprot.readString();
          struct.setBasePathIsSet(true);
        }
        if (incoming.get(2)) {
          struct.yourInstance = new DiscoveryInstance();
          struct.yourInstance.read(iprot);
          struct.setYourInstanceIsSet(true);
        }
      }
    }

  }

  public static class startDiscovery_result implements org.apache.thrift.TBase<startDiscovery_result, startDiscovery_result._Fields>, java.io.Serializable, Cloneable, Comparable<startDiscovery_result>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("startDiscovery_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 EX1_FIELD_DESC = new org.apache.thrift.protocol.TField("ex1", 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 startDiscovery_resultStandardSchemeFactory());
      schemes.put(TupleScheme.class, new startDiscovery_resultTupleSchemeFactory());
    }

    public DiscoveryProjection success; // required
    public CuratorException ex1; // 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"),
      EX1((short)1, "ex1");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      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: // EX1
            return EX1;
          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, DiscoveryProjection.class)));
      tmpMap.put(_Fields.EX1, new org.apache.thrift.meta_data.FieldMetaData("ex1", 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(startDiscovery_result.class, metaDataMap);
    }

    public startDiscovery_result() {
    }

    public startDiscovery_result(
      DiscoveryProjection success,
      CuratorException ex1)
    {
      this();
      this.success = success;
      this.ex1 = ex1;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public startDiscovery_result(startDiscovery_result other) {
      if (other.isSetSuccess()) {
        this.success = new DiscoveryProjection(other.success);
      }
      if (other.isSetEx1()) {
        this.ex1 = new CuratorException(other.ex1);
      }
    }

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

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

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

    public startDiscovery_result setSuccess(DiscoveryProjection 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 CuratorException getEx1() {
      return this.ex1;
    }

    public startDiscovery_result setEx1(CuratorException ex1) {
      this.ex1 = ex1;
      return this;
    }

    public void unsetEx1() {
      this.ex1 = null;
    }

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

    public void setEx1IsSet(boolean value) {
      if (!value) {
        this.ex1 = null;
      }
    }

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

      case EX1:
        if (value == null) {
          unsetEx1();
        } else {
          setEx1((CuratorException)value);
        }
        break;

      }
    }

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

      case EX1:
        return getEx1();

      }
      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 EX1:
        return isSetEx1();
      }
      throw new IllegalStateException();
    }

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

    public boolean equals(startDiscovery_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_ex1 = true && this.isSetEx1();
      boolean that_present_ex1 = true && that.isSetEx1();
      if (this_present_ex1 || that_present_ex1) {
        if (!(this_present_ex1 && that_present_ex1))
          return false;
        if (!this.ex1.equals(that.ex1))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

    @Override
    public int compareTo(startDiscovery_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(isSetEx1()).compareTo(other.isSetEx1());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetEx1()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ex1, other.ex1);
        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("startDiscovery_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("ex1:");
      if (this.ex1 == null) {
        sb.append("null");
      } else {
        sb.append(this.ex1);
      }
      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 startDiscovery_resultStandardSchemeFactory implements SchemeFactory {
      public startDiscovery_resultStandardScheme getScheme() {
        return new startDiscovery_resultStandardScheme();
      }
    }

    private static class startDiscovery_resultStandardScheme extends StandardScheme<startDiscovery_result> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, startDiscovery_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 DiscoveryProjection();
                struct.success.read(iprot);
                struct.setSuccessIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 1: // EX1
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.ex1 = new CuratorException();
                struct.ex1.read(iprot);
                struct.setEx1IsSet(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, startDiscovery_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.ex1 != null) {
          oprot.writeFieldBegin(EX1_FIELD_DESC);
          struct.ex1.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class startDiscovery_resultTupleSchemeFactory implements SchemeFactory {
      public startDiscovery_resultTupleScheme getScheme() {
        return new startDiscovery_resultTupleScheme();
      }
    }

    private static class startDiscovery_resultTupleScheme extends TupleScheme<startDiscovery_result> {

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

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, startDiscovery_result struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(2);
        if (incoming.get(0)) {
          struct.success = new DiscoveryProjection();
          struct.success.read(iprot);
          struct.setSuccessIsSet(true);
        }
        if (incoming.get(1)) {
          struct.ex1 = new CuratorException();
          struct.ex1.read(iprot);
          struct.setEx1IsSet(true);
        }
      }
    }

  }

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

    private static final org.apache.thrift.protocol.TField PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("projection", org.apache.thrift.protocol.TType.STRUCT, (short)1);
    private static final org.apache.thrift.protocol.TField DISCOVERY_PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("discoveryProjection", org.apache.thrift.protocol.TType.STRUCT, (short)2);
    private static final org.apache.thrift.protocol.TField SERVICE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("serviceName", org.apache.thrift.protocol.TType.STRING, (short)3);
    private static final org.apache.thrift.protocol.TField PROVIDER_STRATEGY_FIELD_DESC = new org.apache.thrift.protocol.TField("providerStrategy", org.apache.thrift.protocol.TType.I32, (short)4);
    private static final org.apache.thrift.protocol.TField DOWN_TIMEOUT_MS_FIELD_DESC = new org.apache.thrift.protocol.TField("downTimeoutMs", org.apache.thrift.protocol.TType.I32, (short)5);
    private static final org.apache.thrift.protocol.TField DOWN_ERROR_THRESHOLD_FIELD_DESC = new org.apache.thrift.protocol.TField("downErrorThreshold", org.apache.thrift.protocol.TType.I32, (short)6);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new startProvider_argsStandardSchemeFactory());
      schemes.put(TupleScheme.class, new startProvider_argsTupleSchemeFactory());
    }

    public CuratorProjection projection; // required
    public DiscoveryProjection discoveryProjection; // required
    public String serviceName; // required
    /**
     * 
     * @see ProviderStrategyType
     */
    public ProviderStrategyType providerStrategy; // required
    public int downTimeoutMs; // required
    public int downErrorThreshold; // 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 {
      PROJECTION((short)1, "projection"),
      DISCOVERY_PROJECTION((short)2, "discoveryProjection"),
      SERVICE_NAME((short)3, "serviceName"),
      /**
       * 
       * @see ProviderStrategyType
       */
      PROVIDER_STRATEGY((short)4, "providerStrategy"),
      DOWN_TIMEOUT_MS((short)5, "downTimeoutMs"),
      DOWN_ERROR_THRESHOLD((short)6, "downErrorThreshold");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      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: // PROJECTION
            return PROJECTION;
          case 2: // DISCOVERY_PROJECTION
            return DISCOVERY_PROJECTION;
          case 3: // SERVICE_NAME
            return SERVICE_NAME;
          case 4: // PROVIDER_STRATEGY
            return PROVIDER_STRATEGY;
          case 5: // DOWN_TIMEOUT_MS
            return DOWN_TIMEOUT_MS;
          case 6: // DOWN_ERROR_THRESHOLD
            return DOWN_ERROR_THRESHOLD;
          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
    private static final int __DOWNTIMEOUTMS_ISSET_ID = 0;
    private static final int __DOWNERRORTHRESHOLD_ISSET_ID = 1;
    private byte __isset_bitfield = 0;
    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    static {
      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
      tmpMap.put(_Fields.PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("projection", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CuratorProjection.class)));
      tmpMap.put(_Fields.DISCOVERY_PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("discoveryProjection", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, DiscoveryProjection.class)));
      tmpMap.put(_Fields.SERVICE_NAME, new org.apache.thrift.meta_data.FieldMetaData("serviceName", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      tmpMap.put(_Fields.PROVIDER_STRATEGY, new org.apache.thrift.meta_data.FieldMetaData("providerStrategy", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, ProviderStrategyType.class)));
      tmpMap.put(_Fields.DOWN_TIMEOUT_MS, new org.apache.thrift.meta_data.FieldMetaData("downTimeoutMs", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
      tmpMap.put(_Fields.DOWN_ERROR_THRESHOLD, new org.apache.thrift.meta_data.FieldMetaData("downErrorThreshold", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(startProvider_args.class, metaDataMap);
    }

    public startProvider_args() {
    }

    public startProvider_args(
      CuratorProjection projection,
      DiscoveryProjection discoveryProjection,
      String serviceName,
      ProviderStrategyType providerStrategy,
      int downTimeoutMs,
      int downErrorThreshold)
    {
      this();
      this.projection = projection;
      this.discoveryProjection = discoveryProjection;
      this.serviceName = serviceName;
      this.providerStrategy = providerStrategy;
      this.downTimeoutMs = downTimeoutMs;
      setDownTimeoutMsIsSet(true);
      this.downErrorThreshold = downErrorThreshold;
      setDownErrorThresholdIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public startProvider_args(startProvider_args other) {
      __isset_bitfield = other.__isset_bitfield;
      if (other.isSetProjection()) {
        this.projection = new CuratorProjection(other.projection);
      }
      if (other.isSetDiscoveryProjection()) {
        this.discoveryProjection = new DiscoveryProjection(other.discoveryProjection);
      }
      if (other.isSetServiceName()) {
        this.serviceName = other.serviceName;
      }
      if (other.isSetProviderStrategy()) {
        this.providerStrategy = other.providerStrategy;
      }
      this.downTimeoutMs = other.downTimeoutMs;
      this.downErrorThreshold = other.downErrorThreshold;
    }

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

    @Override
    public void clear() {
      this.projection = null;
      this.discoveryProjection = null;
      this.serviceName = null;
      this.providerStrategy = null;
      setDownTimeoutMsIsSet(false);
      this.downTimeoutMs = 0;
      setDownErrorThresholdIsSet(false);
      this.downErrorThreshold = 0;
    }

    public CuratorProjection getProjection() {
      return this.projection;
    }

    public startProvider_args setProjection(CuratorProjection projection) {
      this.projection = projection;
      return this;
    }

    public void unsetProjection() {
      this.projection = null;
    }

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

    public void setProjectionIsSet(boolean value) {
      if (!value) {
        this.projection = null;
      }
    }

    public DiscoveryProjection getDiscoveryProjection() {
      return this.discoveryProjection;
    }

    public startProvider_args setDiscoveryProjection(DiscoveryProjection discoveryProjection) {
      this.discoveryProjection = discoveryProjection;
      return this;
    }

    public void unsetDiscoveryProjection() {
      this.discoveryProjection = null;
    }

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

    public void setDiscoveryProjectionIsSet(boolean value) {
      if (!value) {
        this.discoveryProjection = null;
      }
    }

    public String getServiceName() {
      return this.serviceName;
    }

    public startProvider_args setServiceName(String serviceName) {
      this.serviceName = serviceName;
      return this;
    }

    public void unsetServiceName() {
      this.serviceName = null;
    }

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

    public void setServiceNameIsSet(boolean value) {
      if (!value) {
        this.serviceName = null;
      }
    }

    /**
     * 
     * @see ProviderStrategyType
     */
    public ProviderStrategyType getProviderStrategy() {
      return this.providerStrategy;
    }

    /**
     * 
     * @see ProviderStrategyType
     */
    public startProvider_args setProviderStrategy(ProviderStrategyType providerStrategy) {
      this.providerStrategy = providerStrategy;
      return this;
    }

    public void unsetProviderStrategy() {
      this.providerStrategy = null;
    }

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

    public void setProviderStrategyIsSet(boolean value) {
      if (!value) {
        this.providerStrategy = null;
      }
    }

    public int getDownTimeoutMs() {
      return this.downTimeoutMs;
    }

    public startProvider_args setDownTimeoutMs(int downTimeoutMs) {
      this.downTimeoutMs = downTimeoutMs;
      setDownTimeoutMsIsSet(true);
      return this;
    }

    public void unsetDownTimeoutMs() {
      __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DOWNTIMEOUTMS_ISSET_ID);
    }

    /** Returns true if field downTimeoutMs is set (has been assigned a value) and false otherwise */
    public boolean isSetDownTimeoutMs() {
      return EncodingUtils.testBit(__isset_bitfield, __DOWNTIMEOUTMS_ISSET_ID);
    }

    public void setDownTimeoutMsIsSet(boolean value) {
      __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DOWNTIMEOUTMS_ISSET_ID, value);
    }

    public int getDownErrorThreshold() {
      return this.downErrorThreshold;
    }

    public startProvider_args setDownErrorThreshold(int downErrorThreshold) {
      this.downErrorThreshold = downErrorThreshold;
      setDownErrorThresholdIsSet(true);
      return this;
    }

    public void unsetDownErrorThreshold() {
      __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DOWNERRORTHRESHOLD_ISSET_ID);
    }

    /** Returns true if field downErrorThreshold is set (has been assigned a value) and false otherwise */
    public boolean isSetDownErrorThreshold() {
      return EncodingUtils.testBit(__isset_bitfield, __DOWNERRORTHRESHOLD_ISSET_ID);
    }

    public void setDownErrorThresholdIsSet(boolean value) {
      __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DOWNERRORTHRESHOLD_ISSET_ID, value);
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case PROJECTION:
        if (value == null) {
          unsetProjection();
        } else {
          setProjection((CuratorProjection)value);
        }
        break;

      case DISCOVERY_PROJECTION:
        if (value == null) {
          unsetDiscoveryProjection();
        } else {
          setDiscoveryProjection((DiscoveryProjection)value);
        }
        break;

      case SERVICE_NAME:
        if (value == null) {
          unsetServiceName();
        } else {
          setServiceName((String)value);
        }
        break;

      case PROVIDER_STRATEGY:
        if (value == null) {
          unsetProviderStrategy();
        } else {
          setProviderStrategy((ProviderStrategyType)value);
        }
        break;

      case DOWN_TIMEOUT_MS:
        if (value == null) {
          unsetDownTimeoutMs();
        } else {
          setDownTimeoutMs((Integer)value);
        }
        break;

      case DOWN_ERROR_THRESHOLD:
        if (value == null) {
          unsetDownErrorThreshold();
        } else {
          setDownErrorThreshold((Integer)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case PROJECTION:
        return getProjection();

      case DISCOVERY_PROJECTION:
        return getDiscoveryProjection();

      case SERVICE_NAME:
        return getServiceName();

      case PROVIDER_STRATEGY:
        return getProviderStrategy();

      case DOWN_TIMEOUT_MS:
        return Integer.valueOf(getDownTimeoutMs());

      case DOWN_ERROR_THRESHOLD:
        return Integer.valueOf(getDownErrorThreshold());

      }
      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 PROJECTION:
        return isSetProjection();
      case DISCOVERY_PROJECTION:
        return isSetDiscoveryProjection();
      case SERVICE_NAME:
        return isSetServiceName();
      case PROVIDER_STRATEGY:
        return isSetProviderStrategy();
      case DOWN_TIMEOUT_MS:
        return isSetDownTimeoutMs();
      case DOWN_ERROR_THRESHOLD:
        return isSetDownErrorThreshold();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_projection = true && this.isSetProjection();
      boolean that_present_projection = true && that.isSetProjection();
      if (this_present_projection || that_present_projection) {
        if (!(this_present_projection && that_present_projection))
          return false;
        if (!this.projection.equals(that.projection))
          return false;
      }

      boolean this_present_discoveryProjection = true && this.isSetDiscoveryProjection();
      boolean that_present_discoveryProjection = true && that.isSetDiscoveryProjection();
      if (this_present_discoveryProjection || that_present_discoveryProjection) {
        if (!(this_present_discoveryProjection && that_present_discoveryProjection))
          return false;
        if (!this.discoveryProjection.equals(that.discoveryProjection))
          return false;
      }

      boolean this_present_serviceName = true && this.isSetServiceName();
      boolean that_present_serviceName = true && that.isSetServiceName();
      if (this_present_serviceName || that_present_serviceName) {
        if (!(this_present_serviceName && that_present_serviceName))
          return false;
        if (!this.serviceName.equals(that.serviceName))
          return false;
      }

      boolean this_present_providerStrategy = true && this.isSetProviderStrategy();
      boolean that_present_providerStrategy = true && that.isSetProviderStrategy();
      if (this_present_providerStrategy || that_present_providerStrategy) {
        if (!(this_present_providerStrategy && that_present_providerStrategy))
          return false;
        if (!this.providerStrategy.equals(that.providerStrategy))
          return false;
      }

      boolean this_present_downTimeoutMs = true;
      boolean that_present_downTimeoutMs = true;
      if (this_present_downTimeoutMs || that_present_downTimeoutMs) {
        if (!(this_present_downTimeoutMs && that_present_downTimeoutMs))
          return false;
        if (this.downTimeoutMs != that.downTimeoutMs)
          return false;
      }

      boolean this_present_downErrorThreshold = true;
      boolean that_present_downErrorThreshold = true;
      if (this_present_downErrorThreshold || that_present_downErrorThreshold) {
        if (!(this_present_downErrorThreshold && that_present_downErrorThreshold))
          return false;
        if (this.downErrorThreshold != that.downErrorThreshold)
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

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

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetProjection()).compareTo(other.isSetProjection());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetProjection()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.projection, other.projection);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetDiscoveryProjection()).compareTo(other.isSetDiscoveryProjection());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetDiscoveryProjection()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.discoveryProjection, other.discoveryProjection);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetServiceName()).compareTo(other.isSetServiceName());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetServiceName()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.serviceName, other.serviceName);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetProviderStrategy()).compareTo(other.isSetProviderStrategy());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetProviderStrategy()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.providerStrategy, other.providerStrategy);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetDownTimeoutMs()).compareTo(other.isSetDownTimeoutMs());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetDownTimeoutMs()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.downTimeoutMs, other.downTimeoutMs);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetDownErrorThreshold()).compareTo(other.isSetDownErrorThreshold());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetDownErrorThreshold()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.downErrorThreshold, other.downErrorThreshold);
        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("startProvider_args(");
      boolean first = true;

      sb.append("projection:");
      if (this.projection == null) {
        sb.append("null");
      } else {
        sb.append(this.projection);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("discoveryProjection:");
      if (this.discoveryProjection == null) {
        sb.append("null");
      } else {
        sb.append(this.discoveryProjection);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("serviceName:");
      if (this.serviceName == null) {
        sb.append("null");
      } else {
        sb.append(this.serviceName);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("providerStrategy:");
      if (this.providerStrategy == null) {
        sb.append("null");
      } else {
        sb.append(this.providerStrategy);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("downTimeoutMs:");
      sb.append(this.downTimeoutMs);
      first = false;
      if (!first) sb.append(", ");
      sb.append("downErrorThreshold:");
      sb.append(this.downErrorThreshold);
      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 (projection != null) {
        projection.validate();
      }
      if (discoveryProjection != null) {
        discoveryProjection.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 {
        // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
        __isset_bitfield = 0;
        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 startProvider_argsStandardSchemeFactory implements SchemeFactory {
      public startProvider_argsStandardScheme getScheme() {
        return new startProvider_argsStandardScheme();
      }
    }

    private static class startProvider_argsStandardScheme extends StandardScheme<startProvider_args> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, startProvider_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: // PROJECTION
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.projection = new CuratorProjection();
                struct.projection.read(iprot);
                struct.setProjectionIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 2: // DISCOVERY_PROJECTION
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.discoveryProjection = new DiscoveryProjection();
                struct.discoveryProjection.read(iprot);
                struct.setDiscoveryProjectionIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 3: // SERVICE_NAME
              if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                struct.serviceName = iprot.readString();
                struct.setServiceNameIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 4: // PROVIDER_STRATEGY
              if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
                struct.providerStrategy = ProviderStrategyType.findByValue(iprot.readI32());
                struct.setProviderStrategyIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 5: // DOWN_TIMEOUT_MS
              if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
                struct.downTimeoutMs = iprot.readI32();
                struct.setDownTimeoutMsIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 6: // DOWN_ERROR_THRESHOLD
              if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
                struct.downErrorThreshold = iprot.readI32();
                struct.setDownErrorThresholdIsSet(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, startProvider_args struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.projection != null) {
          oprot.writeFieldBegin(PROJECTION_FIELD_DESC);
          struct.projection.write(oprot);
          oprot.writeFieldEnd();
        }
        if (struct.discoveryProjection != null) {
          oprot.writeFieldBegin(DISCOVERY_PROJECTION_FIELD_DESC);
          struct.discoveryProjection.write(oprot);
          oprot.writeFieldEnd();
        }
        if (struct.serviceName != null) {
          oprot.writeFieldBegin(SERVICE_NAME_FIELD_DESC);
          oprot.writeString(struct.serviceName);
          oprot.writeFieldEnd();
        }
        if (struct.providerStrategy != null) {
          oprot.writeFieldBegin(PROVIDER_STRATEGY_FIELD_DESC);
          oprot.writeI32(struct.providerStrategy.getValue());
          oprot.writeFieldEnd();
        }
        oprot.writeFieldBegin(DOWN_TIMEOUT_MS_FIELD_DESC);
        oprot.writeI32(struct.downTimeoutMs);
        oprot.writeFieldEnd();
        oprot.writeFieldBegin(DOWN_ERROR_THRESHOLD_FIELD_DESC);
        oprot.writeI32(struct.downErrorThreshold);
        oprot.writeFieldEnd();
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class startProvider_argsTupleSchemeFactory implements SchemeFactory {
      public startProvider_argsTupleScheme getScheme() {
        return new startProvider_argsTupleScheme();
      }
    }

    private static class startProvider_argsTupleScheme extends TupleScheme<startProvider_args> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, startProvider_args struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetProjection()) {
          optionals.set(0);
        }
        if (struct.isSetDiscoveryProjection()) {
          optionals.set(1);
        }
        if (struct.isSetServiceName()) {
          optionals.set(2);
        }
        if (struct.isSetProviderStrategy()) {
          optionals.set(3);
        }
        if (struct.isSetDownTimeoutMs()) {
          optionals.set(4);
        }
        if (struct.isSetDownErrorThreshold()) {
          optionals.set(5);
        }
        oprot.writeBitSet(optionals, 6);
        if (struct.isSetProjection()) {
          struct.projection.write(oprot);
        }
        if (struct.isSetDiscoveryProjection()) {
          struct.discoveryProjection.write(oprot);
        }
        if (struct.isSetServiceName()) {
          oprot.writeString(struct.serviceName);
        }
        if (struct.isSetProviderStrategy()) {
          oprot.writeI32(struct.providerStrategy.getValue());
        }
        if (struct.isSetDownTimeoutMs()) {
          oprot.writeI32(struct.downTimeoutMs);
        }
        if (struct.isSetDownErrorThreshold()) {
          oprot.writeI32(struct.downErrorThreshold);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, startProvider_args struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(6);
        if (incoming.get(0)) {
          struct.projection = new CuratorProjection();
          struct.projection.read(iprot);
          struct.setProjectionIsSet(true);
        }
        if (incoming.get(1)) {
          struct.discoveryProjection = new DiscoveryProjection();
          struct.discoveryProjection.read(iprot);
          struct.setDiscoveryProjectionIsSet(true);
        }
        if (incoming.get(2)) {
          struct.serviceName = iprot.readString();
          struct.setServiceNameIsSet(true);
        }
        if (incoming.get(3)) {
          struct.providerStrategy = ProviderStrategyType.findByValue(iprot.readI32());
          struct.setProviderStrategyIsSet(true);
        }
        if (incoming.get(4)) {
          struct.downTimeoutMs = iprot.readI32();
          struct.setDownTimeoutMsIsSet(true);
        }
        if (incoming.get(5)) {
          struct.downErrorThreshold = iprot.readI32();
          struct.setDownErrorThresholdIsSet(true);
        }
      }
    }

  }

  public static class startProvider_result implements org.apache.thrift.TBase<startProvider_result, startProvider_result._Fields>, java.io.Serializable, Cloneable, Comparable<startProvider_result>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("startProvider_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 EX1_FIELD_DESC = new org.apache.thrift.protocol.TField("ex1", 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 startProvider_resultStandardSchemeFactory());
      schemes.put(TupleScheme.class, new startProvider_resultTupleSchemeFactory());
    }

    public DiscoveryProviderProjection success; // required
    public CuratorException ex1; // 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"),
      EX1((short)1, "ex1");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      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: // EX1
            return EX1;
          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, DiscoveryProviderProjection.class)));
      tmpMap.put(_Fields.EX1, new org.apache.thrift.meta_data.FieldMetaData("ex1", 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(startProvider_result.class, metaDataMap);
    }

    public startProvider_result() {
    }

    public startProvider_result(
      DiscoveryProviderProjection success,
      CuratorException ex1)
    {
      this();
      this.success = success;
      this.ex1 = ex1;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public startProvider_result(startProvider_result other) {
      if (other.isSetSuccess()) {
        this.success = new DiscoveryProviderProjection(other.success);
      }
      if (other.isSetEx1()) {
        this.ex1 = new CuratorException(other.ex1);
      }
    }

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

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

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

    public startProvider_result setSuccess(DiscoveryProviderProjection 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 CuratorException getEx1() {
      return this.ex1;
    }

    public startProvider_result setEx1(CuratorException ex1) {
      this.ex1 = ex1;
      return this;
    }

    public void unsetEx1() {
      this.ex1 = null;
    }

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

    public void setEx1IsSet(boolean value) {
      if (!value) {
        this.ex1 = null;
      }
    }

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

      case EX1:
        if (value == null) {
          unsetEx1();
        } else {
          setEx1((CuratorException)value);
        }
        break;

      }
    }

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

      case EX1:
        return getEx1();

      }
      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 EX1:
        return isSetEx1();
      }
      throw new IllegalStateException();
    }

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

    public boolean equals(startProvider_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_ex1 = true && this.isSetEx1();
      boolean that_present_ex1 = true && that.isSetEx1();
      if (this_present_ex1 || that_present_ex1) {
        if (!(this_present_ex1 && that_present_ex1))
          return false;
        if (!this.ex1.equals(that.ex1))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

    @Override
    public int compareTo(startProvider_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(isSetEx1()).compareTo(other.isSetEx1());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetEx1()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ex1, other.ex1);
        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("startProvider_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("ex1:");
      if (this.ex1 == null) {
        sb.append("null");
      } else {
        sb.append(this.ex1);
      }
      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 startProvider_resultStandardSchemeFactory implements SchemeFactory {
      public startProvider_resultStandardScheme getScheme() {
        return new startProvider_resultStandardScheme();
      }
    }

    private static class startProvider_resultStandardScheme extends StandardScheme<startProvider_result> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, startProvider_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 DiscoveryProviderProjection();
                struct.success.read(iprot);
                struct.setSuccessIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 1: // EX1
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.ex1 = new CuratorException();
                struct.ex1.read(iprot);
                struct.setEx1IsSet(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, startProvider_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.ex1 != null) {
          oprot.writeFieldBegin(EX1_FIELD_DESC);
          struct.ex1.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class startProvider_resultTupleSchemeFactory implements SchemeFactory {
      public startProvider_resultTupleScheme getScheme() {
        return new startProvider_resultTupleScheme();
      }
    }

    private static class startProvider_resultTupleScheme extends TupleScheme<startProvider_result> {

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

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, startProvider_result struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(2);
        if (incoming.get(0)) {
          struct.success = new DiscoveryProviderProjection();
          struct.success.read(iprot);
          struct.setSuccessIsSet(true);
        }
        if (incoming.get(1)) {
          struct.ex1 = new CuratorException();
          struct.ex1.read(iprot);
          struct.setEx1IsSet(true);
        }
      }
    }

  }

}
