curator-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From randg...@apache.org
Subject git commit: added semaphore support
Date Fri, 30 May 2014 05:09:01 GMT
Repository: curator
Updated Branches:
  refs/heads/curator-rpc cbd174a69 -> 0e76121e9


added semaphore support


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/0e76121e
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/0e76121e
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/0e76121e

Branch: refs/heads/curator-rpc
Commit: 0e76121e9903d305fc8d1327a8fdadfb6c7fb02b
Parents: cbd174a
Author: randgalt <randgalt@apache.org>
Authored: Fri May 30 00:08:56 2014 -0500
Committer: randgalt <randgalt@apache.org>
Committed: Fri May 30 00:08:56 2014 -0500

----------------------------------------------------------------------
 .../curator/x/rpc/connections/Closer.java       |    4 +-
 .../curator/x/rpc/connections/CuratorEntry.java |    8 +-
 .../projection/CuratorProjectionService.java    |   81 +-
 .../x/rpc/idl/projection/LeaseProjection.java   |   20 +
 curator-x-rpc/src/main/thrift/curator.thrift    |    5 +
 .../curator/generated/CuratorService.java       | 1301 ++++++++++++++++++
 .../curator/generated/LeaseProjection.java      |  388 ++++++
 .../org/apache/curator/x/rpc/TestClient.java    |    7 +
 8 files changed, 1786 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/0e76121e/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/connections/Closer.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/connections/Closer.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/connections/Closer.java
index 060c7d7..c59c502 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/connections/Closer.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/connections/Closer.java
@@ -1,6 +1,6 @@
 package org.apache.curator.x.rpc.connections;
 
-public interface Closer<T>
+public interface Closer
 {
-    public void close(T thing);
+    public void close();
 }

http://git-wip-us.apache.org/repos/asf/curator/blob/0e76121e/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/connections/CuratorEntry.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/connections/CuratorEntry.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/connections/CuratorEntry.java
index 2613ad0..0df0740 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/connections/CuratorEntry.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/connections/CuratorEntry.java
@@ -56,7 +56,7 @@ public class CuratorEntry implements Closeable
                 {
                     log.debug(String.format("Closing left over thing. Type: %s - Id: %s", entry.thing.getClass(), mapEntry.getKey()));
                     //noinspection unchecked
-                    entry.closer.close(entry.thing);    // lack of generics is safe because addThing() is type-safe
+                    entry.closer.close();    // lack of generics is safe because addThing() is type-safe
                 }
             }
             things.clear();
@@ -88,7 +88,7 @@ public class CuratorEntry implements Closeable
         return (state.get() == State.OPEN) ? client : null;
     }
 
-    public <T> String addThing(T thing, Closer<T> closer)
+    public String addThing(Object thing, Closer closer)
     {
         return addThing(newId(), thing, closer);
     }
@@ -110,12 +110,12 @@ public class CuratorEntry implements Closeable
         if ( entry != null )
         {
             //noinspection unchecked
-            entry.closer.close(entry.thing);
+            entry.closer.close();
         }
         return false;
     }
 
