You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@curator.apache.org by ra...@apache.org on 2014/06/07 20:13:36 UTC
[1/2] git commit: javadoc plugin needs more memory
Repository: curator
Updated Branches:
refs/heads/curator-rpc 0a558a337 -> 8880417db
javadoc plugin needs more memory
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/64e5cfec
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/64e5cfec
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/64e5cfec
Branch: refs/heads/curator-rpc
Commit: 64e5cfec37e1a20d4ea925fbb401774fa370995c
Parents: 0a558a3
Author: randgalt <ra...@apache.org>
Authored: Tue Jun 3 13:04:55 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Tue Jun 3 13:04:55 2014 -0500
----------------------------------------------------------------------
pom.xml | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/64e5cfec/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 837908e..812198d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -66,7 +66,6 @@
<maven-compiler-plugin-version>3.1</maven-compiler-plugin-version>
<maven-bundle-plugin-version>2.3.7</maven-bundle-plugin-version>
<maven-surefire-plugin-version>2.17</maven-surefire-plugin-version>
- <maven-javadoc-plugin-version>2.9.1</maven-javadoc-plugin-version>
<maven-site-plugin-version>3.3</maven-site-plugin-version>
<doxia-module-confluence-version>1.5</doxia-module-confluence-version>
<maven-scm-publish-plugin-version>1.0</maven-scm-publish-plugin-version>
@@ -479,6 +478,9 @@
<version>${maven-javadoc-plugin-version}</version>
<configuration>
<aggregate>true</aggregate>
+ <additionalJOptions>
+ <additionalJOption>-J-Xmx1g</additionalJOption>
+ </additionalJOptions>
</configuration>
</plugin>
</plugins>
@@ -646,6 +648,9 @@
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<aggregate>true</aggregate>
+ <additionalJOptions>
+ <additionalJOption>-J-Xmx1g</additionalJOption>
+ </additionalJOptions>
</configuration>
</plugin>
[2/2] git commit: refactoring
Posted by ra...@apache.org.
refactoring
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/8880417d
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/8880417d
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/8880417d
Branch: refs/heads/curator-rpc
Commit: 8880417db8b3325ce024c7e0c3263f61947daa51
Parents: 64e5cfe
Author: randgalt <ra...@apache.org>
Authored: Tue Jun 3 13:34:01 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Tue Jun 3 13:34:01 2014 -0500
----------------------------------------------------------------------
.../idl/services/CuratorProjectionService.java | 6 +-
.../rpc/idl/structs/OptionalLockProjection.java | 38 ++
curator-x-rpc/src/main/thrift/curator.thrift | 6 +-
.../src/site/confluence/events.confluence | 2 +-
.../src/site/confluence/reference.confluence | 4 +-
.../src/site/confluence/usage.confluence | 7 +-
.../curator/generated/CuratorService.java | 36 +-
.../generated/OptionalLockProjection.java | 393 +++++++++++++++++++
.../java/org/apache/curator/x/rpc/RpcTests.java | 6 +-
.../org/apache/curator/x/rpc/TestClient.java | 4 +-
10 files changed, 469 insertions(+), 33 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/8880417d/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/services/CuratorProjectionService.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/services/CuratorProjectionService.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/services/CuratorProjectionService.java
index 257230e..777472c 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/services/CuratorProjectionService.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/services/CuratorProjectionService.java
@@ -352,7 +352,7 @@ public class CuratorProjectionService
}
@ThriftMethod
- public LockProjection acquireLock(CuratorProjection projection, final String path, int maxWaitMs) throws RpcException
+ public OptionalLockProjection acquireLock(CuratorProjection projection, final String path, int maxWaitMs) throws RpcException
{
try
{
@@ -360,7 +360,7 @@ public class CuratorProjectionService
final InterProcessSemaphoreMutex lock = new InterProcessSemaphoreMutex(entry.getClient(), path);
if ( !lock.acquire(maxWaitMs, TimeUnit.MILLISECONDS) )
{
- return new LockProjection();
+ return new OptionalLockProjection();
}
Closer closer = new Closer()
@@ -382,7 +382,7 @@ public class CuratorProjectionService
}
};
String id = entry.addThing(lock, closer);
- return new LockProjection(id);
+ return new OptionalLockProjection(new LockProjection(id));
}
catch ( Exception e )
{
http://git-wip-us.apache.org/repos/asf/curator/blob/8880417d/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/structs/OptionalLockProjection.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/structs/OptionalLockProjection.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/structs/OptionalLockProjection.java
new file mode 100644
index 0000000..cd85494
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/structs/OptionalLockProjection.java
@@ -0,0 +1,38 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.curator.x.rpc.idl.structs;
+
+import com.facebook.swift.codec.ThriftField;
+import com.facebook.swift.codec.ThriftStruct;
+
+@ThriftStruct
+public class OptionalLockProjection
+{
+ @ThriftField(1)
+ public LockProjection lockProjection;
+
+ public OptionalLockProjection()
+ {
+ }
+
+ public OptionalLockProjection(LockProjection lockProjection)
+ {
+ this.lockProjection = lockProjection;
+ }
+}
http://git-wip-us.apache.org/repos/asf/curator/blob/8880417d/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 4071069..d6bcd94 100644
--- a/curator-x-rpc/src/main/thrift/curator.thrift
+++ b/curator-x-rpc/src/main/thrift/curator.thrift
@@ -109,6 +109,10 @@ struct OptionalData {
1: binary data;
}
+struct OptionalLockProjection {
+ 1: LockProjection lockProjection;
+}
+
struct OptionalPath {
1: string path;
}
@@ -245,7 +249,7 @@ struct CuratorEvent {
}
service CuratorService {
- LockProjection acquireLock(1: CuratorProjection projection, 2: string path, 3: i32 maxWaitMs) throws (1: CuratorException ex1);
+ OptionalLockProjection acquireLock(1: CuratorProjection projection, 2: string path, 3: i32 maxWaitMs) throws (1: CuratorException ex1);
list<LeaseProjection> acquireSemaphore(1: CuratorProjection projection, 2: string path, 3: i32 acquireQty, 4: i32 maxWaitMs, 5: i32 maxLeases) throws (1: CuratorException ex1);
void closeCuratorProjection(1: CuratorProjection projection);
bool closeGenericProjection(1: CuratorProjection projection, 2: string id) throws (1: CuratorException ex1);
http://git-wip-us.apache.org/repos/asf/curator/blob/8880417d/curator-x-rpc/src/site/confluence/events.confluence
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/site/confluence/events.confluence b/curator-x-rpc/src/site/confluence/events.confluence
index ead5206..8b3f711 100644
--- a/curator-x-rpc/src/site/confluence/events.confluence
+++ b/curator-x-rpc/src/site/confluence/events.confluence
@@ -9,7 +9,7 @@ messages from the EventService. Here is pseudo code:
{code}
inThread => {
- while ( isOpen ) {
+ while isOpen {
event = eventService.getNextEvent(curatorProjection)
... process event ...
}
http://git-wip-us.apache.org/repos/asf/curator/blob/8880417d/curator-x-rpc/src/site/confluence/reference.confluence
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/site/confluence/reference.confluence b/curator-x-rpc/src/site/confluence/reference.confluence
index 602906e..a7b1ce5 100644
--- a/curator-x-rpc/src/site/confluence/reference.confluence
+++ b/curator-x-rpc/src/site/confluence/reference.confluence
@@ -7,7 +7,7 @@ h2. CuratorService
||API||Arguments||Return Value||Description||
|newCuratorProjection|connectionName|CuratorProjection|Allocates a projection to a configured CuratorFramework instance in the RPC server. "connectionName" is the name of a [[configured|configuration.html]] connection.|
|closeCuratorProjection|CuratorProjection|void|Close a CuratorProjection. Also closes any recipes, etc. create for the projection.|
-|pingCuratorProjection|CuratorProjection|void|Keeps the CuratorProjection from timing out. NOTE: your [[EventService|events.html]] event loop will do this for your.|
+|pingCuratorProjection|CuratorProjection|void|Keeps the CuratorProjection from timing out. NOTE: your [[EventService|events.html]] event loop will do this for you.|
|createNode|CreateSpec|Created path name|Create a ZNode|
|deleteNode|DeleteSpec|void|Delete a ZNode|
|getData|GetDataSpec|bytes|Return a ZNode's data|
@@ -16,7 +16,7 @@ h2. CuratorService
|getChildren|GetChildrenSpec|List of nodes|Get the child nodes for a ZNode|
|sync|path and async context|void|Do a ZooKeeper sync|
|closeGenericProjection|id|void|Closes any projection|
-|acquireLock|path, maxWaitMs|lock projection|Acquire a lock for the given path. Will wait at most maxWaitMs to acquire the lock. If the acquisition fails, LockProjection.id will be null.|
+|acquireLock|path, maxWaitMs|optional lock projection|Acquire a lock for the given path. Will wait at most maxWaitMs to acquire the lock. If the acquisition fails, result will be null.|
|startLeaderSelector|path, participantId, waitForLeadershipMs|LeaderResult|Start a leader selector on the given path. The instance will be assigned the specified participantId. If waitForLeadershipMs is non\-zero, the method will block for that amount of time waiting for leadership.|
|getLeaderParticipants|leaderProjection|List of Participant|Return the participants in a leader selector|
|isLeader|leaderProjection|bool|Return true if the specified projection is the current leader|
http://git-wip-us.apache.org/repos/asf/curator/blob/8880417d/curator-x-rpc/src/site/confluence/usage.confluence
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/site/confluence/usage.confluence b/curator-x-rpc/src/site/confluence/usage.confluence
index 57bc14c..36fb04e 100644
--- a/curator-x-rpc/src/site/confluence/usage.confluence
+++ b/curator-x-rpc/src/site/confluence/usage.confluence
@@ -57,7 +57,7 @@ EventService.Client eventService = new EventService.Client()
curatorProjection = curatorService.newCuratorProjection(name)
inThread => {
- while ( isOpen ) {
+ while isOpen {
event = eventService.getNextEvent(curatorProjection)
... process event ...
}
@@ -72,10 +72,11 @@ h2. Usage
Once initialized, use recipes/APIs as needed. Here is an example of using the lock recipe:
{code}
-lockId = client.acquireLock(curatorProjection, "/mylock", 10000)
-if lockId.id == null {
+optionalLockId = client.acquireLock(curatorProjection, "/mylock", 10000)
+if optionalLockId.lockProjection == null {
// lock attempt failed. Throw exception, etc.
}
+lockId = optionalLockId.lockProjection
// you now own the lock
http://git-wip-us.apache.org/repos/asf/curator/blob/8880417d/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 cbbe5fc..63d46ee 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
@@ -36,7 +36,7 @@ public class CuratorService {
public interface Iface {
- public LockProjection acquireLock(CuratorProjection projection, String path, int maxWaitMs) throws CuratorException, org.apache.thrift.TException;
+ public OptionalLockProjection acquireLock(CuratorProjection projection, String path, int maxWaitMs) throws CuratorException, org.apache.thrift.TException;
public List<LeaseProjection> acquireSemaphore(CuratorProjection projection, String path, int acquireQty, int maxWaitMs, int maxLeases) throws CuratorException, org.apache.thrift.TException;
@@ -150,7 +150,7 @@ public class CuratorService {
super(iprot, oprot);
}
- public LockProjection acquireLock(CuratorProjection projection, String path, int maxWaitMs) throws CuratorException, org.apache.thrift.TException
+ public OptionalLockProjection acquireLock(CuratorProjection projection, String path, int maxWaitMs) throws CuratorException, org.apache.thrift.TException
{
send_acquireLock(projection, path, maxWaitMs);
return recv_acquireLock();
@@ -165,7 +165,7 @@ public class CuratorService {
sendBase("acquireLock", args);
}
- public LockProjection recv_acquireLock() throws CuratorException, org.apache.thrift.TException
+ public OptionalLockProjection recv_acquireLock() throws CuratorException, org.apache.thrift.TException
{
acquireLock_result result = new acquireLock_result();
receiveBase(result, "acquireLock");
@@ -776,7 +776,7 @@ public class CuratorService {
prot.writeMessageEnd();
}
- public LockProjection getResult() throws CuratorException, org.apache.thrift.TException {
+ public OptionalLockProjection getResult() throws CuratorException, org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
@@ -2150,7 +2150,7 @@ public class CuratorService {
return processMap;
}
- public static class acquireLock<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, acquireLock_args, LockProjection> {
+ public static class acquireLock<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, acquireLock_args, OptionalLockProjection> {
public acquireLock() {
super("acquireLock");
}
@@ -2159,10 +2159,10 @@ public class CuratorService {
return new acquireLock_args();
}
- public AsyncMethodCallback<LockProjection> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ public AsyncMethodCallback<OptionalLockProjection> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
final org.apache.thrift.AsyncProcessFunction fcall = this;
- return new AsyncMethodCallback<LockProjection>() {
- public void onComplete(LockProjection o) {
+ return new AsyncMethodCallback<OptionalLockProjection>() {
+ public void onComplete(OptionalLockProjection o) {
acquireLock_result result = new acquireLock_result();
result.success = o;
try {
@@ -2202,7 +2202,7 @@ public class CuratorService {
return false;
}
- public void start(I iface, acquireLock_args args, org.apache.thrift.async.AsyncMethodCallback<LockProjection> resultHandler) throws TException {
+ public void start(I iface, acquireLock_args args, org.apache.thrift.async.AsyncMethodCallback<OptionalLockProjection> resultHandler) throws TException {
iface.acquireLock(args.projection, args.path, args.maxWaitMs,resultHandler);
}
}
@@ -3939,7 +3939,7 @@ public class CuratorService {
schemes.put(TupleScheme.class, new acquireLock_resultTupleSchemeFactory());
}
- public LockProjection success; // required
+ public OptionalLockProjection success; // required
public CuratorException ex1; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
@@ -4008,7 +4008,7 @@ public class CuratorService {
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, LockProjection.class)));
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, OptionalLockProjection.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);
@@ -4019,7 +4019,7 @@ public class CuratorService {
}
public acquireLock_result(
- LockProjection success,
+ OptionalLockProjection success,
CuratorException ex1)
{
this();
@@ -4032,7 +4032,7 @@ public class CuratorService {
*/
public acquireLock_result(acquireLock_result other) {
if (other.isSetSuccess()) {
- this.success = new LockProjection(other.success);
+ this.success = new OptionalLockProjection(other.success);
}
if (other.isSetEx1()) {
this.ex1 = new CuratorException(other.ex1);
@@ -4049,11 +4049,11 @@ public class CuratorService {
this.ex1 = null;
}
- public LockProjection getSuccess() {
+ public OptionalLockProjection getSuccess() {
return this.success;
}
- public acquireLock_result setSuccess(LockProjection success) {
+ public acquireLock_result setSuccess(OptionalLockProjection success) {
this.success = success;
return this;
}
@@ -4103,7 +4103,7 @@ public class CuratorService {
if (value == null) {
unsetSuccess();
} else {
- setSuccess((LockProjection)value);
+ setSuccess((OptionalLockProjection)value);
}
break;
@@ -4295,7 +4295,7 @@ public class CuratorService {
switch (schemeField.id) {
case 0: // SUCCESS
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.success = new LockProjection();
+ struct.success = new OptionalLockProjection();
struct.success.read(iprot);
struct.setSuccessIsSet(true);
} else {
@@ -4374,7 +4374,7 @@ public class CuratorService {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(2);
if (incoming.get(0)) {
- struct.success = new LockProjection();
+ struct.success = new OptionalLockProjection();
struct.success.read(iprot);
struct.setSuccessIsSet(true);
}
http://git-wip-us.apache.org/repos/asf/curator/blob/8880417d/curator-x-rpc/src/test/java/org/apache/curator/generated/OptionalLockProjection.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/OptionalLockProjection.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/OptionalLockProjection.java
new file mode 100644
index 0000000..8e9c629
--- /dev/null
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/OptionalLockProjection.java
@@ -0,0 +1,393 @@
+/**
+ * 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 OptionalLockProjection implements org.apache.thrift.TBase<OptionalLockProjection, OptionalLockProjection._Fields>, java.io.Serializable, Cloneable, Comparable<OptionalLockProjection> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("OptionalLockProjection");
+
+ private static final org.apache.thrift.protocol.TField LOCK_PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("lockProjection", 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 OptionalLockProjectionStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new OptionalLockProjectionTupleSchemeFactory());
+ }
+
+ public LockProjection lockProjection; // 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 {
+ LOCK_PROJECTION((short)1, "lockProjection");
+
+ 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: // LOCK_PROJECTION
+ return LOCK_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.LOCK_PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("lockProjection", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, LockProjection.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(OptionalLockProjection.class, metaDataMap);
+ }
+
+ public OptionalLockProjection() {
+ }
+
+ public OptionalLockProjection(
+ LockProjection lockProjection)
+ {
+ this();
+ this.lockProjection = lockProjection;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public OptionalLockProjection(OptionalLockProjection other) {
+ if (other.isSetLockProjection()) {
+ this.lockProjection = new LockProjection(other.lockProjection);
+ }
+ }
+
+ public OptionalLockProjection deepCopy() {
+ return new OptionalLockProjection(this);
+ }
+
+ @Override
+ public void clear() {
+ this.lockProjection = null;
+ }
+
+ public LockProjection getLockProjection() {
+ return this.lockProjection;
+ }
+
+ public OptionalLockProjection setLockProjection(LockProjection lockProjection) {
+ this.lockProjection = lockProjection;
+ return this;
+ }
+
+ public void unsetLockProjection() {
+ this.lockProjection = null;
+ }
+
+ /** Returns true if field lockProjection is set (has been assigned a value) and false otherwise */
+ public boolean isSetLockProjection() {
+ return this.lockProjection != null;
+ }
+
+ public void setLockProjectionIsSet(boolean value) {
+ if (!value) {
+ this.lockProjection = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case LOCK_PROJECTION:
+ if (value == null) {
+ unsetLockProjection();
+ } else {
+ setLockProjection((LockProjection)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case LOCK_PROJECTION:
+ return getLockProjection();
+
+ }
+ 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 LOCK_PROJECTION:
+ return isSetLockProjection();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof OptionalLockProjection)
+ return this.equals((OptionalLockProjection)that);
+ return false;
+ }
+
+ public boolean equals(OptionalLockProjection that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_lockProjection = true && this.isSetLockProjection();
+ boolean that_present_lockProjection = true && that.isSetLockProjection();
+ if (this_present_lockProjection || that_present_lockProjection) {
+ if (!(this_present_lockProjection && that_present_lockProjection))
+ return false;
+ if (!this.lockProjection.equals(that.lockProjection))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public int compareTo(OptionalLockProjection other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = Boolean.valueOf(isSetLockProjection()).compareTo(other.isSetLockProjection());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetLockProjection()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lockProjection, other.lockProjection);
+ 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("OptionalLockProjection(");
+ boolean first = true;
+
+ sb.append("lockProjection:");
+ if (this.lockProjection == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.lockProjection);
+ }
+ 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 (lockProjection != null) {
+ lockProjection.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 OptionalLockProjectionStandardSchemeFactory implements SchemeFactory {
+ public OptionalLockProjectionStandardScheme getScheme() {
+ return new OptionalLockProjectionStandardScheme();
+ }
+ }
+
+ private static class OptionalLockProjectionStandardScheme extends StandardScheme<OptionalLockProjection> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, OptionalLockProjection 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: // LOCK_PROJECTION
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.lockProjection = new LockProjection();
+ struct.lockProjection.read(iprot);
+ struct.setLockProjectionIsSet(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, OptionalLockProjection struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.lockProjection != null) {
+ oprot.writeFieldBegin(LOCK_PROJECTION_FIELD_DESC);
+ struct.lockProjection.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class OptionalLockProjectionTupleSchemeFactory implements SchemeFactory {
+ public OptionalLockProjectionTupleScheme getScheme() {
+ return new OptionalLockProjectionTupleScheme();
+ }
+ }
+
+ private static class OptionalLockProjectionTupleScheme extends TupleScheme<OptionalLockProjection> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, OptionalLockProjection struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetLockProjection()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetLockProjection()) {
+ struct.lockProjection.write(oprot);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, OptionalLockProjection struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.lockProjection = new LockProjection();
+ struct.lockProjection.read(iprot);
+ struct.setLockProjectionIsSet(true);
+ }
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/curator/blob/8880417d/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/RpcTests.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/RpcTests.java b/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/RpcTests.java
index b1af720..a0e0a42 100644
--- a/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/RpcTests.java
+++ b/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/RpcTests.java
@@ -193,8 +193,8 @@ public class RpcTests extends BaseClassForTests
public Void call() throws Exception
{
CuratorProjection curatorProjection = client.newCuratorProjection("test");
- LockProjection lockProjection = client.acquireLock(curatorProjection, "/lock", timing.forWaiting().milliseconds());
- if ( lockProjection.id == null )
+ OptionalLockProjection lockProjection = client.acquireLock(curatorProjection, "/lock", timing.forWaiting().milliseconds());
+ if ( lockProjection.lockProjection == null )
{
throw new Exception("Could not acquire lock");
}
@@ -211,7 +211,7 @@ public class RpcTests extends BaseClassForTests
{
hasTheLock.set(false);
lockLatch.countDown();
- client.closeGenericProjection(curatorProjection, lockProjection.id);
+ client.closeGenericProjection(curatorProjection, lockProjection.lockProjection.id);
}
return null;
http://git-wip-us.apache.org/repos/asf/curator/blob/8880417d/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 db8bc13..e15351e 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
@@ -108,8 +108,8 @@ public class TestClient
ChildData pathChildrenCacheDataForPath = client.getPathChildrenCacheDataForPath(curatorProjection, pathChildrenCacheProjection, "/a/b/c");
System.out.println(pathChildrenCacheDataForPath);
- LockProjection lockId = client.acquireLock(curatorProjection, "/mylock", 1000);
- client.closeGenericProjection(curatorProjection, lockId.id);
+ OptionalLockProjection lockId = client.acquireLock(curatorProjection, "/mylock", 1000);
+ client.closeGenericProjection(curatorProjection, lockId.lockProjection.id);
GetDataSpec getDataSpec = new GetDataSpec();
getDataSpec.watched = true;