-    private <T> String addThing(String id, T thing, Closer<T> closer)
+    private <T> String addThing(String id, T thing, Closer closer)
     {
         things.put(id, new Entry(thing, closer));
         return id;

http://git-wip-us.apache.org/repos/asf/curator/blob/0e76121e/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionService.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionService.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionService.java
index cb7a3cc..f82384f 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionService.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionService.java
@@ -36,6 +36,8 @@ import org.apache.curator.framework.recipes.leader.LeaderLatch;
 import org.apache.curator.framework.recipes.leader.LeaderLatchListener;
 import org.apache.curator.framework.recipes.leader.Participant;
 import org.apache.curator.framework.recipes.locks.InterProcessSemaphoreMutex;
+import org.apache.curator.framework.recipes.locks.InterProcessSemaphoreV2;
+import org.apache.curator.framework.recipes.locks.Lease;
 import org.apache.curator.framework.recipes.nodes.PersistentEphemeralNode;
 import org.apache.curator.framework.state.ConnectionState;
 import org.apache.curator.framework.state.ConnectionStateListener;
@@ -268,22 +270,22 @@ public class CuratorProjectionService
     public LockProjection acquireLock(CuratorProjection projection, final String path, int maxWaitMs) throws Exception
     {
         CuratorEntry entry = getEntry(projection);
-        InterProcessSemaphoreMutex lock = new InterProcessSemaphoreMutex(entry.getClient(), path);
+        final InterProcessSemaphoreMutex lock = new InterProcessSemaphoreMutex(entry.getClient(), path);
         if ( !lock.acquire(maxWaitMs, TimeUnit.MILLISECONDS) )
         {
             return new LockProjection();
         }
 
-        Closer<InterProcessSemaphoreMutex> closer = new Closer<InterProcessSemaphoreMutex>()
+        Closer closer = new Closer()
         {
             @Override
-            public void close(InterProcessSemaphoreMutex mutex)
+            public void close()
             {
-                if ( mutex.isAcquiredInThisProcess() )
+                if ( lock.isAcquiredInThisProcess() )
                 {
                     try
                     {
-                        mutex.release();
+                        lock.release();
                     }
                     catch ( Exception e )
                     {
@@ -301,17 +303,17 @@ public class CuratorProjectionService
     {
         CuratorEntry entry = getEntry(projection);
 
-        LeaderLatch leaderLatch = new LeaderLatch(entry.getClient(), path, participantId);
+        final LeaderLatch leaderLatch = new LeaderLatch(entry.getClient(), path, participantId);
         leaderLatch.start();
 
-        Closer<LeaderLatch> closer = new Closer<LeaderLatch>()
+        Closer closer = new Closer()
         {
             @Override
-            public void close(LeaderLatch latch)
+            public void close()
             {
                 try
                 {
-                    latch.close();
+                    leaderLatch.close();
                 }
                 catch ( IOException e )
                 {
@@ -376,13 +378,13 @@ public class CuratorProjectionService
     {
         final CuratorEntry entry = getEntry(projection);
 
-        PathChildrenCache cache = new PathChildrenCache(entry.getClient(), path, cacheData, dataIsCompressed, ThreadUtils.newThreadFactory("PathChildrenCacheResource"));
+        final PathChildrenCache cache = new PathChildrenCache(entry.getClient(), path, cacheData, dataIsCompressed, ThreadUtils.newThreadFactory("PathChildrenCacheResource"));
         cache.start(PathChildrenCache.StartMode.valueOf(startMode.name()));
 
-        Closer<PathChildrenCache> closer = new Closer<PathChildrenCache>()
+        Closer closer = new Closer()
         {
             @Override
-            public void close(PathChildrenCache cache)
+            public void close()
             {
                 try
                 {
@@ -446,10 +448,10 @@ public class CuratorProjectionService
         final NodeCache cache = new NodeCache(entry.getClient(), path, dataIsCompressed);
         cache.start(buildInitial);
 
-        Closer<NodeCache> closer = new Closer<NodeCache>()
+        Closer closer = new Closer()
         {
             @Override
-            public void close(NodeCache cache)
+            public void close()
             {
                 try
                 {
@@ -477,17 +479,26 @@ public class CuratorProjectionService
     }
 
     @ThriftMethod
+    public RpcChildData getNodeCacheData(CuratorProjection projection, NodeCacheProjection cacheProjection) throws Exception
+    {
+        CuratorEntry entry = getEntry(projection);
+
+        NodeCache nodeCache = getThing(entry, cacheProjection.id, NodeCache.class);
+        return new RpcChildData(nodeCache.getCurrentData());
+    }
+
+    @ThriftMethod
     public PersistentEphemeralNodeProjection startPersistentEphemeralNode(CuratorProjection projection, final String path, byte[] data, RpcPersistentEphemeralNodeMode mode) throws Exception
     {
-        final CuratorEntry entry = getEntry(projection);
+        CuratorEntry entry = getEntry(projection);
 
-        PersistentEphemeralNode node = new PersistentEphemeralNode(entry.getClient(), PersistentEphemeralNode.Mode.valueOf(mode.name()), path, data);
+        final PersistentEphemeralNode node = new PersistentEphemeralNode(entry.getClient(), PersistentEphemeralNode.Mode.valueOf(mode.name()), path, data);
         node.start();
 
-        Closer<PersistentEphemeralNode> closer = new Closer<PersistentEphemeralNode>()
+        Closer closer = new Closer()
         {
             @Override
-            public void close(PersistentEphemeralNode node)
+            public void close()
             {
                 try
                 {
@@ -504,12 +515,38 @@ public class CuratorProjectionService
     }
 
     @ThriftMethod
-    public RpcChildData getNodeCacheData(CuratorProjection projection, NodeCacheProjection cacheProjection) throws Exception
+    public List<LeaseProjection> startSemaphore(CuratorProjection projection, final String path, int acquireQty, int maxWaitMs, int maxLeases) throws Exception
     {
-        final CuratorEntry entry = getEntry(projection);
+        CuratorEntry entry = getEntry(projection);
 
-        NodeCache nodeCache = getThing(entry, cacheProjection.id, NodeCache.class);
-        return new RpcChildData(nodeCache.getCurrentData());
+        final InterProcessSemaphoreV2 semaphore = new InterProcessSemaphoreV2(entry.getClient(), path, maxLeases);
+        final Collection<Lease> leases = semaphore.acquire(acquireQty, maxWaitMs, TimeUnit.MILLISECONDS);
+        if ( leases == null )
+        {
+            return Lists.newArrayList();
+        }
+
+        List<LeaseProjection> leaseProjections = Lists.newArrayList();
+        for ( final Lease lease : leases )
+        {
+            Closer closer = new Closer()
+            {
+                @Override
+                public void close()
+                {
+                    try
+                    {
+                        semaphore.returnLease(lease);
+                    }
+                    catch ( Exception e )
+                    {
+                        log.error("Could not release semaphore leases for path: " + path, e);
+                    }
+                }
+            };
+            leaseProjections.add(new LeaseProjection(entry.addThing(lease, closer)));
+        }
+        return leaseProjections;
     }
 
     public void addEvent(CuratorProjection projection, RpcCuratorEvent event)

http://git-wip-us.apache.org/repos/asf/curator/blob/0e76121e/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/LeaseProjection.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/LeaseProjection.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/LeaseProjection.java
new file mode 100644
index 0000000..2faa228
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/LeaseProjection.java
@@ -0,0 +1,20 @@
+package org.apache.curator.x.rpc.idl.projection;
+
+import com.facebook.swift.codec.ThriftField;
+import com.facebook.swift.codec.ThriftStruct;
+
+@ThriftStruct
+public class LeaseProjection
+{
+    @ThriftField(1)
+    public String id;
+
+    public LeaseProjection()
+    {
+    }
+
+    public LeaseProjection(String id)
+    {
+        this.id = id;
+    }
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/0e76121e/curator-x-rpc/src/main/thrift/curator.thrift
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/thrift/curator.thrift b/curator-x-rpc/src/main/thrift/curator.thrift
index 601d775..fc51dba 100644
--- a/curator-x-rpc/src/main/thrift/curator.thrift
+++ b/curator-x-rpc/src/main/thrift/curator.thrift
@@ -62,6 +62,10 @@ struct LeaderProjection {
   1: string id;
 }
 
+struct LeaseProjection {
+  1: string id;
+}
+
 struct LockProjection {
   1: string id;
 }
@@ -214,6 +218,7 @@ service CuratorService {
   NodeCacheProjection startNodeCache(1: CuratorProjection projection, 2: string path, 3: bool dataIsCompressed, 4: bool buildInitial);
   PathChildrenCacheProjection startPathChildrenCache(1: CuratorProjection projection, 2: string path, 3: bool cacheData, 4: bool dataIsCompressed, 5: PathChildrenCacheStartMode startMode);
   PersistentEphemeralNodeProjection startPersistentEphemeralNode(1: CuratorProjection projection, 2: string path, 3: binary data, 4: PersistentEphemeralNodeMode mode);
+  list<LeaseProjection> startSemaphore(1: CuratorProjection projection, 2: string path, 3: i32 acquireQty, 4: i32 maxWaitMs, 5: i32 maxLeases);
 }
 
 service EventService {

http://git-wip-us.apache.org/repos/asf/curator/blob/0e76121e/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorService.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorService.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorService.java
index 4c49c67..d7e52ba 100644
--- a/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorService.java
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorService.java
@@ -74,6 +74,8 @@ public class CuratorService {
 
     public PersistentEphemeralNodeProjection startPersistentEphemeralNode(CuratorProjection projection, String path, ByteBuffer data, PersistentEphemeralNodeMode mode) throws org.apache.thrift.TException;
 
+    public List<LeaseProjection> startSemaphore(CuratorProjection projection, String path, int acquireQty, int maxWaitMs, int maxLeases) throws org.apache.thrift.TException;
+
   }
 
   public interface AsyncIface {
@@ -116,6 +118,8 @@ public class CuratorService {
 
     public void startPersistentEphemeralNode(CuratorProjection projection, String path, ByteBuffer data, PersistentEphemeralNodeMode mode, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
 
+    public void startSemaphore(CuratorProjection projection, String path, int acquireQty, int maxWaitMs, int maxLeases, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
   }
 
   public static class Client extends org.apache.thrift.TServiceClient implements Iface {
@@ -597,6 +601,33 @@ public class CuratorService {
       throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "startPersistentEphemeralNode failed: unknown result");
     }
 
+    public List<LeaseProjection> startSemaphore(CuratorProjection projection, String path, int acquireQty, int maxWaitMs, int maxLeases) throws org.apache.thrift.TException
+    {
+      send_startSemaphore(projection, path, acquireQty, maxWaitMs, maxLeases);
+      return recv_startSemaphore();
+    }
+
+    public void send_startSemaphore(CuratorProjection projection, String path, int acquireQty, int maxWaitMs, int maxLeases) throws org.apache.thrift.TException
+    {
+      startSemaphore_args args = new startSemaphore_args();
+      args.setProjection(projection);
+      args.setPath(path);
+      args.setAcquireQty(acquireQty);
+      args.setMaxWaitMs(maxWaitMs);
+      args.setMaxLeases(maxLeases);
+      sendBase("startSemaphore", args);
+    }
+
+    public List<LeaseProjection> recv_startSemaphore() throws org.apache.thrift.TException
+    {
+      startSemaphore_result result = new startSemaphore_result();
+      receiveBase(result, "startSemaphore");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "startSemaphore 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> {
@@ -1307,6 +1338,50 @@ public class CuratorService {
       }
     }
 
+    public void startSemaphore(CuratorProjection projection, String path, int acquireQty, int maxWaitMs, int maxLeases, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+      checkReady();
+      startSemaphore_call method_call = new startSemaphore_call(projection, path, acquireQty, maxWaitMs, maxLeases, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class startSemaphore_call extends org.apache.thrift.async.TAsyncMethodCall {
+      private CuratorProjection projection;
+      private String path;
+      private int acquireQty;
+      private int maxWaitMs;
+      private int maxLeases;
+      public startSemaphore_call(CuratorProjection projection, String path, int acquireQty, int maxWaitMs, int maxLeases, 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.path = path;
+        this.acquireQty = acquireQty;
+        this.maxWaitMs = maxWaitMs;
+        this.maxLeases = maxLeases;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("startSemaphore", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        startSemaphore_args args = new startSemaphore_args();
+        args.setProjection(projection);
+        args.setPath(path);
+        args.setAcquireQty(acquireQty);
+        args.setMaxWaitMs(maxWaitMs);
+        args.setMaxLeases(maxLeases);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public List<LeaseProjection> getResult() throws 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_startSemaphore();
+      }
+    }
+
   }
 
   public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
@@ -1339,6 +1414,7 @@ public class CuratorService {
       processMap.put("startNodeCache", new startNodeCache());
       processMap.put("startPathChildrenCache", new startPathChildrenCache());
       processMap.put("startPersistentEphemeralNode", new startPersistentEphemeralNode());
+      processMap.put("startSemaphore", new startSemaphore());
       return processMap;
     }
 
@@ -1724,6 +1800,26 @@ public class CuratorService {
       }
     }
 
+    public static class startSemaphore<I extends Iface> extends org.apache.thrift.ProcessFunction<I, startSemaphore_args> {
+      public startSemaphore() {
+        super("startSemaphore");
+      }
+
+      public startSemaphore_args getEmptyArgsInstance() {
+        return new startSemaphore_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public startSemaphore_result getResult(I iface, startSemaphore_args args) throws org.apache.thrift.TException {
+        startSemaphore_result result = new startSemaphore_result();
+        result.success = iface.startSemaphore(args.projection, args.path, args.acquireQty, args.maxWaitMs, args.maxLeases);
+        return result;
+      }
+    }
+
   }
 
   public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
@@ -1756,6 +1852,7 @@ public class CuratorService {
       processMap.put("startNodeCache", new startNodeCache());
       processMap.put("startPathChildrenCache", new startPathChildrenCache());
       processMap.put("startPersistentEphemeralNode", new startPersistentEphemeralNode());
+      processMap.put("startSemaphore", new startSemaphore());
       return processMap;
     }
 
@@ -2728,6 +2825,57 @@ public class CuratorService {
       }
     }
 
+    public static class startSemaphore<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, startSemaphore_args, List<LeaseProjection>> {
+      public startSemaphore() {
+        super("startSemaphore");
+      }
+
+      public startSemaphore_args getEmptyArgsInstance() {
+        return new startSemaphore_args();
+      }
+
+      public AsyncMethodCallback<List<LeaseProjection>> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new AsyncMethodCallback<List<LeaseProjection>>() { 
+          public void onComplete(List<LeaseProjection> o) {
+            startSemaphore_result result = new startSemaphore_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;
+            startSemaphore_result result = new startSemaphore_result();
+            {
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+            }
+            try {
+              fcall.sendResponse(fb,msg,msgType,seqid);
+              return;
+            } catch (Exception ex) {
+              LOGGER.error("Exception writing to internal frame buffer", ex);
+            }
+            fb.close();
+          }
+        };
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public void start(I iface, startSemaphore_args args, org.apache.thrift.async.AsyncMethodCallback<List<LeaseProjection>> resultHandler) throws TException {
+        iface.startSemaphore(args.projection, args.path, args.acquireQty, args.maxWaitMs, args.maxLeases,resultHandler);
+      }
+    }
+
   }
 
   public static class acquireLock_args implements org.apache.thrift.TBase<acquireLock_args, acquireLock_args._Fields>, java.io.Serializable, Cloneable, Comparable<acquireLock_args>   {
@@ -19113,4 +19261,1157 @@ public class CuratorService {
 
   }
 
+  public static class startSemaphore_args implements org.apache.thrift.TBase<startSemaphore_args, startSemaphore_args._Fields>, java.io.Serializable, Cloneable, Comparable<startSemaphore_args>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("startSemaphore_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 PATH_FIELD_DESC = new org.apache.thrift.protocol.TField("path", org.apache.thrift.protocol.TType.STRING, (short)2);
+    private static final org.apache.thrift.protocol.TField ACQUIRE_QTY_FIELD_DESC = new org.apache.thrift.protocol.TField("acquireQty", org.apache.thrift.protocol.TType.I32, (short)3);
+    private static final org.apache.thrift.protocol.TField MAX_WAIT_MS_FIELD_DESC = new org.apache.thrift.protocol.TField("maxWaitMs", org.apache.thrift.protocol.TType.I32, (short)4);
+    private static final org.apache.thrift.protocol.TField MAX_LEASES_FIELD_DESC = new org.apache.thrift.protocol.TField("maxLeases", org.apache.thrift.protocol.TType.I32, (short)5);
+
+    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+    static {
+      schemes.put(StandardScheme.class, new startSemaphore_argsStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new startSemaphore_argsTupleSchemeFactory());
+    }
+
+    public CuratorProjection projection; // required
+    public String path; // required
+    public int acquireQty; // required
+    public int maxWaitMs; // required
+    public int maxLeases; // 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"),
+      PATH((short)2, "path"),
+      ACQUIRE_QTY((short)3, "acquireQty"),
+      MAX_WAIT_MS((short)4, "maxWaitMs"),
+      MAX_LEASES((short)5, "maxLeases");
+
+      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: // PATH
+            return PATH;
+          case 3: // ACQUIRE_QTY
+            return ACQUIRE_QTY;
+          case 4: // MAX_WAIT_MS
+            return MAX_WAIT_MS;
+          case 5: // MAX_LEASES
+            return MAX_LEASES;
+          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 __ACQUIREQTY_ISSET_ID = 0;
+    private static final int __MAXWAITMS_ISSET_ID = 1;
+    private static final int __MAXLEASES_ISSET_ID = 2;
+    private byte __isset_bitfield = 0;
+    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+    static {
+      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+      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.PATH, new org.apache.thrift.meta_data.FieldMetaData("path", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+      tmpMap.put(_Fields.ACQUIRE_QTY, new org.apache.thrift.meta_data.FieldMetaData("acquireQty", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+      tmpMap.put(_Fields.MAX_WAIT_MS, new org.apache.thrift.meta_data.FieldMetaData("maxWaitMs", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+      tmpMap.put(_Fields.MAX_LEASES, new org.apache.thrift.meta_data.FieldMetaData("maxLeases", 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(startSemaphore_args.class, metaDataMap);
+    }
+
+    public startSemaphore_args() {
+    }
+
+    public startSemaphore_args(
+      CuratorProjection projection,
+      String path,
+      int acquireQty,
+      int maxWaitMs,
+      int maxLeases)
+    {
+      this();
+      this.projection = projection;
+      this.path = path;
+      this.acquireQty = acquireQty;
+      setAcquireQtyIsSet(true);
+      this.maxWaitMs = maxWaitMs;
+      setMaxWaitMsIsSet(true);
+      this.maxLeases = maxLeases;
+      setMaxLeasesIsSet(true);
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public startSemaphore_args(startSemaphore_args other) {
+      __isset_bitfield = other.__isset_bitfield;
+      if (other.isSetProjection()) {
+        this.projection = new CuratorProjection(other.projection);
+      }
+      if (other.isSetPath()) {
+        this.path = other.path;
+      }
+      this.acquireQty = other.acquireQty;
+      this.maxWaitMs = other.maxWaitMs;
+      this.maxLeases = other.maxLeases;
+    }
+
+    public startSemaphore_args deepCopy() {
+      return new startSemaphore_args(this);
+    }
+
+    @Override
+    public void clear() {
+      this.projection = null;
+      this.path = null;
+      setAcquireQtyIsSet(false);
+      this.acquireQty = 0;
+      setMaxWaitMsIsSet(false);
+      this.maxWaitMs = 0;
+      setMaxLeasesIsSet(false);
+      this.maxLeases = 0;
+    }
+
+    public CuratorProjection getProjection() {
+      return this.projection;
+    }
+
+    public startSemaphore_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 getPath() {
+      return this.path;
+    }
+
+    public startSemaphore_args setPath(String path) {
+      this.path = path;
+      return this;
+    }
+
+    public void unsetPath() {
+      this.path = null;
+    }
+
+    /** Returns true if field path is set (has been assigned a value) and false otherwise */
+    public boolean isSetPath() {
+      return this.path != null;
+    }
+
+    public void setPathIsSet(boolean value) {
+      if (!value) {
+        this.path = null;
+      }
+    }
+
+    public int getAcquireQty() {
+      return this.acquireQty;
+    }
+
+    public startSemaphore_args setAcquireQty(int acquireQty) {
+      this.acquireQty = acquireQty;
+      setAcquireQtyIsSet(true);
+      return this;
+    }
+
+    public void unsetAcquireQty() {
+      __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ACQUIREQTY_ISSET_ID);
+    }
+
+    /** Returns true if field acquireQty is set (has been assigned a value) and false otherwise */
+    public boolean isSetAcquireQty() {
+      return EncodingUtils.testBit(__isset_bitfield, __ACQUIREQTY_ISSET_ID);
+    }
+
+    public void setAcquireQtyIsSet(boolean value) {
+      __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ACQUIREQTY_ISSET_ID, value);
+    }
+
+    public int getMaxWaitMs() {
+      return this.maxWaitMs;
+    }
+
+    public startSemaphore_args setMaxWaitMs(int maxWaitMs) {
+      this.maxWaitMs = maxWaitMs;
+      setMaxWaitMsIsSet(true);
+      return this;
+    }
+
+    public void unsetMaxWaitMs() {
+      __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __MAXWAITMS_ISSET_ID);
+    }
+
+    /** Returns true if field maxWaitMs is set (has been assigned a value) and false otherwise */
+    public boolean isSetMaxWaitMs() {
+      return EncodingUtils.testBit(__isset_bitfield, __MAXWAITMS_ISSET_ID);
+    }
+
+    public void setMaxWaitMsIsSet(boolean value) {
+      __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __MAXWAITMS_ISSET_ID, value);
+    }
+
+    public int getMaxLeases() {
+      return this.maxLeases;
+    }
+
+    public startSemaphore_args setMaxLeases(int maxLeases) {
+      this.maxLeases = maxLeases;
+      setMaxLeasesIsSet(true);
+      return this;
+    }
+
+    public void unsetMaxLeases() {
+      __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __MAXLEASES_ISSET_ID);
+    }
+
+    /** Returns true if field maxLeases is set (has been assigned a value) and false otherwise */
+    public boolean isSetMaxLeases() {
+      return EncodingUtils.testBit(__isset_bitfield, __MAXLEASES_ISSET_ID);
+    }
+
+    public void setMaxLeasesIsSet(boolean value) {
+      __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __MAXLEASES_ISSET_ID, value);
+    }
+
+    public void setFieldValue(_Fields field, Object value) {
+      switch (field) {
+      case PROJECTION:
+        if (value == null) {
+          unsetProjection();
+        } else {
+          setProjection((CuratorProjection)value);
+        }
+        break;
+
+      case PATH:
+        if (value == null) {
+          unsetPath();
+        } else {
+          setPath((String)value);
+        }
+        break;
+
+      case ACQUIRE_QTY:
+        if (value == null) {
+          unsetAcquireQty();
+        } else {
+          setAcquireQty((Integer)value);
+        }
+        break;
+
+      case MAX_WAIT_MS:
+        if (value == null) {
+          unsetMaxWaitMs();
+        } else {
+          setMaxWaitMs((Integer)value);
+        }
+        break;
+
+      case MAX_LEASES:
+        if (value == null) {
+          unsetMaxLeases();
+        } else {
+          setMaxLeases((Integer)value);
+        }
+        break;
+
+      }
+    }
+
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      case PROJECTION:
+        return getProjection();
+
+      case PATH:
+        return getPath();
+
+      case ACQUIRE_QTY:
+        return Integer.valueOf(getAcquireQty());
+
+      case MAX_WAIT_MS:
+        return Integer.valueOf(getMaxWaitMs());
+
+      case MAX_LEASES:
+        return Integer.valueOf(getMaxLeases());
+
+      }
+      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 PATH:
+        return isSetPath();
+      case ACQUIRE_QTY:
+        return isSetAcquireQty();
+      case MAX_WAIT_MS:
+        return isSetMaxWaitMs();
+      case MAX_LEASES:
+        return isSetMaxLeases();
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof startSemaphore_args)
+        return this.equals((startSemaphore_args)that);
+      return false;
+    }
+
+    public boolean equals(startSemaphore_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_path = true && this.isSetPath();
+      boolean that_present_path = true && that.isSetPath();
+      if (this_present_path || that_present_path) {
+        if (!(this_present_path && that_present_path))
+          return false;
+        if (!this.path.equals(that.path))
+          return false;
+      }
+
+      boolean this_present_acquireQty = true;
+      boolean that_present_acquireQty = true;
+      if (this_present_acquireQty || that_present_acquireQty) {
+        if (!(this_present_acquireQty && that_present_acquireQty))
+          return false;
+        if (this.acquireQty != that.acquireQty)
+          return false;
+      }
+
+      boolean this_present_maxWaitMs = true;
+      boolean that_present_maxWaitMs = true;
+      if (this_present_maxWaitMs || that_present_maxWaitMs) {
+        if (!(this_present_maxWaitMs && that_present_maxWaitMs))
+          return false;
+        if (this.maxWaitMs != that.maxWaitMs)
+          return false;
+      }
+
+      boolean this_present_maxLeases = true;
+      boolean that_present_maxLeases = true;
+      if (this_present_maxLeases || that_present_maxLeases) {
+        if (!(this_present_maxLeases && that_present_maxLeases))
+          return false;
+        if (this.maxLeases != that.maxLeases)
+          return false;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      return 0;
+    }
+
+    @Override
+    public int compareTo(startSemaphore_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(isSetPath()).compareTo(other.isSetPath());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetPath()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.path, other.path);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      lastComparison = Boolean.valueOf(isSetAcquireQty()).compareTo(other.isSetAcquireQty());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetAcquireQty()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.acquireQty, other.acquireQty);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      lastComparison = Boolean.valueOf(isSetMaxWaitMs()).compareTo(other.isSetMaxWaitMs());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetMaxWaitMs()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.maxWaitMs, other.maxWaitMs);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      lastComparison = Boolean.valueOf(isSetMaxLeases()).compareTo(other.isSetMaxLeases());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetMaxLeases()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.maxLeases, other.maxLeases);
+        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("startSemaphore_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("path:");
+      if (this.path == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.path);
+      }
+      first = false;
+      if (!first) sb.append(", ");
+      sb.append("acquireQty:");
+      sb.append(this.acquireQty);
+      first = false;
+      if (!first) sb.append(", ");
+      sb.append("maxWaitMs:");
+      sb.append(this.maxWaitMs);
+      first = false;
+      if (!first) sb.append(", ");
+      sb.append("maxLeases:");
+      sb.append(this.maxLeases);
+      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();
+      }
+    }
+
+    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 startSemaphore_argsStandardSchemeFactory implements SchemeFactory {
+      public startSemaphore_argsStandardScheme getScheme() {
+        return new startSemaphore_argsStandardScheme();
+      }
+    }
+
+    private static class startSemaphore_argsStandardScheme extends StandardScheme<startSemaphore_args> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, startSemaphore_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: // PATH
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+                struct.path = iprot.readString();
+                struct.setPathIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            case 3: // ACQUIRE_QTY
+              if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+                struct.acquireQty = iprot.readI32();
+                struct.setAcquireQtyIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            case 4: // MAX_WAIT_MS
+              if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+                struct.maxWaitMs = iprot.readI32();
+                struct.setMaxWaitMsIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            case 5: // MAX_LEASES
+              if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+                struct.maxLeases = iprot.readI32();
+                struct.setMaxLeasesIsSet(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, startSemaphore_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.path != null) {
+          oprot.writeFieldBegin(PATH_FIELD_DESC);
+          oprot.writeString(struct.path);
+          oprot.writeFieldEnd();
+        }
+        oprot.writeFieldBegin(ACQUIRE_QTY_FIELD_DESC);
+        oprot.writeI32(struct.acquireQty);
+        oprot.writeFieldEnd();
+        oprot.writeFieldBegin(MAX_WAIT_MS_FIELD_DESC);
+        oprot.writeI32(struct.maxWaitMs);
+        oprot.writeFieldEnd();
+        oprot.writeFieldBegin(MAX_LEASES_FIELD_DESC);
+        oprot.writeI32(struct.maxLeases);
+        oprot.writeFieldEnd();
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class startSemaphore_argsTupleSchemeFactory implements SchemeFactory {
+      public startSemaphore_argsTupleScheme getScheme() {
+        return new startSemaphore_argsTupleScheme();
+      }
+    }
+
+    private static class startSemaphore_argsTupleScheme extends TupleScheme<startSemaphore_args> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, startSemaphore_args struct) throws org.apache.thrift.TException {
+        TTupleProtocol oprot = (TTupleProtocol) prot;
+        BitSet optionals = new BitSet();
+        if (struct.isSetProjection()) {
+          optionals.set(0);
+        }
+        if (struct.isSetPath()) {
+          optionals.set(1);
+        }
+        if (struct.isSetAcquireQty()) {
+          optionals.set(2);
+        }
+        if (struct.isSetMaxWaitMs()) {
+          optionals.set(3);
+        }
+        if (struct.isSetMaxLeases()) {
+          optionals.set(4);
+        }
+        oprot.writeBitSet(optionals, 5);
+        if (struct.isSetProjection()) {
+          struct.projection.write(oprot);
+        }
+        if (struct.isSetPath()) {
+          oprot.writeString(struct.path);
+        }
+        if (struct.isSetAcquireQty()) {
+          oprot.writeI32(struct.acquireQty);
+        }
+        if (struct.isSetMaxWaitMs()) {
+          oprot.writeI32(struct.maxWaitMs);
+        }
+        if (struct.isSetMaxLeases()) {
+          oprot.writeI32(struct.maxLeases);
+        }
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, startSemaphore_args struct) throws org.apache.thrift.TException {
+        TTupleProtocol iprot = (TTupleProtocol) prot;
+        BitSet incoming = iprot.readBitSet(5);
+        if (incoming.get(0)) {
+          struct.projection = new CuratorProjection();
+          struct.projection.read(iprot);
+          struct.setProjectionIsSet(true);
+        }
+        if (incoming.get(1)) {
+          struct.path = iprot.readString();
+          struct.setPathIsSet(true);
+        }
+        if (incoming.get(2)) {
+          struct.acquireQty = iprot.readI32();
+          struct.setAcquireQtyIsSet(true);
+        }
+        if (incoming.get(3)) {
+          struct.maxWaitMs = iprot.readI32();
+          struct.setMaxWaitMsIsSet(true);
+        }
+        if (incoming.get(4)) {
+          struct.maxLeases = iprot.readI32();
+          struct.setMaxLeasesIsSet(true);
+        }
+      }
+    }
+
+  }
+
+  public static class startSemaphore_result implements org.apache.thrift.TBase<startSemaphore_result, startSemaphore_result._Fields>, java.io.Serializable, Cloneable, Comparable<startSemaphore_result>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("startSemaphore_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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+    static {
+      schemes.put(StandardScheme.class, new startSemaphore_resultStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new startSemaphore_resultTupleSchemeFactory());
+    }
+
+    public List<LeaseProjection> success; // 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");
+
+      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;
+          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, LeaseProjection.class))));
+      metaDataMap = Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(startSemaphore_result.class, metaDataMap);
+    }
+
+    public startSemaphore_result() {
+    }
+
+    public startSemaphore_result(
+      List<LeaseProjection> success)
+    {
+      this();
+      this.success = success;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public startSemaphore_result(startSemaphore_result other) {
+      if (other.isSetSuccess()) {
+        List<LeaseProjection> __this__success = new ArrayList<LeaseProjection>(other.success.size());
+        for (LeaseProjection other_element : other.success) {
+          __this__success.add(new LeaseProjection(other_element));
+        }
+        this.success = __this__success;
+      }
+    }
+
+    public startSemaphore_result deepCopy() {
+      return new startSemaphore_result(this);
+    }
+
+    @Override
+    public void clear() {
+      this.success = null;
+    }
+
+    public int getSuccessSize() {
+      return (this.success == null) ? 0 : this.success.size();
+    }
+
+    public java.util.Iterator<LeaseProjection> getSuccessIterator() {
+      return (this.success == null) ? null : this.success.iterator();
+    }
+
+    public void addToSuccess(LeaseProjection elem) {
+      if (this.success == null) {
+        this.success = new ArrayList<LeaseProjection>();
+      }
+      this.success.add(elem);
+    }
+
+    public List<LeaseProjection> getSuccess() {
+      return this.success;
+    }
+
+    public startSemaphore_result setSuccess(List<LeaseProjection> 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 void setFieldValue(_Fields field, Object value) {
+      switch (field) {
+      case SUCCESS:
+        if (value == null) {
+          unsetSuccess();
+        } else {
+          setSuccess((List<LeaseProjection>)value);
+        }
+        break;
+
+      }
+    }
+
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      case SUCCESS:
+        return getSuccess();
+
+      }
+      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();
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof startSemaphore_result)
+        return this.equals((startSemaphore_result)that);
+      return false;
+    }
+
+    public boolean equals(startSemaphore_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;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      return 0;
+    }
+
+    @Override
+    public int compareTo(startSemaphore_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;
+        }
+      }
+      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("startSemaphore_result(");
+      boolean first = true;
+
+      sb.append("success:");
+      if (this.success == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.success);
+      }
+      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 startSemaphore_resultStandardSchemeFactory implements SchemeFactory {
+      public startSemaphore_resultStandardScheme getScheme() {
+        return new startSemaphore_resultStandardScheme();
+      }
+    }
+
+    private static class startSemaphore_resultStandardScheme extends StandardScheme<startSemaphore_result> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, startSemaphore_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 _list40 = iprot.readListBegin();
+                  struct.success = new ArrayList<LeaseProjection>(_list40.size);
+                  for (int _i41 = 0; _i41 < _list40.size; ++_i41)
+                  {
+                    LeaseProjection _elem42;
+                    _elem42 = new LeaseProjection();
+                    _elem42.read(iprot);
+                    struct.success.add(_elem42);
+                  }
+                  iprot.readListEnd();
+                }
+                struct.setSuccessIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            default:
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+          }
+          iprot.readFieldEnd();
+        }
+        iprot.readStructEnd();
+
+        // check for required fields of primitive type, which can't be checked in the validate method
+        struct.validate();
+      }
+
+      public void write(org.apache.thrift.protocol.TProtocol oprot, startSemaphore_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 (LeaseProjection _iter43 : struct.success)
+            {
+              _iter43.write(oprot);
+            }
+            oprot.writeListEnd();
+          }
+          oprot.writeFieldEnd();
+        }
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class startSemaphore_resultTupleSchemeFactory implements SchemeFactory {
+      public startSemaphore_resultTupleScheme getScheme() {
+        return new startSemaphore_resultTupleScheme();
+      }
+    }
+
+    private static class startSemaphore_resultTupleScheme extends TupleScheme<startSemaphore_result> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, startSemaphore_result struct) throws org.apache.thrift.TException {
+        TTupleProtocol oprot = (TTupleProtocol) prot;
+        BitSet optionals = new BitSet();
+        if (struct.isSetSuccess()) {
+          optionals.set(0);
+        }
+        oprot.writeBitSet(optionals, 1);
+        if (struct.isSetSuccess()) {
+          {
+            oprot.writeI32(struct.success.size());
+            for (LeaseProjection _iter44 : struct.success)
+            {
+              _iter44.write(oprot);
+            }
+          }
+        }
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, startSemaphore_result struct) throws org.apache.thrift.TException {
+        TTupleProtocol iprot = (TTupleProtocol) prot;
+        BitSet incoming = iprot.readBitSet(1);
+        if (incoming.get(0)) {
+          {
+            org.apache.thrift.protocol.TList _list45 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+            struct.success = new ArrayList<LeaseProjection>(_list45.size);
+            for (int _i46 = 0; _i46 < _list45.size; ++_i46)
+            {
+              LeaseProjection _elem47;
+              _elem47 = new LeaseProjection();
+              _elem47.read(iprot);
+              struct.success.add(_elem47);
+            }
+          }
+          struct.setSuccessIsSet(true);
+        }
+      }
+    }
+
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/curator/blob/0e76121e/curator-x-rpc/src/test/java/org/apache/curator/generated/LeaseProjection.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/LeaseProjection.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/LeaseProjection.java
new file mode 100644
index 0000000..d14f14d
--- /dev/null
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/LeaseProjection.java
@@ -0,0 +1,388 @@
+/**
+ * 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 LeaseProjection implements org.apache.thrift.TBase<LeaseProjection, LeaseProjection._Fields>, java.io.Serializable, Cloneable, Comparable<LeaseProjection> {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("LeaseProjection");
+
+  private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.STRING, (short)1);
+
+  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+  static {
+    schemes.put(StandardScheme.class, new LeaseProjectionStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new LeaseProjectionTupleSchemeFactory());
+  }
+
+  public String id; // 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 {
+    ID((short)1, "id");
+
+    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: // ID
+          return 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.ID, new org.apache.thrift.meta_data.FieldMetaData("id", 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(LeaseProjection.class, metaDataMap);
+  }
+
+  public LeaseProjection() {
+  }
+
+  public LeaseProjection(
+    String id)
+  {
+    this();
+    this.id = id;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public LeaseProjection(LeaseProjection other) {
+    if (other.isSetId()) {
+      this.id = other.id;
+    }
+  }
+
+  public LeaseProjection deepCopy() {
+    return new LeaseProjection(this);
+  }
+
+  @Override
+  public void clear() {
+    this.id = null;
+  }
+
+  public String getId() {
+    return this.id;
+  }
+
+  public LeaseProjection setId(String id) {
+    this.id = id;
+    return this;
+  }
+
+  public void unsetId() {
+    this.id = null;
+  }
+
+  /** Returns true if field id is set (has been assigned a value) and false otherwise */
+  public boolean isSetId() {
+    return this.id != null;
+  }
+
+  public void setIdIsSet(boolean value) {
+    if (!value) {
+      this.id = null;
+    }
+  }
+
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case ID:
+      if (value == null) {
+        unsetId();
+      } else {
+        setId((String)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case ID:
+      return getId();
+
+    }
+    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 ID:
+      return isSetId();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof LeaseProjection)
+      return this.equals((LeaseProjection)that);
+    return false;
+  }
+
+  public boolean equals(LeaseProjection that) {
+    if (that == null)
+      return false;
+
+    boolean this_present_id = true && this.isSetId();
+    boolean that_present_id = true && that.isSetId();
+    if (this_present_id || that_present_id) {
+      if (!(this_present_id && that_present_id))
+        return false;
+      if (!this.id.equals(that.id))
+        return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return 0;
+  }
+
+  @Override
+  public int compareTo(LeaseProjection other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+
+    lastComparison = Boolean.valueOf(isSetId()).compareTo(other.isSetId());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetId()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, other.id);
+      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("LeaseProjection(");
+    boolean first = true;
+
+    sb.append("id:");
+    if (this.id == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.id);
+    }
+    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 LeaseProjectionStandardSchemeFactory implements SchemeFactory {
+    public LeaseProjectionStandardScheme getScheme() {
+      return new LeaseProjectionStandardScheme();
+    }
+  }
+
+  private static class LeaseProjectionStandardScheme extends StandardScheme<LeaseProjection> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, LeaseProjection 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: // ID
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.id = iprot.readString();
+              struct.setIdIsSet(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, LeaseProjection struct) throws org.apache.thrift.TException {
+      struct.validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      if (struct.id != null) {
+        oprot.writeFieldBegin(ID_FIELD_DESC);
+        oprot.writeString(struct.id);
+        oprot.writeFieldEnd();
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class LeaseProjectionTupleSchemeFactory implements SchemeFactory {
+    public LeaseProjectionTupleScheme getScheme() {
+      return new LeaseProjectionTupleScheme();
+    }
+  }
+
+  private static class LeaseProjectionTupleScheme extends TupleScheme<LeaseProjection> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, LeaseProjection struct) throws org.apache.thrift.TException {
+      TTupleProtocol oprot = (TTupleProtocol) prot;
+      BitSet optionals = new BitSet();
+      if (struct.isSetId()) {
+        optionals.set(0);
+      }
+      oprot.writeBitSet(optionals, 1);
+      if (struct.isSetId()) {
+        oprot.writeString(struct.id);
+      }
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, LeaseProjection struct) throws org.apache.thrift.TException {
+      TTupleProtocol iprot = (TTupleProtocol) prot;
+      BitSet incoming = iprot.readBitSet(1);
+      if (incoming.get(0)) {
+        struct.id = iprot.readString();
+        struct.setIdIsSet(true);
+      }
+    }
+  }
+
+}
+

http://git-wip-us.apache.org/repos/asf/curator/blob/0e76121e/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/TestClient.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/TestClient.java b/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/TestClient.java
index 9da935c..5e1451e 100644
--- a/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/TestClient.java
+++ b/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/TestClient.java
@@ -132,5 +132,12 @@ public class TestClient
         OptionalStat nodeExists = client.exists(curatorProjection, existsSpec);
         System.out.println("nodeExists: " + nodeExists);
         client.closeGenericProjection(curatorProjection, node.id);
+
+        List<LeaseProjection> leaseProjections = client.startSemaphore(curatorProjection, "/semi", 3, 1000, 10);
+        System.out.println("leaseProjections: " + leaseProjections);
+        for ( LeaseProjection leaseProjection : leaseProjections )
+        {
+            client.closeGenericProjection(curatorProjection, leaseProjection.id);
+        }
     }
 }


Mime
View raw message