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/05/30 18:57:24 UTC
[1/3] initial stab at exception support
Repository: curator
Updated Branches:
refs/heads/curator-rpc 8bfaffd24 -> c6229cf2e
http://git-wip-us.apache.org/repos/asf/curator/blob/c6229cf2/curator-x-rpc/src/test/java/org/apache/curator/generated/EventService.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/EventService.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/EventService.java
index 3f9f332..9854e0e 100644
--- a/curator-x-rpc/src/test/java/org/apache/curator/generated/EventService.java
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/EventService.java
@@ -36,7 +36,7 @@ public class EventService {
public interface Iface {
- public CuratorEvent getNextEvent(CuratorProjection projection) throws org.apache.thrift.TException;
+ public CuratorEvent getNextEvent(CuratorProjection projection) throws CuratorException, org.apache.thrift.TException;
}
@@ -66,7 +66,7 @@ public class EventService {
super(iprot, oprot);
}
- public CuratorEvent getNextEvent(CuratorProjection projection) throws org.apache.thrift.TException
+ public CuratorEvent getNextEvent(CuratorProjection projection) throws CuratorException, org.apache.thrift.TException
{
send_getNextEvent(projection);
return recv_getNextEvent();
@@ -79,13 +79,16 @@ public class EventService {
sendBase("getNextEvent", args);
}
- public CuratorEvent recv_getNextEvent() throws org.apache.thrift.TException
+ public CuratorEvent recv_getNextEvent() throws CuratorException, org.apache.thrift.TException
{
getNextEvent_result result = new getNextEvent_result();
receiveBase(result, "getNextEvent");
if (result.isSetSuccess()) {
return result.success;
}
+ if (result.ex1 != null) {
+ throw result.ex1;
+ }
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getNextEvent failed: unknown result");
}
@@ -129,7 +132,7 @@ public class EventService {
prot.writeMessageEnd();
}
- public CuratorEvent getResult() throws org.apache.thrift.TException {
+ public CuratorEvent getResult() throws CuratorException, org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
@@ -171,7 +174,11 @@ public class EventService {
public getNextEvent_result getResult(I iface, getNextEvent_args args) throws org.apache.thrift.TException {
getNextEvent_result result = new getNextEvent_result();
- result.success = iface.getNextEvent(args.projection);
+ try {
+ result.success = iface.getNextEvent(args.projection);
+ } catch (CuratorException ex1) {
+ result.ex1 = ex1;
+ }
return result;
}
}
@@ -220,6 +227,12 @@ public class EventService {
byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
org.apache.thrift.TBase msg;
getNextEvent_result result = new getNextEvent_result();
+ if (e instanceof CuratorException) {
+ result.ex1 = (CuratorException) e;
+ result.setEx1IsSet(true);
+ msg = result;
+ }
+ else
{
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
@@ -609,6 +622,7 @@ public class EventService {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getNextEvent_result");
private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0);
+ private static final org.apache.thrift.protocol.TField EX1_FIELD_DESC = new org.apache.thrift.protocol.TField("ex1", org.apache.thrift.protocol.TType.STRUCT, (short)1);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
@@ -617,10 +631,12 @@ public class EventService {
}
public CuratorEvent success; // required
+ public CuratorException ex1; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- SUCCESS((short)0, "success");
+ SUCCESS((short)0, "success"),
+ EX1((short)1, "ex1");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
@@ -637,6 +653,8 @@ public class EventService {
switch(fieldId) {
case 0: // SUCCESS
return SUCCESS;
+ case 1: // EX1
+ return EX1;
default:
return null;
}
@@ -682,6 +700,8 @@ public class EventService {
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, CuratorEvent.class)));
+ tmpMap.put(_Fields.EX1, new org.apache.thrift.meta_data.FieldMetaData("ex1", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getNextEvent_result.class, metaDataMap);
}
@@ -690,10 +710,12 @@ public class EventService {
}
public getNextEvent_result(
- CuratorEvent success)
+ CuratorEvent success,
+ CuratorException ex1)
{
this();
this.success = success;
+ this.ex1 = ex1;
}
/**
@@ -703,6 +725,9 @@ public class EventService {
if (other.isSetSuccess()) {
this.success = new CuratorEvent(other.success);
}
+ if (other.isSetEx1()) {
+ this.ex1 = new CuratorException(other.ex1);
+ }
}
public getNextEvent_result deepCopy() {
@@ -712,6 +737,7 @@ public class EventService {
@Override
public void clear() {
this.success = null;
+ this.ex1 = null;
}
public CuratorEvent getSuccess() {
@@ -738,6 +764,30 @@ public class EventService {
}
}
+ public CuratorException getEx1() {
+ return this.ex1;
+ }
+
+ public getNextEvent_result setEx1(CuratorException ex1) {
+ this.ex1 = ex1;
+ return this;
+ }
+
+ public void unsetEx1() {
+ this.ex1 = null;
+ }
+
+ /** Returns true if field ex1 is set (has been assigned a value) and false otherwise */
+ public boolean isSetEx1() {
+ return this.ex1 != null;
+ }
+
+ public void setEx1IsSet(boolean value) {
+ if (!value) {
+ this.ex1 = null;
+ }
+ }
+
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case SUCCESS:
@@ -748,6 +798,14 @@ public class EventService {
}
break;
+ case EX1:
+ if (value == null) {
+ unsetEx1();
+ } else {
+ setEx1((CuratorException)value);
+ }
+ break;
+
}
}
@@ -756,6 +814,9 @@ public class EventService {
case SUCCESS:
return getSuccess();
+ case EX1:
+ return getEx1();
+
}
throw new IllegalStateException();
}
@@ -769,6 +830,8 @@ public class EventService {
switch (field) {
case SUCCESS:
return isSetSuccess();
+ case EX1:
+ return isSetEx1();
}
throw new IllegalStateException();
}
@@ -795,6 +858,15 @@ public class EventService {
return false;
}
+ boolean this_present_ex1 = true && this.isSetEx1();
+ boolean that_present_ex1 = true && that.isSetEx1();
+ if (this_present_ex1 || that_present_ex1) {
+ if (!(this_present_ex1 && that_present_ex1))
+ return false;
+ if (!this.ex1.equals(that.ex1))
+ return false;
+ }
+
return true;
}
@@ -821,6 +893,16 @@ public class EventService {
return lastComparison;
}
}
+ lastComparison = Boolean.valueOf(isSetEx1()).compareTo(other.isSetEx1());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetEx1()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ex1, other.ex1);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
return 0;
}
@@ -848,6 +930,14 @@ public class EventService {
sb.append(this.success);
}
first = false;
+ if (!first) sb.append(", ");
+ sb.append("ex1:");
+ if (this.ex1 == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.ex1);
+ }
+ first = false;
sb.append(")");
return sb.toString();
}
@@ -903,6 +993,15 @@ public class EventService {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
+ case 1: // EX1
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.ex1 = new CuratorException();
+ struct.ex1.read(iprot);
+ struct.setEx1IsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
@@ -923,6 +1022,11 @@ public class EventService {
struct.success.write(oprot);
oprot.writeFieldEnd();
}
+ if (struct.ex1 != null) {
+ oprot.writeFieldBegin(EX1_FIELD_DESC);
+ struct.ex1.write(oprot);
+ oprot.writeFieldEnd();
+ }
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@@ -944,21 +1048,32 @@ public class EventService {
if (struct.isSetSuccess()) {
optionals.set(0);
}
- oprot.writeBitSet(optionals, 1);
+ if (struct.isSetEx1()) {
+ optionals.set(1);
+ }
+ oprot.writeBitSet(optionals, 2);
if (struct.isSetSuccess()) {
struct.success.write(oprot);
}
+ if (struct.isSetEx1()) {
+ struct.ex1.write(oprot);
+ }
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, getNextEvent_result struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
- BitSet incoming = iprot.readBitSet(1);
+ BitSet incoming = iprot.readBitSet(2);
if (incoming.get(0)) {
struct.success = new CuratorEvent();
struct.success.read(iprot);
struct.setSuccessIsSet(true);
}
+ if (incoming.get(1)) {
+ struct.ex1 = new CuratorException();
+ struct.ex1.read(iprot);
+ struct.setEx1IsSet(true);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/curator/blob/c6229cf2/curator-x-rpc/src/test/java/org/apache/curator/generated/ExceptionType.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/ExceptionType.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/ExceptionType.java
new file mode 100644
index 0000000..b727f3a
--- /dev/null
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/ExceptionType.java
@@ -0,0 +1,48 @@
+/**
+ * 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 java.util.Map;
+import java.util.HashMap;
+import org.apache.thrift.TEnum;
+
+public enum ExceptionType implements org.apache.thrift.TEnum {
+ GENERAL(0),
+ ZOOKEEPER(1),
+ NODE(2);
+
+ private final int value;
+
+ private ExceptionType(int value) {
+ this.value = value;
+ }
+
+ /**
+ * Get the integer value of this enum value, as defined in the Thrift IDL.
+ */
+ public int getValue() {
+ return value;
+ }
+
+ /**
+ * Find a the enum type by its integer value, as defined in the Thrift IDL.
+ * @return null if the value is not found.
+ */
+ public static ExceptionType findByValue(int value) {
+ switch (value) {
+ case 0:
+ return GENERAL;
+ case 1:
+ return ZOOKEEPER;
+ case 2:
+ return NODE;
+ default:
+ return null;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/curator/blob/c6229cf2/curator-x-rpc/src/test/java/org/apache/curator/generated/NodeExceptionType.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/NodeExceptionType.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/NodeExceptionType.java
new file mode 100644
index 0000000..fb2a989
--- /dev/null
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/NodeExceptionType.java
@@ -0,0 +1,51 @@
+/**
+ * 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 java.util.Map;
+import java.util.HashMap;
+import org.apache.thrift.TEnum;
+
+public enum NodeExceptionType implements org.apache.thrift.TEnum {
+ NONODE(0),
+ BADVERSION(1),
+ NODEEXISTS(2),
+ NOTEMPTY(3);
+
+ private final int value;
+
+ private NodeExceptionType(int value) {
+ this.value = value;
+ }
+
+ /**
+ * Get the integer value of this enum value, as defined in the Thrift IDL.
+ */
+ public int getValue() {
+ return value;
+ }
+
+ /**
+ * Find a the enum type by its integer value, as defined in the Thrift IDL.
+ * @return null if the value is not found.
+ */
+ public static NodeExceptionType findByValue(int value) {
+ switch (value) {
+ case 0:
+ return NONODE;
+ case 1:
+ return BADVERSION;
+ case 2:
+ return NODEEXISTS;
+ case 3:
+ return NOTEMPTY;
+ default:
+ return null;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/curator/blob/c6229cf2/curator-x-rpc/src/test/java/org/apache/curator/generated/ZooKeeperExceptionType.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/ZooKeeperExceptionType.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/ZooKeeperExceptionType.java
new file mode 100644
index 0000000..2514d30
--- /dev/null
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/ZooKeeperExceptionType.java
@@ -0,0 +1,90 @@
+/**
+ * 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 java.util.Map;
+import java.util.HashMap;
+import org.apache.thrift.TEnum;
+
+public enum ZooKeeperExceptionType implements org.apache.thrift.TEnum {
+ SYSTEMERROR(0),
+ RUNTIMEINCONSISTENCY(1),
+ DATAINCONSISTENCY(2),
+ CONNECTIONLOSS(3),
+ MARSHALLINGERROR(4),
+ UNIMPLEMENTED(5),
+ OPERATIONTIMEOUT(6),
+ BADARGUMENTS(7),
+ APIERROR(8),
+ NOAUTH(9),
+ NOCHILDRENFOREPHEMERALS(10),
+ INVALIDACL(11),
+ AUTHFAILED(12),
+ SESSIONEXPIRED(13),
+ INVALIDCALLBACK(14),
+ SESSIONMOVED(15),
+ NOTREADONLY(16);
+
+ private final int value;
+
+ private ZooKeeperExceptionType(int value) {
+ this.value = value;
+ }
+
+ /**
+ * Get the integer value of this enum value, as defined in the Thrift IDL.
+ */
+ public int getValue() {
+ return value;
+ }
+
+ /**
+ * Find a the enum type by its integer value, as defined in the Thrift IDL.
+ * @return null if the value is not found.
+ */
+ public static ZooKeeperExceptionType findByValue(int value) {
+ switch (value) {
+ case 0:
+ return SYSTEMERROR;
+ case 1:
+ return RUNTIMEINCONSISTENCY;
+ case 2:
+ return DATAINCONSISTENCY;
+ case 3:
+ return CONNECTIONLOSS;
+ case 4:
+ return MARSHALLINGERROR;
+ case 5:
+ return UNIMPLEMENTED;
+ case 6:
+ return OPERATIONTIMEOUT;
+ case 7:
+ return BADARGUMENTS;
+ case 8:
+ return APIERROR;
+ case 9:
+ return NOAUTH;
+ case 10:
+ return NOCHILDRENFOREPHEMERALS;
+ case 11:
+ return INVALIDACL;
+ case 12:
+ return AUTHFAILED;
+ case 13:
+ return SESSIONEXPIRED;
+ case 14:
+ return INVALIDCALLBACK;
+ case 15:
+ return SESSIONMOVED;
+ case 16:
+ return NOTREADONLY;
+ default:
+ return null;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/curator/blob/c6229cf2/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 5e1451e..dbd5643 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
@@ -68,6 +68,18 @@ public class TestClient
);
CreateSpec createSpec = new CreateSpec();
+ createSpec.path = "/this/should/fail";
+ createSpec.data = ByteBuffer.wrap("hey".getBytes());
+ try
+ {
+ client.createNode(curatorProjection, createSpec);
+ }
+ catch ( CuratorException e )
+ {
+ System.out.println("Ex: " + e);
+ }
+
+ createSpec = new CreateSpec();
createSpec.path = "/a/b/c";
createSpec.creatingParentsIfNeeded = true;
createSpec.data = ByteBuffer.wrap("hey".getBytes());
[2/3] initial stab at exception support
Posted by ra...@apache.org.
http://git-wip-us.apache.org/repos/asf/curator/blob/c6229cf2/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 ecc0457..e944176 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,47 +36,47 @@ public class CuratorService {
public interface Iface {
- public LockProjection acquireLock(CuratorProjection projection, String path, int maxWaitMs) throws org.apache.thrift.TException;
+ public LockProjection acquireLock(CuratorProjection projection, String path, int maxWaitMs) throws CuratorException, org.apache.thrift.TException;
public void closeCuratorProjection(CuratorProjection projection) throws org.apache.thrift.TException;
- public boolean closeGenericProjection(CuratorProjection curatorProjection, String id) throws org.apache.thrift.TException;
+ public boolean closeGenericProjection(CuratorProjection projection, String id) throws CuratorException, org.apache.thrift.TException;
- public OptionalPath createNode(CuratorProjection projection, CreateSpec spec) throws org.apache.thrift.TException;
+ public OptionalPath createNode(CuratorProjection projection, CreateSpec spec) throws CuratorException, org.apache.thrift.TException;
- public void deleteNode(CuratorProjection projection, DeleteSpec spec) throws org.apache.thrift.TException;
+ public void deleteNode(CuratorProjection projection, DeleteSpec spec) throws CuratorException, org.apache.thrift.TException;
- public OptionalStat exists(CuratorProjection projection, ExistsSpec spec) throws org.apache.thrift.TException;
+ public OptionalStat exists(CuratorProjection projection, ExistsSpec spec) throws CuratorException, org.apache.thrift.TException;
- public OptionalChildrenList getChildren(CuratorProjection projection, GetChildrenSpec spec) throws org.apache.thrift.TException;
+ public OptionalChildrenList getChildren(CuratorProjection projection, GetChildrenSpec spec) throws CuratorException, org.apache.thrift.TException;
- public ByteBuffer getData(CuratorProjection projection, GetDataSpec spec) throws org.apache.thrift.TException;
+ public ByteBuffer getData(CuratorProjection projection, GetDataSpec spec) throws CuratorException, org.apache.thrift.TException;
- public List<Participant> getLeaderParticipants(CuratorProjection projection, LeaderProjection leaderProjection) throws org.apache.thrift.TException;
+ public List<Participant> getLeaderParticipants(CuratorProjection projection, LeaderProjection leaderProjection) throws CuratorException, org.apache.thrift.TException;
- public ChildData getNodeCacheData(CuratorProjection projection, NodeCacheProjection cacheProjection) throws org.apache.thrift.TException;
+ public ChildData getNodeCacheData(CuratorProjection projection, NodeCacheProjection cacheProjection) throws CuratorException, org.apache.thrift.TException;
- public List<ChildData> getPathChildrenCacheData(CuratorProjection projection, PathChildrenCacheProjection cacheProjection) throws org.apache.thrift.TException;
+ public List<ChildData> getPathChildrenCacheData(CuratorProjection projection, PathChildrenCacheProjection cacheProjection) throws CuratorException, org.apache.thrift.TException;
- public ChildData getPathChildrenCacheDataForPath(CuratorProjection projection, PathChildrenCacheProjection cacheProjection, String path) throws org.apache.thrift.TException;
+ public ChildData getPathChildrenCacheDataForPath(CuratorProjection projection, PathChildrenCacheProjection cacheProjection, String path) throws CuratorException, org.apache.thrift.TException;
- public boolean isLeader(CuratorProjection projection, LeaderProjection leaderProjection) throws org.apache.thrift.TException;
+ public boolean isLeader(CuratorProjection projection, LeaderProjection leaderProjection) throws CuratorException, org.apache.thrift.TException;
public CuratorProjection newCuratorProjection(String connectionName) throws org.apache.thrift.TException;
public void pingCuratorProjection(CuratorProjection projection) throws org.apache.thrift.TException;
- public Stat setData(CuratorProjection projection, SetDataSpec spec) throws org.apache.thrift.TException;
+ public Stat setData(CuratorProjection projection, SetDataSpec spec) throws CuratorException, org.apache.thrift.TException;
- public LeaderResult startLeaderSelector(CuratorProjection projection, String path, String participantId, int waitForLeadershipMs) throws org.apache.thrift.TException;
+ public LeaderResult startLeaderSelector(CuratorProjection projection, String path, String participantId, int waitForLeadershipMs) throws CuratorException, org.apache.thrift.TException;
- public NodeCacheProjection startNodeCache(CuratorProjection projection, String path, boolean dataIsCompressed, boolean buildInitial) throws org.apache.thrift.TException;
+ public NodeCacheProjection startNodeCache(CuratorProjection projection, String path, boolean dataIsCompressed, boolean buildInitial) throws CuratorException, org.apache.thrift.TException;
- public PathChildrenCacheProjection startPathChildrenCache(CuratorProjection projection, String path, boolean cacheData, boolean dataIsCompressed, PathChildrenCacheStartMode startMode) throws org.apache.thrift.TException;
+ public PathChildrenCacheProjection startPathChildrenCache(CuratorProjection projection, String path, boolean cacheData, boolean dataIsCompressed, PathChildrenCacheStartMode startMode) throws CuratorException, org.apache.thrift.TException;
- public PersistentEphemeralNodeProjection startPersistentEphemeralNode(CuratorProjection projection, String path, ByteBuffer data, PersistentEphemeralNodeMode mode) throws org.apache.thrift.TException;
+ public PersistentEphemeralNodeProjection startPersistentEphemeralNode(CuratorProjection projection, String path, ByteBuffer data, PersistentEphemeralNodeMode mode) throws CuratorException, org.apache.thrift.TException;
- public List<LeaseProjection> startSemaphore(CuratorProjection projection, String path, int acquireQty, int maxWaitMs, int maxLeases) throws org.apache.thrift.TException;
+ public List<LeaseProjection> startSemaphore(CuratorProjection projection, String path, int acquireQty, int maxWaitMs, int maxLeases) throws CuratorException, org.apache.thrift.TException;
}
@@ -86,7 +86,7 @@ public class CuratorService {
public void closeCuratorProjection(CuratorProjection projection, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
- public void closeGenericProjection(CuratorProjection curatorProjection, String id, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void closeGenericProjection(CuratorProjection projection, String id, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
public void createNode(CuratorProjection projection, CreateSpec spec, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
@@ -146,7 +146,7 @@ public class CuratorService {
super(iprot, oprot);
}
- public LockProjection acquireLock(CuratorProjection projection, String path, int maxWaitMs) throws org.apache.thrift.TException
+ public LockProjection acquireLock(CuratorProjection projection, String path, int maxWaitMs) throws CuratorException, org.apache.thrift.TException
{
send_acquireLock(projection, path, maxWaitMs);
return recv_acquireLock();
@@ -161,13 +161,16 @@ public class CuratorService {
sendBase("acquireLock", args);
}
- public LockProjection recv_acquireLock() throws org.apache.thrift.TException
+ public LockProjection recv_acquireLock() throws CuratorException, org.apache.thrift.TException
{
acquireLock_result result = new acquireLock_result();
receiveBase(result, "acquireLock");
if (result.isSetSuccess()) {
return result.success;
}
+ if (result.ex1 != null) {
+ throw result.ex1;
+ }
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "acquireLock failed: unknown result");
}
@@ -183,31 +186,34 @@ public class CuratorService {
sendBase("closeCuratorProjection", args);
}
- public boolean closeGenericProjection(CuratorProjection curatorProjection, String id) throws org.apache.thrift.TException
+ public boolean closeGenericProjection(CuratorProjection projection, String id) throws CuratorException, org.apache.thrift.TException
{
- send_closeGenericProjection(curatorProjection, id);
+ send_closeGenericProjection(projection, id);
return recv_closeGenericProjection();
}
- public void send_closeGenericProjection(CuratorProjection curatorProjection, String id) throws org.apache.thrift.TException
+ public void send_closeGenericProjection(CuratorProjection projection, String id) throws org.apache.thrift.TException
{
closeGenericProjection_args args = new closeGenericProjection_args();
- args.setCuratorProjection(curatorProjection);
+ args.setProjection(projection);
args.setId(id);
sendBase("closeGenericProjection", args);
}
- public boolean recv_closeGenericProjection() throws org.apache.thrift.TException
+ public boolean recv_closeGenericProjection() throws CuratorException, org.apache.thrift.TException
{
closeGenericProjection_result result = new closeGenericProjection_result();
receiveBase(result, "closeGenericProjection");
if (result.isSetSuccess()) {
return result.success;
}
+ if (result.ex1 != null) {
+ throw result.ex1;
+ }
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "closeGenericProjection failed: unknown result");
}
- public OptionalPath createNode(CuratorProjection projection, CreateSpec spec) throws org.apache.thrift.TException
+ public OptionalPath createNode(CuratorProjection projection, CreateSpec spec) throws CuratorException, org.apache.thrift.TException
{
send_createNode(projection, spec);
return recv_createNode();
@@ -221,17 +227,20 @@ public class CuratorService {
sendBase("createNode", args);
}
- public OptionalPath recv_createNode() throws org.apache.thrift.TException
+ public OptionalPath recv_createNode() throws CuratorException, org.apache.thrift.TException
{
createNode_result result = new createNode_result();
receiveBase(result, "createNode");
if (result.isSetSuccess()) {
return result.success;
}
+ if (result.ex1 != null) {
+ throw result.ex1;
+ }
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "createNode failed: unknown result");
}
- public void deleteNode(CuratorProjection projection, DeleteSpec spec) throws org.apache.thrift.TException
+ public void deleteNode(CuratorProjection projection, DeleteSpec spec) throws CuratorException, org.apache.thrift.TException
{
send_deleteNode(projection, spec);
recv_deleteNode();
@@ -245,14 +254,17 @@ public class CuratorService {
sendBase("deleteNode", args);
}
- public void recv_deleteNode() throws org.apache.thrift.TException
+ public void recv_deleteNode() throws CuratorException, org.apache.thrift.TException
{
deleteNode_result result = new deleteNode_result();
receiveBase(result, "deleteNode");
+ if (result.ex1 != null) {
+ throw result.ex1;
+ }
return;
}
- public OptionalStat exists(CuratorProjection projection, ExistsSpec spec) throws org.apache.thrift.TException
+ public OptionalStat exists(CuratorProjection projection, ExistsSpec spec) throws CuratorException, org.apache.thrift.TException
{
send_exists(projection, spec);
return recv_exists();
@@ -266,17 +278,20 @@ public class CuratorService {
sendBase("exists", args);
}
- public OptionalStat recv_exists() throws org.apache.thrift.TException
+ public OptionalStat recv_exists() throws CuratorException, org.apache.thrift.TException
{
exists_result result = new exists_result();
receiveBase(result, "exists");
if (result.isSetSuccess()) {
return result.success;
}
+ if (result.ex1 != null) {
+ throw result.ex1;
+ }
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "exists failed: unknown result");
}
- public OptionalChildrenList getChildren(CuratorProjection projection, GetChildrenSpec spec) throws org.apache.thrift.TException
+ public OptionalChildrenList getChildren(CuratorProjection projection, GetChildrenSpec spec) throws CuratorException, org.apache.thrift.TException
{
send_getChildren(projection, spec);
return recv_getChildren();
@@ -290,17 +305,20 @@ public class CuratorService {
sendBase("getChildren", args);
}
- public OptionalChildrenList recv_getChildren() throws org.apache.thrift.TException
+ public OptionalChildrenList recv_getChildren() throws CuratorException, org.apache.thrift.TException
{
getChildren_result result = new getChildren_result();
receiveBase(result, "getChildren");
if (result.isSetSuccess()) {
return result.success;
}
+ if (result.ex1 != null) {
+ throw result.ex1;
+ }
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getChildren failed: unknown result");
}
- public ByteBuffer getData(CuratorProjection projection, GetDataSpec spec) throws org.apache.thrift.TException
+ public ByteBuffer getData(CuratorProjection projection, GetDataSpec spec) throws CuratorException, org.apache.thrift.TException
{
send_getData(projection, spec);
return recv_getData();
@@ -314,17 +332,20 @@ public class CuratorService {
sendBase("getData", args);
}
- public ByteBuffer recv_getData() throws org.apache.thrift.TException
+ public ByteBuffer recv_getData() throws CuratorException, org.apache.thrift.TException
{
getData_result result = new getData_result();
receiveBase(result, "getData");
if (result.isSetSuccess()) {
return result.success;
}
+ if (result.ex1 != null) {
+ throw result.ex1;
+ }
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getData failed: unknown result");
}
- public List<Participant> getLeaderParticipants(CuratorProjection projection, LeaderProjection leaderProjection) throws org.apache.thrift.TException
+ public List<Participant> getLeaderParticipants(CuratorProjection projection, LeaderProjection leaderProjection) throws CuratorException, org.apache.thrift.TException
{
send_getLeaderParticipants(projection, leaderProjection);
return recv_getLeaderParticipants();
@@ -338,17 +359,20 @@ public class CuratorService {
sendBase("getLeaderParticipants", args);
}
- public List<Participant> recv_getLeaderParticipants() throws org.apache.thrift.TException
+ public List<Participant> recv_getLeaderParticipants() throws CuratorException, org.apache.thrift.TException
{
getLeaderParticipants_result result = new getLeaderParticipants_result();
receiveBase(result, "getLeaderParticipants");
if (result.isSetSuccess()) {
return result.success;
}
+ if (result.ex1 != null) {
+ throw result.ex1;
+ }
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getLeaderParticipants failed: unknown result");
}
- public ChildData getNodeCacheData(CuratorProjection projection, NodeCacheProjection cacheProjection) throws org.apache.thrift.TException
+ public ChildData getNodeCacheData(CuratorProjection projection, NodeCacheProjection cacheProjection) throws CuratorException, org.apache.thrift.TException
{
send_getNodeCacheData(projection, cacheProjection);
return recv_getNodeCacheData();
@@ -362,17 +386,20 @@ public class CuratorService {
sendBase("getNodeCacheData", args);
}
- public ChildData recv_getNodeCacheData() throws org.apache.thrift.TException
+ public ChildData recv_getNodeCacheData() throws CuratorException, org.apache.thrift.TException
{
getNodeCacheData_result result = new getNodeCacheData_result();
receiveBase(result, "getNodeCacheData");
if (result.isSetSuccess()) {
return result.success;
}
+ if (result.ex1 != null) {
+ throw result.ex1;
+ }
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getNodeCacheData failed: unknown result");
}
- public List<ChildData> getPathChildrenCacheData(CuratorProjection projection, PathChildrenCacheProjection cacheProjection) throws org.apache.thrift.TException
+ public List<ChildData> getPathChildrenCacheData(CuratorProjection projection, PathChildrenCacheProjection cacheProjection) throws CuratorException, org.apache.thrift.TException
{
send_getPathChildrenCacheData(projection, cacheProjection);
return recv_getPathChildrenCacheData();
@@ -386,17 +413,20 @@ public class CuratorService {
sendBase("getPathChildrenCacheData", args);
}
- public List<ChildData> recv_getPathChildrenCacheData() throws org.apache.thrift.TException
+ public List<ChildData> recv_getPathChildrenCacheData() throws CuratorException, org.apache.thrift.TException
{
getPathChildrenCacheData_result result = new getPathChildrenCacheData_result();
receiveBase(result, "getPathChildrenCacheData");
if (result.isSetSuccess()) {
return result.success;
}
+ if (result.ex1 != null) {
+ throw result.ex1;
+ }
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getPathChildrenCacheData failed: unknown result");
}
- public ChildData getPathChildrenCacheDataForPath(CuratorProjection projection, PathChildrenCacheProjection cacheProjection, String path) throws org.apache.thrift.TException
+ public ChildData getPathChildrenCacheDataForPath(CuratorProjection projection, PathChildrenCacheProjection cacheProjection, String path) throws CuratorException, org.apache.thrift.TException
{
send_getPathChildrenCacheDataForPath(projection, cacheProjection, path);
return recv_getPathChildrenCacheDataForPath();
@@ -411,17 +441,20 @@ public class CuratorService {
sendBase("getPathChildrenCacheDataForPath", args);
}
- public ChildData recv_getPathChildrenCacheDataForPath() throws org.apache.thrift.TException
+ public ChildData recv_getPathChildrenCacheDataForPath() throws CuratorException, org.apache.thrift.TException
{
getPathChildrenCacheDataForPath_result result = new getPathChildrenCacheDataForPath_result();
receiveBase(result, "getPathChildrenCacheDataForPath");
if (result.isSetSuccess()) {
return result.success;
}
+ if (result.ex1 != null) {
+ throw result.ex1;
+ }
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getPathChildrenCacheDataForPath failed: unknown result");
}
- public boolean isLeader(CuratorProjection projection, LeaderProjection leaderProjection) throws org.apache.thrift.TException
+ public boolean isLeader(CuratorProjection projection, LeaderProjection leaderProjection) throws CuratorException, org.apache.thrift.TException
{
send_isLeader(projection, leaderProjection);
return recv_isLeader();
@@ -435,13 +468,16 @@ public class CuratorService {
sendBase("isLeader", args);
}
- public boolean recv_isLeader() throws org.apache.thrift.TException
+ public boolean recv_isLeader() throws CuratorException, org.apache.thrift.TException
{
isLeader_result result = new isLeader_result();
receiveBase(result, "isLeader");
if (result.isSetSuccess()) {
return result.success;
}
+ if (result.ex1 != null) {
+ throw result.ex1;
+ }
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "isLeader failed: unknown result");
}
@@ -480,7 +516,7 @@ public class CuratorService {
sendBase("pingCuratorProjection", args);
}
- public Stat setData(CuratorProjection projection, SetDataSpec spec) throws org.apache.thrift.TException
+ public Stat setData(CuratorProjection projection, SetDataSpec spec) throws CuratorException, org.apache.thrift.TException
{
send_setData(projection, spec);
return recv_setData();
@@ -494,17 +530,20 @@ public class CuratorService {
sendBase("setData", args);
}
- public Stat recv_setData() throws org.apache.thrift.TException
+ public Stat recv_setData() throws CuratorException, org.apache.thrift.TException
{
setData_result result = new setData_result();
receiveBase(result, "setData");
if (result.isSetSuccess()) {
return result.success;
}
+ if (result.ex1 != null) {
+ throw result.ex1;
+ }
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "setData failed: unknown result");
}
- public LeaderResult startLeaderSelector(CuratorProjection projection, String path, String participantId, int waitForLeadershipMs) throws org.apache.thrift.TException
+ public LeaderResult startLeaderSelector(CuratorProjection projection, String path, String participantId, int waitForLeadershipMs) throws CuratorException, org.apache.thrift.TException
{
send_startLeaderSelector(projection, path, participantId, waitForLeadershipMs);
return recv_startLeaderSelector();
@@ -520,17 +559,20 @@ public class CuratorService {
sendBase("startLeaderSelector", args);
}
- public LeaderResult recv_startLeaderSelector() throws org.apache.thrift.TException
+ public LeaderResult recv_startLeaderSelector() throws CuratorException, org.apache.thrift.TException
{
startLeaderSelector_result result = new startLeaderSelector_result();
receiveBase(result, "startLeaderSelector");
if (result.isSetSuccess()) {
return result.success;
}
+ if (result.ex1 != null) {
+ throw result.ex1;
+ }
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "startLeaderSelector failed: unknown result");
}
- public NodeCacheProjection startNodeCache(CuratorProjection projection, String path, boolean dataIsCompressed, boolean buildInitial) throws org.apache.thrift.TException
+ public NodeCacheProjection startNodeCache(CuratorProjection projection, String path, boolean dataIsCompressed, boolean buildInitial) throws CuratorException, org.apache.thrift.TException
{
send_startNodeCache(projection, path, dataIsCompressed, buildInitial);
return recv_startNodeCache();
@@ -546,17 +588,20 @@ public class CuratorService {
sendBase("startNodeCache", args);
}
- public NodeCacheProjection recv_startNodeCache() throws org.apache.thrift.TException
+ public NodeCacheProjection recv_startNodeCache() throws CuratorException, org.apache.thrift.TException
{
startNodeCache_result result = new startNodeCache_result();
receiveBase(result, "startNodeCache");
if (result.isSetSuccess()) {
return result.success;
}
+ if (result.ex1 != null) {
+ throw result.ex1;
+ }
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "startNodeCache failed: unknown result");
}
- public PathChildrenCacheProjection startPathChildrenCache(CuratorProjection projection, String path, boolean cacheData, boolean dataIsCompressed, PathChildrenCacheStartMode startMode) throws org.apache.thrift.TException
+ public PathChildrenCacheProjection startPathChildrenCache(CuratorProjection projection, String path, boolean cacheData, boolean dataIsCompressed, PathChildrenCacheStartMode startMode) throws CuratorException, org.apache.thrift.TException
{
send_startPathChildrenCache(projection, path, cacheData, dataIsCompressed, startMode);
return recv_startPathChildrenCache();
@@ -573,17 +618,20 @@ public class CuratorService {
sendBase("startPathChildrenCache", args);
}
- public PathChildrenCacheProjection recv_startPathChildrenCache() throws org.apache.thrift.TException
+ public PathChildrenCacheProjection recv_startPathChildrenCache() throws CuratorException, org.apache.thrift.TException
{
startPathChildrenCache_result result = new startPathChildrenCache_result();
receiveBase(result, "startPathChildrenCache");
if (result.isSetSuccess()) {
return result.success;
}
+ if (result.ex1 != null) {
+ throw result.ex1;
+ }
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "startPathChildrenCache failed: unknown result");
}
- public PersistentEphemeralNodeProjection startPersistentEphemeralNode(CuratorProjection projection, String path, ByteBuffer data, PersistentEphemeralNodeMode mode) throws org.apache.thrift.TException
+ public PersistentEphemeralNodeProjection startPersistentEphemeralNode(CuratorProjection projection, String path, ByteBuffer data, PersistentEphemeralNodeMode mode) throws CuratorException, org.apache.thrift.TException
{
send_startPersistentEphemeralNode(projection, path, data, mode);
return recv_startPersistentEphemeralNode();
@@ -599,17 +647,20 @@ public class CuratorService {
sendBase("startPersistentEphemeralNode", args);
}
- public PersistentEphemeralNodeProjection recv_startPersistentEphemeralNode() throws org.apache.thrift.TException
+ public PersistentEphemeralNodeProjection recv_startPersistentEphemeralNode() throws CuratorException, org.apache.thrift.TException
{
startPersistentEphemeralNode_result result = new startPersistentEphemeralNode_result();
receiveBase(result, "startPersistentEphemeralNode");
if (result.isSetSuccess()) {
return result.success;
}
+ if (result.ex1 != null) {
+ throw result.ex1;
+ }
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "startPersistentEphemeralNode failed: unknown result");
}
- public List<LeaseProjection> startSemaphore(CuratorProjection projection, String path, int acquireQty, int maxWaitMs, int maxLeases) throws org.apache.thrift.TException
+ public List<LeaseProjection> startSemaphore(CuratorProjection projection, String path, int acquireQty, int maxWaitMs, int maxLeases) throws CuratorException, org.apache.thrift.TException
{
send_startSemaphore(projection, path, acquireQty, maxWaitMs, maxLeases);
return recv_startSemaphore();
@@ -626,13 +677,16 @@ public class CuratorService {
sendBase("startSemaphore", args);
}
- public List<LeaseProjection> recv_startSemaphore() throws org.apache.thrift.TException
+ public List<LeaseProjection> recv_startSemaphore() throws CuratorException, org.apache.thrift.TException
{
startSemaphore_result result = new startSemaphore_result();
receiveBase(result, "startSemaphore");
if (result.isSetSuccess()) {
return result.success;
}
+ if (result.ex1 != null) {
+ throw result.ex1;
+ }
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "startSemaphore failed: unknown result");
}
@@ -682,7 +736,7 @@ public class CuratorService {
prot.writeMessageEnd();
}
- public LockProjection getResult() throws org.apache.thrift.TException {
+ public LockProjection getResult() throws CuratorException, org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
@@ -723,32 +777,32 @@ public class CuratorService {
}
}
- public void closeGenericProjection(CuratorProjection curatorProjection, String id, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ public void closeGenericProjection(CuratorProjection projection, String id, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
checkReady();
- closeGenericProjection_call method_call = new closeGenericProjection_call(curatorProjection, id, resultHandler, this, ___protocolFactory, ___transport);
+ closeGenericProjection_call method_call = new closeGenericProjection_call(projection, id, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
public static class closeGenericProjection_call extends org.apache.thrift.async.TAsyncMethodCall {
- private CuratorProjection curatorProjection;
+ private CuratorProjection projection;
private String id;
- public closeGenericProjection_call(CuratorProjection curatorProjection, String id, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ public closeGenericProjection_call(CuratorProjection projection, String id, 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.curatorProjection = curatorProjection;
+ this.projection = projection;
this.id = id;
}
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("closeGenericProjection", org.apache.thrift.protocol.TMessageType.CALL, 0));
closeGenericProjection_args args = new closeGenericProjection_args();
- args.setCuratorProjection(curatorProjection);
+ args.setProjection(projection);
args.setId(id);
args.write(prot);
prot.writeMessageEnd();
}
- public boolean getResult() throws org.apache.thrift.TException {
+ public boolean getResult() throws CuratorException, org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
@@ -783,7 +837,7 @@ public class CuratorService {
prot.writeMessageEnd();
}
- public OptionalPath getResult() throws org.apache.thrift.TException {
+ public OptionalPath getResult() throws CuratorException, org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
@@ -818,7 +872,7 @@ public class CuratorService {
prot.writeMessageEnd();
}
- public void getResult() throws org.apache.thrift.TException {
+ public void getResult() throws CuratorException, org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
@@ -853,7 +907,7 @@ public class CuratorService {
prot.writeMessageEnd();
}
- public OptionalStat getResult() throws org.apache.thrift.TException {
+ public OptionalStat getResult() throws CuratorException, org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
@@ -888,7 +942,7 @@ public class CuratorService {
prot.writeMessageEnd();
}
- public OptionalChildrenList getResult() throws org.apache.thrift.TException {
+ public OptionalChildrenList getResult() throws CuratorException, org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
@@ -923,7 +977,7 @@ public class CuratorService {
prot.writeMessageEnd();
}
- public ByteBuffer getResult() throws org.apache.thrift.TException {
+ public ByteBuffer getResult() throws CuratorException, org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
@@ -958,7 +1012,7 @@ public class CuratorService {
prot.writeMessageEnd();
}
- public List<Participant> getResult() throws org.apache.thrift.TException {
+ public List<Participant> getResult() throws CuratorException, org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
@@ -993,7 +1047,7 @@ public class CuratorService {
prot.writeMessageEnd();
}
- public ChildData getResult() throws org.apache.thrift.TException {
+ public ChildData getResult() throws CuratorException, org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
@@ -1028,7 +1082,7 @@ public class CuratorService {
prot.writeMessageEnd();
}
- public List<ChildData> getResult() throws org.apache.thrift.TException {
+ public List<ChildData> getResult() throws CuratorException, org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
@@ -1066,7 +1120,7 @@ public class CuratorService {
prot.writeMessageEnd();
}
- public ChildData getResult() throws org.apache.thrift.TException {
+ public ChildData getResult() throws CuratorException, org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
@@ -1101,7 +1155,7 @@ public class CuratorService {
prot.writeMessageEnd();
}
- public boolean getResult() throws org.apache.thrift.TException {
+ public boolean getResult() throws CuratorException, org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
@@ -1199,7 +1253,7 @@ public class CuratorService {
prot.writeMessageEnd();
}
- public Stat getResult() throws org.apache.thrift.TException {
+ public Stat getResult() throws CuratorException, org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
@@ -1240,7 +1294,7 @@ public class CuratorService {
prot.writeMessageEnd();
}
- public LeaderResult getResult() throws org.apache.thrift.TException {
+ public LeaderResult getResult() throws CuratorException, org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
@@ -1281,7 +1335,7 @@ public class CuratorService {
prot.writeMessageEnd();
}
- public NodeCacheProjection getResult() throws org.apache.thrift.TException {
+ public NodeCacheProjection getResult() throws CuratorException, org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
@@ -1325,7 +1379,7 @@ public class CuratorService {
prot.writeMessageEnd();
}
- public PathChildrenCacheProjection getResult() throws org.apache.thrift.TException {
+ public PathChildrenCacheProjection getResult() throws CuratorException, org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
@@ -1366,7 +1420,7 @@ public class CuratorService {
prot.writeMessageEnd();
}
- public PersistentEphemeralNodeProjection getResult() throws org.apache.thrift.TException {
+ public PersistentEphemeralNodeProjection getResult() throws CuratorException, org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
@@ -1410,7 +1464,7 @@ public class CuratorService {
prot.writeMessageEnd();
}
- public List<LeaseProjection> getResult() throws org.apache.thrift.TException {
+ public List<LeaseProjection> getResult() throws CuratorException, org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
@@ -1472,7 +1526,11 @@ public class CuratorService {
public acquireLock_result getResult(I iface, acquireLock_args args) throws org.apache.thrift.TException {
acquireLock_result result = new acquireLock_result();
- result.success = iface.acquireLock(args.projection, args.path, args.maxWaitMs);
+ try {
+ result.success = iface.acquireLock(args.projection, args.path, args.maxWaitMs);
+ } catch (CuratorException ex1) {
+ result.ex1 = ex1;
+ }
return result;
}
}
@@ -1511,8 +1569,12 @@ public class CuratorService {
public closeGenericProjection_result getResult(I iface, closeGenericProjection_args args) throws org.apache.thrift.TException {
closeGenericProjection_result result = new closeGenericProjection_result();
- result.success = iface.closeGenericProjection(args.curatorProjection, args.id);
- result.setSuccessIsSet(true);
+ try {
+ result.success = iface.closeGenericProjection(args.projection, args.id);
+ result.setSuccessIsSet(true);
+ } catch (CuratorException ex1) {
+ result.ex1 = ex1;
+ }
return result;
}
}
@@ -1532,7 +1594,11 @@ public class CuratorService {
public createNode_result getResult(I iface, createNode_args args) throws org.apache.thrift.TException {
createNode_result result = new createNode_result();
- result.success = iface.createNode(args.projection, args.spec);
+ try {
+ result.success = iface.createNode(args.projection, args.spec);
+ } catch (CuratorException ex1) {
+ result.ex1 = ex1;
+ }
return result;
}
}
@@ -1552,7 +1618,11 @@ public class CuratorService {
public deleteNode_result getResult(I iface, deleteNode_args args) throws org.apache.thrift.TException {
deleteNode_result result = new deleteNode_result();
- iface.deleteNode(args.projection, args.spec);
+ try {
+ iface.deleteNode(args.projection, args.spec);
+ } catch (CuratorException ex1) {
+ result.ex1 = ex1;
+ }
return result;
}
}
@@ -1572,7 +1642,11 @@ public class CuratorService {
public exists_result getResult(I iface, exists_args args) throws org.apache.thrift.TException {
exists_result result = new exists_result();
- result.success = iface.exists(args.projection, args.spec);
+ try {
+ result.success = iface.exists(args.projection, args.spec);
+ } catch (CuratorException ex1) {
+ result.ex1 = ex1;
+ }
return result;
}
}
@@ -1592,7 +1666,11 @@ public class CuratorService {
public getChildren_result getResult(I iface, getChildren_args args) throws org.apache.thrift.TException {
getChildren_result result = new getChildren_result();
- result.success = iface.getChildren(args.projection, args.spec);
+ try {
+ result.success = iface.getChildren(args.projection, args.spec);
+ } catch (CuratorException ex1) {
+ result.ex1 = ex1;
+ }
return result;
}
}
@@ -1612,7 +1690,11 @@ public class CuratorService {
public getData_result getResult(I iface, getData_args args) throws org.apache.thrift.TException {
getData_result result = new getData_result();
- result.success = iface.getData(args.projection, args.spec);
+ try {
+ result.success = iface.getData(args.projection, args.spec);
+ } catch (CuratorException ex1) {
+ result.ex1 = ex1;
+ }
return result;
}
}
@@ -1632,7 +1714,11 @@ public class CuratorService {
public getLeaderParticipants_result getResult(I iface, getLeaderParticipants_args args) throws org.apache.thrift.TException {
getLeaderParticipants_result result = new getLeaderParticipants_result();
- result.success = iface.getLeaderParticipants(args.projection, args.leaderProjection);
+ try {
+ result.success = iface.getLeaderParticipants(args.projection, args.leaderProjection);
+ } catch (CuratorException ex1) {
+ result.ex1 = ex1;
+ }
return result;
}
}
@@ -1652,7 +1738,11 @@ public class CuratorService {
public getNodeCacheData_result getResult(I iface, getNodeCacheData_args args) throws org.apache.thrift.TException {
getNodeCacheData_result result = new getNodeCacheData_result();
- result.success = iface.getNodeCacheData(args.projection, args.cacheProjection);
+ try {
+ result.success = iface.getNodeCacheData(args.projection, args.cacheProjection);
+ } catch (CuratorException ex1) {
+ result.ex1 = ex1;
+ }
return result;
}
}
@@ -1672,7 +1762,11 @@ public class CuratorService {
public getPathChildrenCacheData_result getResult(I iface, getPathChildrenCacheData_args args) throws org.apache.thrift.TException {
getPathChildrenCacheData_result result = new getPathChildrenCacheData_result();
- result.success = iface.getPathChildrenCacheData(args.projection, args.cacheProjection);
+ try {
+ result.success = iface.getPathChildrenCacheData(args.projection, args.cacheProjection);
+ } catch (CuratorException ex1) {
+ result.ex1 = ex1;
+ }
return result;
}
}
@@ -1692,7 +1786,11 @@ public class CuratorService {
public getPathChildrenCacheDataForPath_result getResult(I iface, getPathChildrenCacheDataForPath_args args) throws org.apache.thrift.TException {
getPathChildrenCacheDataForPath_result result = new getPathChildrenCacheDataForPath_result();
- result.success = iface.getPathChildrenCacheDataForPath(args.projection, args.cacheProjection, args.path);
+ try {
+ result.success = iface.getPathChildrenCacheDataForPath(args.projection, args.cacheProjection, args.path);
+ } catch (CuratorException ex1) {
+ result.ex1 = ex1;
+ }
return result;
}
}
@@ -1712,8 +1810,12 @@ public class CuratorService {
public isLeader_result getResult(I iface, isLeader_args args) throws org.apache.thrift.TException {
isLeader_result result = new isLeader_result();
- result.success = iface.isLeader(args.projection, args.leaderProjection);
- result.setSuccessIsSet(true);
+ try {
+ result.success = iface.isLeader(args.projection, args.leaderProjection);
+ result.setSuccessIsSet(true);
+ } catch (CuratorException ex1) {
+ result.ex1 = ex1;
+ }
return result;
}
}
@@ -1772,7 +1874,11 @@ public class CuratorService {
public setData_result getResult(I iface, setData_args args) throws org.apache.thrift.TException {
setData_result result = new setData_result();
- result.success = iface.setData(args.projection, args.spec);
+ try {
+ result.success = iface.setData(args.projection, args.spec);
+ } catch (CuratorException ex1) {
+ result.ex1 = ex1;
+ }
return result;
}
}
@@ -1792,7 +1898,11 @@ public class CuratorService {
public startLeaderSelector_result getResult(I iface, startLeaderSelector_args args) throws org.apache.thrift.TException {
startLeaderSelector_result result = new startLeaderSelector_result();
- result.success = iface.startLeaderSelector(args.projection, args.path, args.participantId, args.waitForLeadershipMs);
+ try {
+ result.success = iface.startLeaderSelector(args.projection, args.path, args.participantId, args.waitForLeadershipMs);
+ } catch (CuratorException ex1) {
+ result.ex1 = ex1;
+ }
return result;
}
}
@@ -1812,7 +1922,11 @@ public class CuratorService {
public startNodeCache_result getResult(I iface, startNodeCache_args args) throws org.apache.thrift.TException {
startNodeCache_result result = new startNodeCache_result();
- result.success = iface.startNodeCache(args.projection, args.path, args.dataIsCompressed, args.buildInitial);
+ try {
+ result.success = iface.startNodeCache(args.projection, args.path, args.dataIsCompressed, args.buildInitial);
+ } catch (CuratorException ex1) {
+ result.ex1 = ex1;
+ }
return result;
}
}
@@ -1832,7 +1946,11 @@ public class CuratorService {
public startPathChildrenCache_result getResult(I iface, startPathChildrenCache_args args) throws org.apache.thrift.TException {
startPathChildrenCache_result result = new startPathChildrenCache_result();
- result.success = iface.startPathChildrenCache(args.projection, args.path, args.cacheData, args.dataIsCompressed, args.startMode);
+ try {
+ result.success = iface.startPathChildrenCache(args.projection, args.path, args.cacheData, args.dataIsCompressed, args.startMode);
+ } catch (CuratorException ex1) {
+ result.ex1 = ex1;
+ }
return result;
}
}
@@ -1852,7 +1970,11 @@ public class CuratorService {
public startPersistentEphemeralNode_result getResult(I iface, startPersistentEphemeralNode_args args) throws org.apache.thrift.TException {
startPersistentEphemeralNode_result result = new startPersistentEphemeralNode_result();
- result.success = iface.startPersistentEphemeralNode(args.projection, args.path, args.data, args.mode);
+ try {
+ result.success = iface.startPersistentEphemeralNode(args.projection, args.path, args.data, args.mode);
+ } catch (CuratorException ex1) {
+ result.ex1 = ex1;
+ }
return result;
}
}
@@ -1872,7 +1994,11 @@ public class CuratorService {
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);
+ try {
+ result.success = iface.startSemaphore(args.projection, args.path, args.acquireQty, args.maxWaitMs, args.maxLeases);
+ } catch (CuratorException ex1) {
+ result.ex1 = ex1;
+ }
return result;
}
}
@@ -1941,6 +2067,12 @@ public class CuratorService {
byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
org.apache.thrift.TBase msg;
acquireLock_result result = new acquireLock_result();
+ if (e instanceof CuratorException) {
+ result.ex1 = (CuratorException) e;
+ result.setEx1IsSet(true);
+ msg = result;
+ }
+ else
{
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
@@ -2021,6 +2153,12 @@ public class CuratorService {
byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
org.apache.thrift.TBase msg;
closeGenericProjection_result result = new closeGenericProjection_result();
+ if (e instanceof CuratorException) {
+ result.ex1 = (CuratorException) e;
+ result.setEx1IsSet(true);
+ msg = result;
+ }
+ else
{
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
@@ -2041,7 +2179,7 @@ public class CuratorService {
}
public void start(I iface, closeGenericProjection_args args, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws TException {
- iface.closeGenericProjection(args.curatorProjection, args.id,resultHandler);
+ iface.closeGenericProjection(args.projection, args.id,resultHandler);
}
}
@@ -2072,6 +2210,12 @@ public class CuratorService {
byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
org.apache.thrift.TBase msg;
createNode_result result = new createNode_result();
+ if (e instanceof CuratorException) {
+ result.ex1 = (CuratorException) e;
+ result.setEx1IsSet(true);
+ msg = result;
+ }
+ else
{
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
@@ -2122,6 +2266,12 @@ public class CuratorService {
byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
org.apache.thrift.TBase msg;
deleteNode_result result = new deleteNode_result();
+ if (e instanceof CuratorException) {
+ result.ex1 = (CuratorException) e;
+ result.setEx1IsSet(true);
+ msg = result;
+ }
+ else
{
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
@@ -2173,6 +2323,12 @@ public class CuratorService {
byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
org.apache.thrift.TBase msg;
exists_result result = new exists_result();
+ if (e instanceof CuratorException) {
+ result.ex1 = (CuratorException) e;
+ result.setEx1IsSet(true);
+ msg = result;
+ }
+ else
{
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
@@ -2224,6 +2380,12 @@ public class CuratorService {
byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
org.apache.thrift.TBase msg;
getChildren_result result = new getChildren_result();
+ if (e instanceof CuratorException) {
+ result.ex1 = (CuratorException) e;
+ result.setEx1IsSet(true);
+ msg = result;
+ }
+ else
{
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
@@ -2275,6 +2437,12 @@ public class CuratorService {
byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
org.apache.thrift.TBase msg;
getData_result result = new getData_result();
+ if (e instanceof CuratorException) {
+ result.ex1 = (CuratorException) e;
+ result.setEx1IsSet(true);
+ msg = result;
+ }
+ else
{
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
@@ -2326,6 +2494,12 @@ public class CuratorService {
byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
org.apache.thrift.TBase msg;
getLeaderParticipants_result result = new getLeaderParticipants_result();
+ if (e instanceof CuratorException) {
+ result.ex1 = (CuratorException) e;
+ result.setEx1IsSet(true);
+ msg = result;
+ }
+ else
{
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
@@ -2377,6 +2551,12 @@ public class CuratorService {
byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
org.apache.thrift.TBase msg;
getNodeCacheData_result result = new getNodeCacheData_result();
+ if (e instanceof CuratorException) {
+ result.ex1 = (CuratorException) e;
+ result.setEx1IsSet(true);
+ msg = result;
+ }
+ else
{
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
@@ -2428,6 +2608,12 @@ public class CuratorService {
byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
org.apache.thrift.TBase msg;
getPathChildrenCacheData_result result = new getPathChildrenCacheData_result();
+ if (e instanceof CuratorException) {
+ result.ex1 = (CuratorException) e;
+ result.setEx1IsSet(true);
+ msg = result;
+ }
+ else
{
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
@@ -2479,6 +2665,12 @@ public class CuratorService {
byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
org.apache.thrift.TBase msg;
getPathChildrenCacheDataForPath_result result = new getPathChildrenCacheDataForPath_result();
+ if (e instanceof CuratorException) {
+ result.ex1 = (CuratorException) e;
+ result.setEx1IsSet(true);
+ msg = result;
+ }
+ else
{
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
@@ -2531,6 +2723,12 @@ public class CuratorService {
byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
org.apache.thrift.TBase msg;
isLeader_result result = new isLeader_result();
+ if (e instanceof CuratorException) {
+ result.ex1 = (CuratorException) e;
+ result.setEx1IsSet(true);
+ msg = result;
+ }
+ else
{
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
@@ -2661,6 +2859,12 @@ public class CuratorService {
byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
org.apache.thrift.TBase msg;
setData_result result = new setData_result();
+ if (e instanceof CuratorException) {
+ result.ex1 = (CuratorException) e;
+ result.setEx1IsSet(true);
+ msg = result;
+ }
+ else
{
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
@@ -2712,6 +2916,12 @@ public class CuratorService {
byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
org.apache.thrift.TBase msg;
startLeaderSelector_result result = new startLeaderSelector_result();
+ if (e instanceof CuratorException) {
+ result.ex1 = (CuratorException) e;
+ result.setEx1IsSet(true);
+ msg = result;
+ }
+ else
{
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
@@ -2763,6 +2973,12 @@ public class CuratorService {
byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
org.apache.thrift.TBase msg;
startNodeCache_result result = new startNodeCache_result();
+ if (e instanceof CuratorException) {
+ result.ex1 = (CuratorException) e;
+ result.setEx1IsSet(true);
+ msg = result;
+ }
+ else
{
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
@@ -2814,6 +3030,12 @@ public class CuratorService {
byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
org.apache.thrift.TBase msg;
startPathChildrenCache_result result = new startPathChildrenCache_result();
+ if (e instanceof CuratorException) {
+ result.ex1 = (CuratorException) e;
+ result.setEx1IsSet(true);
+ msg = result;
+ }
+ else
{
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
@@ -2865,6 +3087,12 @@ public class CuratorService {
byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
org.apache.thrift.TBase msg;
startPersistentEphemeralNode_result result = new startPersistentEphemeralNode_result();
+ if (e instanceof CuratorException) {
+ result.ex1 = (CuratorException) e;
+ result.setEx1IsSet(true);
+ msg = result;
+ }
+ else
{
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
@@ -2916,6 +3144,12 @@ public class CuratorService {
byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
org.apache.thrift.TBase msg;
startSemaphore_result result = new startSemaphore_result();
+ if (e instanceof CuratorException) {
+ result.ex1 = (CuratorException) e;
+ result.setEx1IsSet(true);
+ msg = result;
+ }
+ else
{
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
@@ -3503,6 +3737,7 @@ public class CuratorService {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("acquireLock_result");
private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0);
+ private static final org.apache.thrift.protocol.TField EX1_FIELD_DESC = new org.apache.thrift.protocol.TField("ex1", org.apache.thrift.protocol.TType.STRUCT, (short)1);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
@@ -3511,10 +3746,12 @@ public class CuratorService {
}
public LockProjection success; // required
+ public CuratorException ex1; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- SUCCESS((short)0, "success");
+ SUCCESS((short)0, "success"),
+ EX1((short)1, "ex1");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
@@ -3531,6 +3768,8 @@ public class CuratorService {
switch(fieldId) {
case 0: // SUCCESS
return SUCCESS;
+ case 1: // EX1
+ return EX1;
default:
return null;
}
@@ -3576,6 +3815,8 @@ public class CuratorService {
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)));
+ tmpMap.put(_Fields.EX1, new org.apache.thrift.meta_data.FieldMetaData("ex1", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(acquireLock_result.class, metaDataMap);
}
@@ -3584,10 +3825,12 @@ public class CuratorService {
}
public acquireLock_result(
- LockProjection success)
+ LockProjection success,
+ CuratorException ex1)
{
this();
this.success = success;
+ this.ex1 = ex1;
}
/**
@@ -3597,6 +3840,9 @@ public class CuratorService {
if (other.isSetSuccess()) {
this.success = new LockProjection(other.success);
}
+ if (other.isSetEx1()) {
+ this.ex1 = new CuratorException(other.ex1);
+ }
}
public acquireLock_result deepCopy() {
@@ -3606,6 +3852,7 @@ public class CuratorService {
@Override
public void clear() {
this.success = null;
+ this.ex1 = null;
}
public LockProjection getSuccess() {
@@ -3632,6 +3879,30 @@ public class CuratorService {
}
}
+ public CuratorException getEx1() {
+ return this.ex1;
+ }
+
+ public acquireLock_result setEx1(CuratorException ex1) {
+ this.ex1 = ex1;
+ return this;
+ }
+
+ public void unsetEx1() {
+ this.ex1 = null;
+ }
+
+ /** Returns true if field ex1 is set (has been assigned a value) and false otherwise */
+ public boolean isSetEx1() {
+ return this.ex1 != null;
+ }
+
+ public void setEx1IsSet(boolean value) {
+ if (!value) {
+ this.ex1 = null;
+ }
+ }
+
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case SUCCESS:
@@ -3642,6 +3913,14 @@ public class CuratorService {
}
break;
+ case EX1:
+ if (value == null) {
+ unsetEx1();
+ } else {
+ setEx1((CuratorException)value);
+ }
+ break;
+
}
}
@@ -3650,6 +3929,9 @@ public class CuratorService {
case SUCCESS:
return getSuccess();
+ case EX1:
+ return getEx1();
+
}
throw new IllegalStateException();
}
@@ -3663,6 +3945,8 @@ public class CuratorService {
switch (field) {
case SUCCESS:
return isSetSuccess();
+ case EX1:
+ return isSetEx1();
}
throw new IllegalStateException();
}
@@ -3689,6 +3973,15 @@ public class CuratorService {
return false;
}
+ boolean this_present_ex1 = true && this.isSetEx1();
+ boolean that_present_ex1 = true && that.isSetEx1();
+ if (this_present_ex1 || that_present_ex1) {
+ if (!(this_present_ex1 && that_present_ex1))
+ return false;
+ if (!this.ex1.equals(that.ex1))
+ return false;
+ }
+
return true;
}
@@ -3715,6 +4008,16 @@ public class CuratorService {
return lastComparison;
}
}
+ lastComparison = Boolean.valueOf(isSetEx1()).compareTo(other.isSetEx1());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetEx1()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ex1, other.ex1);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
return 0;
}
@@ -3742,6 +4045,14 @@ public class CuratorService {
sb.append(this.success);
}
first = false;
+ if (!first) sb.append(", ");
+ sb.append("ex1:");
+ if (this.ex1 == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.ex1);
+ }
+ first = false;
sb.append(")");
return sb.toString();
}
@@ -3797,6 +4108,15 @@ public class CuratorService {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
+ case 1: // EX1
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.ex1 = new CuratorException();
+ struct.ex1.read(iprot);
+ struct.setEx1IsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
@@ -3817,6 +4137,11 @@ public class CuratorService {
struct.success.write(oprot);
oprot.writeFieldEnd();
}
+ if (struct.ex1 != null) {
+ oprot.writeFieldBegin(EX1_FIELD_DESC);
+ struct.ex1.write(oprot);
+ oprot.writeFieldEnd();
+ }
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@@ -3838,21 +4163,32 @@ public class CuratorService {
if (struct.isSetSuccess()) {
optionals.set(0);
}
- oprot.writeBitSet(optionals, 1);
+ if (struct.isSetEx1()) {
+ optionals.set(1);
+ }
+ oprot.writeBitSet(optionals, 2);
if (struct.isSetSuccess()) {
struct.success.write(oprot);
}
+ if (struct.isSetEx1()) {
+ struct.ex1.write(oprot);
+ }
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, acquireLock_result struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
- BitSet incoming = iprot.readBitSet(1);
+ BitSet incoming = iprot.readBitSet(2);
if (incoming.get(0)) {
struct.success = new LockProjection();
struct.success.read(iprot);
struct.setSuccessIsSet(true);
}
+ if (incoming.get(1)) {
+ struct.ex1 = new CuratorException();
+ struct.ex1.read(iprot);
+ struct.setEx1IsSet(true);
+ }
}
}
@@ -4220,7 +4556,7 @@ public class CuratorService {
public static class closeGenericProjection_args implements org.apache.thrift.TBase<closeGenericProjection_args, closeGenericProjection_args._Fields>, java.io.Serializable, Cloneable, Comparable<closeGenericProjection_args> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("closeGenericProjection_args");
- private static final org.apache.thrift.protocol.TField CURATOR_PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("curatorProjection", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+ 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 ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.STRING, (short)2);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
@@ -4229,12 +4565,12 @@ public class CuratorService {
schemes.put(TupleScheme.class, new closeGenericProjection_argsTupleSchemeFactory());
}
- public CuratorProjection curatorProjection; // required
+ public CuratorProjection projection; // required
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 {
- CURATOR_PROJECTION((short)1, "curatorProjection"),
+ PROJECTION((short)1, "projection"),
ID((short)2, "id");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
@@ -4250,8 +4586,8 @@ public class CuratorService {
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
- case 1: // CURATOR_PROJECTION
- return CURATOR_PROJECTION;
+ case 1: // PROJECTION
+ return PROJECTION;
case 2: // ID
return ID;
default:
@@ -4297,7 +4633,7 @@ public class CuratorService {
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.CURATOR_PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("curatorProjection", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ 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.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)));
@@ -4309,11 +4645,11 @@ public class CuratorService {
}
public closeGenericProjection_args(
- CuratorProjection curatorProjection,
+ CuratorProjection projection,
String id)
{
this();
- this.curatorProjection = curatorProjection;
+ this.projection = projection;
this.id = id;
}
@@ -4321,8 +4657,8 @@ public class CuratorService {
* Performs a deep copy on <i>other</i>.
*/
public closeGenericProjection_args(closeGenericProjection_args other) {
- if (other.isSetCuratorProjection()) {
- this.curatorProjection = new CuratorProjection(other.curatorProjection);
+ if (other.isSetProjection()) {
+ this.projection = new CuratorProjection(other.projection);
}
if (other.isSetId()) {
this.id = other.id;
@@ -4335,31 +4671,31 @@ public class CuratorService {
@Override
public void clear() {
- this.curatorProjection = null;
+ this.projection = null;
this.id = null;
}
- public CuratorProjection getCuratorProjection() {
- return this.curatorProjection;
+ public CuratorProjection getProjection() {
+ return this.projection;
}
- public closeGenericProjection_args setCuratorProjection(CuratorProjection curatorProjection) {
- this.curatorProjection = curatorProjection;
+ public closeGenericProjection_args setProjection(CuratorProjection projection) {
+ this.projection = projection;
return this;
}
- public void unsetCuratorProjection() {
- this.curatorProjection = null;
+ public void unsetProjection() {
+ this.projection = null;
}
- /** Returns true if field curatorProjection is set (has been assigned a value) and false otherwise */
- public boolean isSetCuratorProjection() {
- return this.curatorProjection != 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 setCuratorProjectionIsSet(boolean value) {
+ public void setProjectionIsSet(boolean value) {
if (!value) {
- this.curatorProjection = null;
+ this.projection = null;
}
}
@@ -4389,11 +4725,11 @@ public class CuratorService {
public void setFieldValue(_Fields field, Object value) {
switch (field) {
- case CURATOR_PROJECTION:
+ case PROJECTION:
if (value == null) {
- unsetCuratorProjection();
+ unsetProjection();
} else {
- setCuratorProjection((CuratorProjection)value);
+ setProjection((CuratorProjection)value);
}
break;
@@ -4410,8 +4746,8 @@ public class CuratorService {
public Object getFieldValue(_Fields field) {
switch (field) {
- case CURATOR_PROJECTION:
- return getCuratorProjection();
+ case PROJECTION:
+ return getProjection();
case ID:
return getId();
@@ -4427,8 +4763,8 @@ public class CuratorService {
}
switch (field) {
- case CURATOR_PROJECTION:
- return isSetCuratorProjection();
+ case PROJECTION:
+ return isSetProjection();
case ID:
return isSetId();
}
@@ -4448,12 +4784,12 @@ public class CuratorService {
if (that == null)
return false;
- boolean this_present_curatorProjection = true && this.isSetCuratorProjection();
- boolean that_present_curatorProjection = true && that.isSetCuratorProjection();
- if (this_present_curatorProjection || that_present_curatorProjection) {
- if (!(this_present_curatorProjection && that_present_curatorProjection))
+ 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.curatorProjection.equals(that.curatorProjection))
+ if (!this.projection.equals(that.projection))
return false;
}
@@ -4482,12 +4818,12 @@ public class CuratorService {
int lastComparison = 0;
- lastComparison = Boolean.valueOf(isSetCuratorProjection()).compareTo(other.isSetCuratorProjection());
+ lastComparison = Boolean.valueOf(isSetProjection()).compareTo(other.isSetProjection());
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetCuratorProjection()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.curatorProjection, other.curatorProjection);
+ if (isSetProjection()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.projection, other.projection);
if (lastComparison != 0) {
return lastComparison;
}
@@ -4522,11 +4858,11 @@ public class CuratorService {
StringBuilder sb = new StringBuilder("closeGenericProjection_args(");
boolean first = true;
- sb.append("curatorProjection:");
- if (this.curatorProjection == null) {
+ sb.append("projection:");
+ if (this.projection == null) {
sb.append("null");
} else {
- sb.append(this.curatorProjection);
+ sb.append(this.projection);
}
first = false;
if (!first) sb.append(", ");
@@ -4544,8 +4880,8 @@ public class CuratorService {
public void validate() throws org.apache.thrift.TException {
// check for required fields
// check for sub-struct validity
- if (curatorProjection != null) {
- curatorProjection.validate();
+ if (projection != null) {
+ projection.validate();
}
}
@@ -4583,11 +4919,11 @@ public class CuratorService {
break;
}
switch (schemeField.id) {
- case 1: // CURATOR_PROJECTION
+ case 1: // PROJECTION
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.curatorProjection = new CuratorProjection();
- struct.curatorProjection.read(iprot);
- struct.setCuratorProjectionIsSet(true);
+ struct.projection = new CuratorProjection();
+ struct.projection.read(iprot);
+ struct.setProjectionIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
@@ -4615,9 +4951,9 @@ public class CuratorService {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
- if (struct.curatorProjection != null) {
- oprot.writeFieldBegin(CURATOR_PROJECTION_FIELD_DESC);
- struct.curatorProjection.write(oprot);
+ if (struct.projection != null) {
+ oprot.writeFieldBegin(PROJECTION_FIELD_DESC);
+ struct.projection.write(oprot);
oprot.writeFieldEnd();
}
if (struct.id != null) {
@@ -4643,15 +4979,15 @@ public class CuratorService {
public void write(org.apache.thrift.protocol.TProtocol prot, closeGenericProjection_args struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
- if (struct.isSetCuratorProjection()) {
+ if (struct.isSetProjection()) {
optionals.set(0);
}
if (struct.isSetId()) {
optionals.set(1);
}
oprot.writeBitSet(optionals, 2);
- if (struct.isSetCuratorProjection()) {
- struct.curatorProjection.write(oprot);
+ if (struct.isSetProjection()) {
+ struct.projection.write(oprot);
}
if (struct.isSetId()) {
oprot.writeString(struct.id);
@@ -4663,9 +4999,9 @@ public class CuratorService {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(2);
if (incoming.get(0)) {
- struct.curatorProjection = new CuratorProjection();
- struct.curatorProjection.read(iprot);
- struct.setCuratorProjectionIsSet(true);
+ struct.projection = new CuratorProjection();
+ struct.projection.read(iprot);
+ struct.setProjectionIsSet(true);
}
if (incoming.get(1)) {
struct.id = iprot.readString();
@@ -4680,6 +5016,7 @@ public class CuratorService {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("closeGenericProjection_result");
private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.BOOL, (short)0);
+ private static final org.apache.thrift.protocol.TField EX1_FIELD_DESC = new org.apache.thrift.protocol.TField("ex1", org.apache.thrift.protocol.TType.STRUCT, (short)1);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
@@ -4688,10 +5025,12 @@ public class CuratorService {
}
public boolean success; // required
+ public CuratorException ex1; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- SUCCESS((short)0, "success");
+ SUCCESS((short)0, "success"),
+ EX1((short)1, "ex1");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
@@ -4708,6 +5047,8 @@ public class CuratorService {
switch(fieldId) {
case 0: // SUCCESS
return SUCCESS;
+ case 1: // EX1
+ return EX1;
default:
return null;
}
@@ -4755,6 +5096,8 @@ public class CuratorService {
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.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
+ tmpMap.put(_Fields.EX1, new org.apache.thrift.meta_data.FieldMetaData("ex1", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(closeGenericProjection_result.class, metaDataMap);
}
@@ -4763,11 +5106,13 @@ public class CuratorService {
}
public closeGenericProjection_result(
- boolean success)
+ boolean success,
+ CuratorException ex1)
{
this();
this.success = success;
setSuccessIsSet(true);
+ this.ex1 = ex1;
}
/**
@@ -4776,6 +5121,9 @@ public class CuratorService {
public closeGenericProjection_result(closeGenericProjection_result other) {
__isset_bitfield = other.__isset_bitfield;
this.success = other.success;
+ if (other.isSetEx1()) {
+ this.ex1 = new CuratorException(other.ex1);
+ }
}
public closeGenericProjection_result deepCopy() {
@@ -4786,6 +5134,7 @@ public class CuratorService {
public void clear() {
setSuccessIsSet(false);
this.success = false;
+ this.ex1 = null;
}
public boolean isSuccess() {
@@ -4811,6 +5160,30 @@ public class CuratorService {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value);
}
+ public CuratorException getEx1() {
+ return this.ex1;
+ }
+
+ public closeGenericProjection_result setEx1(CuratorException ex1) {
+ this.ex1 = ex1;
+ return this;
+ }
+
+ public void unsetEx1() {
+ this.ex1 = null;
+ }
+
+ /** Returns true if field ex1 is set (has been assigned a value) and false otherwise */
+ public boolean isSetEx1() {
+ return this.ex1 != null;
+ }
+
+ public void setEx1IsSet(boolean value) {
+ if (!value) {
+ this.ex1 = null;
+ }
+ }
+
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case SUCCESS:
@@ -4821,6 +5194,14 @@ public class CuratorService {
}
break;
+ case EX1:
+ if (value == null) {
+ unsetEx1();
+ } else {
+ setEx1((CuratorException)value);
+ }
+ break;
+
}
}
@@ -4829,6 +5210,9 @@ public class CuratorService {
case SUCCESS:
return Boolean.valueOf(isSuccess());
+ case EX1:
+ return getEx1();
+
}
throw new IllegalStateException();
}
@@ -4842,6 +5226,8 @@ public class CuratorService {
switch (field) {
case SUCCESS:
return isSetSuccess();
+ case EX1:
+ return isSetEx1();
}
throw new IllegalStateException();
}
@@ -4868,6 +5254,15 @@ public class CuratorService {
return false;
}
+ boolean this_present_ex1 = true && this.isSetEx1();
+ boolean that_present_ex1 = true && that.isSetEx1();
+ if (this_present_ex1 || that_present_ex1) {
+ if (!(this_present_ex1 && that_present_ex1))
+ return false;
+ if (!this.ex1.equals(that.ex1))
+ return false;
+ }
+
return true;
}
@@ -4894,6 +5289,16 @@ public class CuratorService {
return lastComparison;
}
}
+ lastComparison = Boolean.valueOf(isSetEx1()).compareTo(other.isSetEx1());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetEx1()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ex1, other.ex1);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
return 0;
}
@@ -4917,6 +5322,14 @@ public class CuratorService {
sb.append("success:");
sb.append(this.success);
first = false;
+ if (!first) sb.append(", ");
+ sb.append("ex1:");
+ if (this.ex1 == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.ex1);
+ }
+ first = false;
sb.append(")");
return sb.toString();
}
@@ -4970,6 +5383,15 @@ public class CuratorService {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
+ case 1: // EX1
+ if (schemeField.type == org.apache.thr
<TRUNCATED>
[3/3] git commit: initial stab at exception support
Posted by ra...@apache.org.
initial stab at exception support
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/c6229cf2
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/c6229cf2
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/c6229cf2
Branch: refs/heads/curator-rpc
Commit: c6229cf2e09424fc57944397c7186fea2db9a1a4
Parents: 8bfaffd
Author: randgalt <ra...@apache.org>
Authored: Fri May 30 11:57:17 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Fri May 30 11:57:17 2014 -0500
----------------------------------------------------------------------
.../x/rpc/connections/ConnectionManager.java | 3 +-
.../curator/x/rpc/connections/CuratorEntry.java | 14 +
.../x/rpc/idl/exceptions/ExceptionType.java | 8 +
.../x/rpc/idl/exceptions/NodeExceptionType.java | 9 +
.../x/rpc/idl/exceptions/RpcException.java | 80 +
.../idl/exceptions/ZooKeeperExceptionType.java | 22 +
.../idl/services/CuratorProjectionService.java | 718 +++--
.../x/rpc/idl/services/EventService.java | 17 +-
curator-x-rpc/src/main/scripts/generate.sh | 2 +-
curator-x-rpc/src/main/thrift/curator.thrift | 57 +-
.../curator/generated/CuratorException.java | 736 +++++
.../curator/generated/CuratorService.java | 2546 ++++++++++++++++--
.../apache/curator/generated/EventService.java | 133 +-
.../apache/curator/generated/ExceptionType.java | 48 +
.../curator/generated/NodeExceptionType.java | 51 +
.../generated/ZooKeeperExceptionType.java | 90 +
.../org/apache/curator/x/rpc/TestClient.java | 12 +
17 files changed, 3976 insertions(+), 570 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/c6229cf2/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/connections/ConnectionManager.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/connections/ConnectionManager.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/connections/ConnectionManager.java
index 21fe762..5ee65f4 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/connections/ConnectionManager.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/connections/ConnectionManager.java
@@ -89,8 +89,7 @@ public class ConnectionManager implements Closeable
public CuratorFramework newConnection(String name)
{
ConnectionConfiguration configuration = connections.get(name);
- Preconditions.checkNotNull(configuration, "No connection configuration with that name was found: " + name);
- return configuration.build();
+ return (configuration != null) ? configuration.build() : null;
}
public void add(String id, CuratorFramework client)
http://git-wip-us.apache.org/repos/asf/curator/blob/c6229cf2/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 d5a6d8a..9e57c6f 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
@@ -3,6 +3,10 @@ package org.apache.curator.x.rpc.connections;
import com.google.common.collect.Maps;
import com.google.common.collect.Queues;
import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.api.CuratorEvent;
+import org.apache.curator.x.rpc.idl.exceptions.ExceptionType;
+import org.apache.curator.x.rpc.idl.exceptions.RpcException;
+import org.apache.curator.x.rpc.idl.structs.CuratorProjection;
import org.apache.curator.x.rpc.idl.structs.RpcCuratorEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -82,6 +86,16 @@ public class CuratorEntry implements Closeable
}
}
+ public static CuratorEntry mustGetEntry(ConnectionManager connectionManager, CuratorProjection projection) throws RpcException
+ {
+ CuratorEntry entry = connectionManager.get(projection.id);
+ if ( entry == null )
+ {
+ throw new RpcException(ExceptionType.GENERAL, null, null, "No CuratorProjection found with the id: " + projection.id);
+ }
+ return entry;
+ }
+
public CuratorFramework getClient()
{
return (state.get() == State.OPEN) ? client : null;
http://git-wip-us.apache.org/repos/asf/curator/blob/c6229cf2/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/exceptions/ExceptionType.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/exceptions/ExceptionType.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/exceptions/ExceptionType.java
new file mode 100644
index 0000000..4879c61
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/exceptions/ExceptionType.java
@@ -0,0 +1,8 @@
+package org.apache.curator.x.rpc.idl.exceptions;
+
+public enum ExceptionType
+{
+ GENERAL,
+ ZOOKEEPER,
+ NODE
+}
http://git-wip-us.apache.org/repos/asf/curator/blob/c6229cf2/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/exceptions/NodeExceptionType.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/exceptions/NodeExceptionType.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/exceptions/NodeExceptionType.java
new file mode 100644
index 0000000..4ad2488
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/exceptions/NodeExceptionType.java
@@ -0,0 +1,9 @@
+package org.apache.curator.x.rpc.idl.exceptions;
+
+public enum NodeExceptionType
+{
+ NONODE,
+ BADVERSION,
+ NODEEXISTS,
+ NOTEMPTY
+}
http://git-wip-us.apache.org/repos/asf/curator/blob/c6229cf2/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/exceptions/RpcException.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/exceptions/RpcException.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/exceptions/RpcException.java
new file mode 100644
index 0000000..f3740db
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/exceptions/RpcException.java
@@ -0,0 +1,80 @@
+package org.apache.curator.x.rpc.idl.exceptions;
+
+import com.facebook.swift.codec.ThriftField;
+import com.facebook.swift.codec.ThriftStruct;
+import com.facebook.swift.service.ThriftException;
+import org.apache.zookeeper.KeeperException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+@ThriftException(id = 1, type = RpcException.class, name = "CuratorException")
+@ThriftStruct("CuratorException")
+public class RpcException extends Exception
+{
+ @ThriftField(1)
+ public ExceptionType type;
+
+ @ThriftField(2)
+ public ZooKeeperExceptionType zooKeeperException;
+
+ @ThriftField(3)
+ public NodeExceptionType nodeException;
+
+ @ThriftField(4)
+ public String message;
+
+ public RpcException()
+ {
+ }
+
+ public RpcException(Exception e)
+ {
+ this.message = e.getLocalizedMessage();
+ if ( this.message == null )
+ {
+ StringWriter str = new StringWriter();
+ e.printStackTrace(new PrintWriter(str));
+ this.message = str.toString();
+ }
+
+ if ( KeeperException.class.isAssignableFrom(e.getClass()) )
+ {
+ KeeperException keeperException = (KeeperException)e;
+ switch ( keeperException.code() )
+ {
+ default:
+ {
+ type = ExceptionType.ZOOKEEPER;
+ zooKeeperException = ZooKeeperExceptionType.valueOf(keeperException.code().name());
+ nodeException = null;
+ break;
+ }
+
+ case NONODE:
+ case NODEEXISTS:
+ case NOTEMPTY:
+ case BADVERSION:
+ {
+ type = ExceptionType.NODE;
+ zooKeeperException = null;
+ nodeException = NodeExceptionType.valueOf(keeperException.code().name());
+ break;
+ }
+ }
+ }
+ else
+ {
+ type = ExceptionType.GENERAL;
+ }
+ }
+
+ public RpcException(ExceptionType type, ZooKeeperExceptionType zooKeeperException, NodeExceptionType nodeException, String message)
+ {
+ this.type = type;
+ this.zooKeeperException = zooKeeperException;
+ this.nodeException = nodeException;
+ this.message = message;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/curator/blob/c6229cf2/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/exceptions/ZooKeeperExceptionType.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/exceptions/ZooKeeperExceptionType.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/exceptions/ZooKeeperExceptionType.java
new file mode 100644
index 0000000..ca5049b
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/exceptions/ZooKeeperExceptionType.java
@@ -0,0 +1,22 @@
+package org.apache.curator.x.rpc.idl.exceptions;
+
+public enum ZooKeeperExceptionType
+{
+ SYSTEMERROR,
+ RUNTIMEINCONSISTENCY,
+ DATAINCONSISTENCY,
+ CONNECTIONLOSS,
+ MARSHALLINGERROR,
+ UNIMPLEMENTED,
+ OPERATIONTIMEOUT,
+ BADARGUMENTS,
+ APIERROR,
+ NOAUTH,
+ NOCHILDRENFOREPHEMERALS,
+ INVALIDACL,
+ AUTHFAILED,
+ SESSIONEXPIRED,
+ INVALIDCALLBACK,
+ SESSIONMOVED,
+ NOTREADONLY
+}
http://git-wip-us.apache.org/repos/asf/curator/blob/c6229cf2/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 7e9e9c1..07397ea 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
@@ -47,6 +47,8 @@ import org.apache.curator.x.rpc.connections.ConnectionManager;
import org.apache.curator.x.rpc.connections.CuratorEntry;
import org.apache.curator.x.rpc.details.RpcBackgroundCallback;
import org.apache.curator.x.rpc.details.RpcWatcher;
+import org.apache.curator.x.rpc.idl.exceptions.ExceptionType;
+import org.apache.curator.x.rpc.idl.exceptions.RpcException;
import org.apache.curator.x.rpc.idl.structs.*;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.data.Stat;
@@ -69,9 +71,13 @@ public class CuratorProjectionService
}
@ThriftMethod
- public CuratorProjection newCuratorProjection(String connectionName)
+ public CuratorProjection newCuratorProjection(String connectionName) throws RpcException
{
CuratorFramework client = connectionManager.newConnection(connectionName);
+ if ( client == null )
+ {
+ throw new RpcException(ExceptionType.GENERAL, null, null, "No connection configuration was found with the name: " + connectionName);
+ }
String id = CuratorEntry.newId();
client.start();
@@ -108,433 +114,513 @@ public class CuratorProjectionService
}
@ThriftMethod
- public OptionalPath createNode(CuratorProjection projection, CreateSpec spec) throws Exception
+ public OptionalPath createNode(CuratorProjection projection, CreateSpec spec) throws RpcException
{
- CuratorFramework client = getEntry(projection).getClient();
-
- Object builder = client.create();
- if ( spec.creatingParentsIfNeeded )
- {
- builder = castBuilder(builder, CreateBuilder.class).creatingParentsIfNeeded();
- }
- if ( spec.compressed )
- {
- builder = castBuilder(builder, Compressible.class).compressed();
- }
- if ( spec.withProtection )
- {
- builder = castBuilder(builder, CreateBuilder.class).withProtection();
- }
- if ( spec.mode != null )
+ try
{
- builder = castBuilder(builder, CreateModable.class).withMode(CreateMode.valueOf(spec.mode.name()));
- }
+ CuratorFramework client = CuratorEntry.mustGetEntry(connectionManager, projection).getClient();
- if ( spec.asyncContext != null )
+ Object builder = client.create();
+ if ( spec.creatingParentsIfNeeded )
+ {
+ builder = castBuilder(builder, CreateBuilder.class).creatingParentsIfNeeded();
+ }
+ if ( spec.compressed )
+ {
+ builder = castBuilder(builder, Compressible.class).compressed();
+ }
+ if ( spec.withProtection )
+ {
+ builder = castBuilder(builder, CreateBuilder.class).withProtection();
+ }
+ if ( spec.mode != null )
+ {
+ builder = castBuilder(builder, CreateModable.class).withMode(CreateMode.valueOf(spec.mode.name()));
+ }
+
+ if ( spec.asyncContext != null )
+ {
+ BackgroundCallback backgroundCallback = new RpcBackgroundCallback(this, projection);
+ builder = castBuilder(builder, Backgroundable.class).inBackground(backgroundCallback, spec.asyncContext);
+ }
+
+ Object path = castBuilder(builder, PathAndBytesable.class).forPath(spec.path, spec.data);
+ return new OptionalPath((path != null) ? String.valueOf(path) : null);
+ }
+ catch ( Exception e )
{
- BackgroundCallback backgroundCallback = new RpcBackgroundCallback(this, projection);
- builder = castBuilder(builder, Backgroundable.class).inBackground(backgroundCallback, spec.asyncContext);
+ throw new RpcException(e);
}
-
- Object path = castBuilder(builder, PathAndBytesable.class).forPath(spec.path, spec.data);
- return new OptionalPath((path != null) ? String.valueOf(path) : null);
}
@ThriftMethod
- public void deleteNode(CuratorProjection projection, DeleteSpec spec) throws Exception
+ public void deleteNode(CuratorProjection projection, DeleteSpec spec) throws RpcException
{
- CuratorFramework client = getEntry(projection).getClient();
-
- Object builder = client.delete();
- if ( spec.guaranteed )
+ try
{
- builder = castBuilder(builder, DeleteBuilder.class).guaranteed();
- }
- if ( spec.version != null )
- {
- builder = castBuilder(builder, Versionable.class).withVersion(spec.version.version);
- }
+ CuratorFramework client = CuratorEntry.mustGetEntry(connectionManager, projection).getClient();
+
+ Object builder = client.delete();
+ if ( spec.guaranteed )
+ {
+ builder = castBuilder(builder, DeleteBuilder.class).guaranteed();
+ }
+ if ( spec.version != null )
+ {
+ builder = castBuilder(builder, Versionable.class).withVersion(spec.version.version);
+ }
- if ( spec.asyncContext != null )
+ if ( spec.asyncContext != null )
+ {
+ BackgroundCallback backgroundCallback = new RpcBackgroundCallback(this, projection);
+ builder = castBuilder(builder, Backgroundable.class).inBackground(backgroundCallback, spec.asyncContext);
+ }
+
+ castBuilder(builder, Pathable.class).forPath(spec.path);
+ }
+ catch ( Exception e )
{
- BackgroundCallback backgroundCallback = new RpcBackgroundCallback(this, projection);
- builder = castBuilder(builder, Backgroundable.class).inBackground(backgroundCallback, spec.asyncContext);
+ throw new RpcException(e);
}
-
- castBuilder(builder, Pathable.class).forPath(spec.path);
}
@ThriftMethod
- public byte[] getData(CuratorProjection projection, GetDataSpec spec) throws Exception
+ public byte[] getData(CuratorProjection projection, GetDataSpec spec) throws RpcException
{
- CuratorFramework client = getEntry(projection).getClient();
-
- Object builder = client.getData();
- if ( spec.watched )
+ try
{
- builder = castBuilder(builder, Watchable.class).usingWatcher(new RpcWatcher(this, projection));
- }
+ CuratorFramework client = CuratorEntry.mustGetEntry(connectionManager, projection).getClient();
- if ( spec.decompressed )
- {
- builder = castBuilder(builder, Decompressible.class).decompressed();
- }
+ Object builder = client.getData();
+ if ( spec.watched )
+ {
+ builder = castBuilder(builder, Watchable.class).usingWatcher(new RpcWatcher(this, projection));
+ }
- if ( spec.asyncContext != null )
- {
- BackgroundCallback backgroundCallback = new RpcBackgroundCallback(this, projection);
- builder = castBuilder(builder, Backgroundable.class).inBackground(backgroundCallback);
- }
+ if ( spec.decompressed )
+ {
+ builder = castBuilder(builder, Decompressible.class).decompressed();
+ }
+
+ if ( spec.asyncContext != null )
+ {
+ BackgroundCallback backgroundCallback = new RpcBackgroundCallback(this, projection);
+ builder = castBuilder(builder, Backgroundable.class).inBackground(backgroundCallback);
+ }
- Stat stat = new Stat();
- builder = castBuilder(builder, Statable.class).storingStatIn(stat);
+ Stat stat = new Stat();
+ builder = castBuilder(builder, Statable.class).storingStatIn(stat);
- return (byte[])castBuilder(builder, Pathable.class).forPath(spec.path);
+ return (byte[])castBuilder(builder, Pathable.class).forPath(spec.path);
+ }
+ catch ( Exception e )
+ {
+ throw new RpcException(e);
+ }
}
@ThriftMethod
- public RpcStat setData(CuratorProjection projection, SetDataSpec spec) throws Exception
+ public RpcStat setData(CuratorProjection projection, SetDataSpec spec) throws RpcException
{
- CuratorFramework client = getEntry(projection).getClient();
-
- Object builder = client.setData();
- if ( spec.watched )
+ try
{
- builder = castBuilder(builder, Watchable.class).usingWatcher(new RpcWatcher(this, projection));
+ CuratorFramework client = CuratorEntry.mustGetEntry(connectionManager, projection).getClient();
+
+ Object builder = client.setData();
+ if ( spec.watched )
+ {
+ builder = castBuilder(builder, Watchable.class).usingWatcher(new RpcWatcher(this, projection));
+ }
+ if ( spec.version != null )
+ {
+ builder = castBuilder(builder, Versionable.class).withVersion(spec.version.version);
+ }
+
+ if ( spec.compressed )
+ {
+ builder = castBuilder(builder, Compressible.class).compressed();
+ }
+
+ if ( spec.asyncContext != null )
+ {
+ BackgroundCallback backgroundCallback = new RpcBackgroundCallback(this, projection);
+ builder = castBuilder(builder, Backgroundable.class).inBackground(backgroundCallback);
+ }
+
+ Stat stat = (Stat)castBuilder(builder, PathAndBytesable.class).forPath(spec.path, spec.data);
+ return RpcCuratorEvent.toRpcStat(stat);
}
- if ( spec.version != null )
+ catch ( Exception e )
{
- builder = castBuilder(builder, Versionable.class).withVersion(spec.version.version);
+ throw new RpcException(e);
}
+ }
- if ( spec.compressed )
+ @ThriftMethod
+ public OptionalRpcStat exists(CuratorProjection projection, ExistsSpec spec) throws RpcException
+ {
+ try
{
- builder = castBuilder(builder, Compressible.class).compressed();
- }
+ CuratorFramework client = CuratorEntry.mustGetEntry(connectionManager, projection).getClient();
+
+ Object builder = client.checkExists();
+ if ( spec.watched )
+ {
+ builder = castBuilder(builder, Watchable.class).usingWatcher(new RpcWatcher(this, projection));
+ }
- if ( spec.asyncContext != null )
+ if ( spec.asyncContext != null )
+ {
+ BackgroundCallback backgroundCallback = new RpcBackgroundCallback(this, projection);
+ castBuilder(builder, Backgroundable.class).inBackground(backgroundCallback);
+ }
+
+ Stat stat = (Stat)castBuilder(builder, Pathable.class).forPath(spec.path);
+ return new OptionalRpcStat((stat != null) ? RpcCuratorEvent.toRpcStat(stat) : null);
+ }
+ catch ( Exception e )
{
- BackgroundCallback backgroundCallback = new RpcBackgroundCallback(this, projection);
- builder = castBuilder(builder, Backgroundable.class).inBackground(backgroundCallback);
+ throw new RpcException(e);
}
-
- Stat stat = (Stat)castBuilder(builder, PathAndBytesable.class).forPath(spec.path, spec.data);
- return RpcCuratorEvent.toRpcStat(stat);
}
@ThriftMethod
- public OptionalRpcStat exists(CuratorProjection projection, ExistsSpec spec) throws Exception
+ public OptionalChildrenList getChildren(CuratorProjection projection, GetChildrenSpec spec) throws RpcException
{
- CuratorFramework client = getEntry(projection).getClient();
-
- Object builder = client.checkExists();
- if ( spec.watched )
+ try
{
- builder = castBuilder(builder, Watchable.class).usingWatcher(new RpcWatcher(this, projection));
- }
+ CuratorFramework client = CuratorEntry.mustGetEntry(connectionManager, projection).getClient();
- if ( spec.asyncContext != null )
+ Object builder = client.getChildren();
+ if ( spec.watched )
+ {
+ builder = castBuilder(builder, Watchable.class).usingWatcher(new RpcWatcher(this, projection));
+ }
+
+ if ( spec.asyncContext != null )
+ {
+ BackgroundCallback backgroundCallback = new RpcBackgroundCallback(this, projection);
+ builder = castBuilder(builder, Backgroundable.class).inBackground(backgroundCallback);
+ }
+
+ @SuppressWarnings("unchecked")
+ List<String> children = (List<String>)castBuilder(builder, Pathable.class).forPath(spec.path);
+ return new OptionalChildrenList(children);
+ }
+ catch ( Exception e )
{
- BackgroundCallback backgroundCallback = new RpcBackgroundCallback(this, projection);
- castBuilder(builder, Backgroundable.class).inBackground(backgroundCallback);
+ throw new RpcException(e);
}
-
- Stat stat = (Stat)castBuilder(builder, Pathable.class).forPath(spec.path);
- return new OptionalRpcStat((stat != null) ? RpcCuratorEvent.toRpcStat(stat) : null);
}
@ThriftMethod
- public OptionalChildrenList getChildren(CuratorProjection projection, GetChildrenSpec spec) throws Exception
+ public boolean closeGenericProjection(CuratorProjection projection, String id) throws RpcException
{
- CuratorFramework client = getEntry(projection).getClient();
-
- Object builder = client.getChildren();
- if ( spec.watched )
+ try
{
- builder = castBuilder(builder, Watchable.class).usingWatcher(new RpcWatcher(this, projection));
+ CuratorEntry entry = CuratorEntry.mustGetEntry(connectionManager, projection);
+ return entry.closeThing(id);
}
-
- if ( spec.asyncContext != null )
+ catch ( Exception e )
{
- BackgroundCallback backgroundCallback = new RpcBackgroundCallback(this, projection);
- builder = castBuilder(builder, Backgroundable.class).inBackground(backgroundCallback);
+ throw new RpcException(e);
}
-
- @SuppressWarnings("unchecked")
- List<String> children = (List<String>)castBuilder(builder, Pathable.class).forPath(spec.path);
- return new OptionalChildrenList(children);
}
@ThriftMethod
- public boolean closeGenericProjection(CuratorProjection curatorProjection, String id) throws Exception
+ public LockProjection acquireLock(CuratorProjection projection, final String path, int maxWaitMs) throws RpcException
{
- CuratorEntry entry = getEntry(curatorProjection);
- return entry.closeThing(id);
+ try
+ {
+ CuratorEntry entry = CuratorEntry.mustGetEntry(connectionManager, projection);
+ final InterProcessSemaphoreMutex lock = new InterProcessSemaphoreMutex(entry.getClient(), path);
+ if ( !lock.acquire(maxWaitMs, TimeUnit.MILLISECONDS) )
+ {
+ return new LockProjection();
+ }
+
+ Closer closer = new Closer()
+ {
+ @Override
+ public void close()
+ {
+ if ( lock.isAcquiredInThisProcess() )
+ {
+ try
+ {
+ lock.release();
+ }
+ catch ( Exception e )
+ {
+ log.error("Could not release left-over lock for path: " + path, e);
+ }
+ }
+ }
+ };
+ String id = entry.addThing(lock, closer);
+ return new LockProjection(id);
+ }
+ catch ( Exception e )
+ {
+ throw new RpcException(e);
+ }
}
@ThriftMethod
- public LockProjection acquireLock(CuratorProjection projection, final String path, int maxWaitMs) throws Exception
+ public LeaderResult startLeaderSelector(final CuratorProjection projection, final String path, final String participantId, int waitForLeadershipMs) throws RpcException
{
- CuratorEntry entry = getEntry(projection);
- final InterProcessSemaphoreMutex lock = new InterProcessSemaphoreMutex(entry.getClient(), path);
- if ( !lock.acquire(maxWaitMs, TimeUnit.MILLISECONDS) )
+ try
{
- return new LockProjection();
- }
+ CuratorEntry entry = CuratorEntry.mustGetEntry(connectionManager, projection);
- Closer closer = new Closer()
- {
- @Override
- public void close()
+ final LeaderLatch leaderLatch = new LeaderLatch(entry.getClient(), path, participantId);
+ leaderLatch.start();
+
+ Closer closer = new Closer()
{
- if ( lock.isAcquiredInThisProcess() )
+ @Override
+ public void close()
{
try
{
- lock.release();
+ leaderLatch.close();
}
- catch ( Exception e )
+ catch ( IOException e )
{
- log.error("Could not release left-over lock for path: " + path, e);
+ log.error("Could not close left-over leader latch for path: " + path, e);
}
}
- }
- };
- String id = entry.addThing(lock, closer);
- return new LockProjection(id);
- }
-
- @ThriftMethod
- public LeaderResult startLeaderSelector(final CuratorProjection projection, final String path, final String participantId, int waitForLeadershipMs) throws Exception
- {
- CuratorEntry entry = getEntry(projection);
-
- final LeaderLatch leaderLatch = new LeaderLatch(entry.getClient(), path, participantId);
- leaderLatch.start();
+ };
+ String id = entry.addThing(leaderLatch, closer);
- Closer closer = new Closer()
- {
- @Override
- public void close()
+ LeaderLatchListener listener = new LeaderLatchListener()
{
- try
+ @Override
+ public void isLeader()
{
- leaderLatch.close();
+ addEvent(projection, new RpcCuratorEvent(new LeaderEvent(path, participantId, true)));
}
- catch ( IOException e )
+
+ @Override
+ public void notLeader()
{
- log.error("Could not close left-over leader latch for path: " + path, e);
+ addEvent(projection, new RpcCuratorEvent(new LeaderEvent(path, participantId, false)));
}
- }
- };
- String id = entry.addThing(leaderLatch, closer);
-
- LeaderLatchListener listener = new LeaderLatchListener()
- {
- @Override
- public void isLeader()
- {
- addEvent(projection, new RpcCuratorEvent(new LeaderEvent(path, participantId, true)));
- }
+ };
+ leaderLatch.addListener(listener);
- @Override
- public void notLeader()
+ if ( waitForLeadershipMs > 0 )
{
- addEvent(projection, new RpcCuratorEvent(new LeaderEvent(path, participantId, false)));
+ leaderLatch.await(waitForLeadershipMs, TimeUnit.MILLISECONDS);
}
- };
- leaderLatch.addListener(listener);
- if ( waitForLeadershipMs > 0 )
+ return new LeaderResult(new LeaderProjection(id), leaderLatch.hasLeadership());
+ }
+ catch ( Exception e )
{
- leaderLatch.await(waitForLeadershipMs, TimeUnit.MILLISECONDS);
+ throw new RpcException(e);
}
-
- return new LeaderResult(new LeaderProjection(id), leaderLatch.hasLeadership());
}
@ThriftMethod
- public List<RpcParticipant> getLeaderParticipants(CuratorProjection projection, LeaderProjection leaderProjection) throws Exception
+ public List<RpcParticipant> getLeaderParticipants(CuratorProjection projection, LeaderProjection leaderProjection) throws RpcException
{
- CuratorEntry entry = getEntry(projection);
+ try
+ {
+ CuratorEntry entry = CuratorEntry.mustGetEntry(connectionManager, projection);
- LeaderLatch leaderLatch = getThing(entry, leaderProjection.id, LeaderLatch.class);
- Collection<Participant> participants = leaderLatch.getParticipants();
- return Lists.transform(Lists.newArrayList(participants), new Function<Participant, RpcParticipant>()
- {
- @Override
- public RpcParticipant apply(Participant participant)
+ LeaderLatch leaderLatch = getThing(entry, leaderProjection.id, LeaderLatch.class);
+ Collection<Participant> participants = leaderLatch.getParticipants();
+ return Lists.transform(Lists.newArrayList(participants), new Function<Participant, RpcParticipant>()
{
- return new RpcParticipant(participant.getId(), participant.isLeader());
- }
- });
+ @Override
+ public RpcParticipant apply(Participant participant)
+ {
+ return new RpcParticipant(participant.getId(), participant.isLeader());
+ }
+ });
+ }
+ catch ( Exception e )
+ {
+ throw new RpcException(e);
+ }
}
@ThriftMethod
- public boolean isLeader(CuratorProjection projection, LeaderProjection leaderProjection) throws Exception
+ public boolean isLeader(CuratorProjection projection, LeaderProjection leaderProjection) throws RpcException
{
- CuratorEntry entry = getEntry(projection);
+ try
+ {
+ CuratorEntry entry = CuratorEntry.mustGetEntry(connectionManager, projection);
- LeaderLatch leaderLatch = getThing(entry, leaderProjection.id, LeaderLatch.class);
- return leaderLatch.hasLeadership();
+ LeaderLatch leaderLatch = getThing(entry, leaderProjection.id, LeaderLatch.class);
+ return leaderLatch.hasLeadership();
+ }
+ catch ( Exception e )
+ {
+ throw new RpcException(e);
+ }
}
@ThriftMethod
- public PathChildrenCacheProjection startPathChildrenCache(final CuratorProjection projection, final String path, boolean cacheData, boolean dataIsCompressed, PathChildrenCacheStartMode startMode) throws Exception
+ public PathChildrenCacheProjection startPathChildrenCache(final CuratorProjection projection, final String path, boolean cacheData, boolean dataIsCompressed, PathChildrenCacheStartMode startMode) throws RpcException
{
- final CuratorEntry entry = getEntry(projection);
+ try
+ {
+ final CuratorEntry entry = CuratorEntry.mustGetEntry(connectionManager, projection);
- final PathChildrenCache cache = new PathChildrenCache(entry.getClient(), path, cacheData, dataIsCompressed, ThreadUtils.newThreadFactory("PathChildrenCacheResource"));
- cache.start(PathChildrenCache.StartMode.valueOf(startMode.name()));
+ final PathChildrenCache cache = new PathChildrenCache(entry.getClient(), path, cacheData, dataIsCompressed, ThreadUtils.newThreadFactory("PathChildrenCacheResource"));
+ cache.start(PathChildrenCache.StartMode.valueOf(startMode.name()));
- Closer closer = new Closer()
- {
- @Override
- public void close()
+ Closer closer = new Closer()
{
- try
+ @Override
+ public void close()
{
- cache.close();
+ try
+ {
+ cache.close();
+ }
+ catch ( IOException e )
+ {
+ log.error("Could not close left-over PathChildrenCache for path: " + path, e);
+ }
}
- catch ( IOException e )
+ };
+ String id = entry.addThing(cache, closer);
+
+ PathChildrenCacheListener listener = new PathChildrenCacheListener()
+ {
+ @Override
+ public void childEvent(CuratorFramework client, PathChildrenCacheEvent event) throws RpcException
{
- log.error("Could not close left-over PathChildrenCache for path: " + path, e);
+ entry.addEvent(new RpcCuratorEvent(new RpcPathChildrenCacheEvent(path, event)));
}
- }
- };
- String id = entry.addThing(cache, closer);
+ };
+ cache.getListenable().addListener(listener);
- PathChildrenCacheListener listener = new PathChildrenCacheListener()
+ return new PathChildrenCacheProjection(id);
+ }
+ catch ( Exception e )
{
- @Override
- public void childEvent(CuratorFramework client, PathChildrenCacheEvent event) throws Exception
- {
- entry.addEvent(new RpcCuratorEvent(new RpcPathChildrenCacheEvent(path, event)));
- }
- };
- cache.getListenable().addListener(listener);
-
- return new PathChildrenCacheProjection(id);
+ throw new RpcException(e);
+ }
}
@ThriftMethod
- public List<RpcChildData> getPathChildrenCacheData(CuratorProjection projection, PathChildrenCacheProjection cacheProjection) throws Exception
+ public List<RpcChildData> getPathChildrenCacheData(CuratorProjection projection, PathChildrenCacheProjection cacheProjection) throws RpcException
{
- CuratorEntry entry = getEntry(projection);
+ try
+ {
+ CuratorEntry entry = CuratorEntry.mustGetEntry(connectionManager, projection);
- PathChildrenCache pathChildrenCache = getThing(entry, cacheProjection.id, PathChildrenCache.class);
- return Lists.transform
- (
- pathChildrenCache.getCurrentData(),
- new Function<ChildData, RpcChildData>()
- {
- @Override
- public RpcChildData apply(ChildData childData)
+ PathChildrenCache pathChildrenCache = getThing(entry, cacheProjection.id, PathChildrenCache.class);
+ return Lists.transform
+ (
+ pathChildrenCache.getCurrentData(),
+ new Function<ChildData, RpcChildData>()
{
- return new RpcChildData(childData);
+ @Override
+ public RpcChildData apply(ChildData childData)
+ {
+ return new RpcChildData(childData);
+ }
}
- }
- );
+ );
+ }
+ catch ( Exception e )
+ {
+ throw new RpcException(e);
+ }
}
@ThriftMethod
- public RpcChildData getPathChildrenCacheDataForPath(CuratorProjection projection, PathChildrenCacheProjection cacheProjection, String path) throws Exception
+ public RpcChildData getPathChildrenCacheDataForPath(CuratorProjection projection, PathChildrenCacheProjection cacheProjection, String path) throws RpcException
{
- CuratorEntry entry = getEntry(projection);
+ try
+ {
+ CuratorEntry entry = CuratorEntry.mustGetEntry(connectionManager, projection);
- PathChildrenCache pathChildrenCache = getThing(entry, cacheProjection.id, PathChildrenCache.class);
- return new RpcChildData(pathChildrenCache.getCurrentData(path));
+ PathChildrenCache pathChildrenCache = getThing(entry, cacheProjection.id, PathChildrenCache.class);
+ return new RpcChildData(pathChildrenCache.getCurrentData(path));
+ }
+ catch ( Exception e )
+ {
+ throw new RpcException(e);
+ }
}
@ThriftMethod
- public NodeCacheProjection startNodeCache(CuratorProjection projection, final String path, boolean dataIsCompressed, boolean buildInitial) throws Exception
+ public NodeCacheProjection startNodeCache(CuratorProjection projection, final String path, boolean dataIsCompressed, boolean buildInitial) throws RpcException
{
- final CuratorEntry entry = getEntry(projection);
+ try
+ {
+ final CuratorEntry entry = CuratorEntry.mustGetEntry(connectionManager, projection);
- final NodeCache cache = new NodeCache(entry.getClient(), path, dataIsCompressed);
- cache.start(buildInitial);
+ final NodeCache cache = new NodeCache(entry.getClient(), path, dataIsCompressed);
+ cache.start(buildInitial);
- Closer closer = new Closer()
- {
- @Override
- public void close()
+ Closer closer = new Closer()
{
- try
+ @Override
+ public void close()
{
- cache.close();
+ try
+ {
+ cache.close();
+ }
+ catch ( IOException e )
+ {
+ log.error("Could not close left-over NodeCache for path: " + path, e);
+ }
}
- catch ( IOException e )
+ };
+ String id = entry.addThing(cache, closer);
+
+ NodeCacheListener listener = new NodeCacheListener()
+ {
+ @Override
+ public void nodeChanged()
{
- log.error("Could not close left-over NodeCache for path: " + path, e);
+ entry.addEvent(new RpcCuratorEvent(RpcCuratorEventType.NODE_CACHE, path));
}
- }
- };
- String id = entry.addThing(cache, closer);
+ };
+ cache.getListenable().addListener(listener);
- NodeCacheListener listener = new NodeCacheListener()
+ return new NodeCacheProjection(id);
+ }
+ catch ( Exception e )
{
- @Override
- public void nodeChanged() throws Exception
- {
- entry.addEvent(new RpcCuratorEvent(RpcCuratorEventType.NODE_CACHE, path));
- }
- };
- cache.getListenable().addListener(listener);
-
- return new NodeCacheProjection(id);
- }
-
- @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());
+ throw new RpcException(e);
+ }
}
@ThriftMethod
- public PersistentEphemeralNodeProjection startPersistentEphemeralNode(CuratorProjection projection, final String path, byte[] data, RpcPersistentEphemeralNodeMode mode) throws Exception
+ public RpcChildData getNodeCacheData(CuratorProjection projection, NodeCacheProjection cacheProjection) throws RpcException
{
- CuratorEntry entry = getEntry(projection);
-
- final PersistentEphemeralNode node = new PersistentEphemeralNode(entry.getClient(), PersistentEphemeralNode.Mode.valueOf(mode.name()), path, data);
- node.start();
+ try
+ {
+ CuratorEntry entry = CuratorEntry.mustGetEntry(connectionManager, projection);
- Closer closer = new Closer()
+ NodeCache nodeCache = getThing(entry, cacheProjection.id, NodeCache.class);
+ return new RpcChildData(nodeCache.getCurrentData());
+ }
+ catch ( Exception e )
{
- @Override
- public void close()
- {
- try
- {
- node.close();
- }
- catch ( Exception e )
- {
- log.error("Could not release left-over persistent ephemeral node for path: " + path, e);
- }
- }
- };
- String id = entry.addThing(node, closer);
- return new PersistentEphemeralNodeProjection(id);
+ throw new RpcException(e);
+ }
}
@ThriftMethod
- public List<LeaseProjection> startSemaphore(CuratorProjection projection, final String path, int acquireQty, int maxWaitMs, int maxLeases) throws Exception
+ public PersistentEphemeralNodeProjection startPersistentEphemeralNode(CuratorProjection projection, final String path, byte[] data, RpcPersistentEphemeralNodeMode mode) throws RpcException
{
- CuratorEntry entry = getEntry(projection);
-
- final InterProcessSemaphoreV2 semaphore = new InterProcessSemaphoreV2(entry.getClient(), path, maxLeases);
- final Collection<Lease> leases = semaphore.acquire(acquireQty, maxWaitMs, TimeUnit.MILLISECONDS);
- if ( leases == null )
+ try
{
- return Lists.newArrayList();
- }
+ CuratorEntry entry = CuratorEntry.mustGetEntry(connectionManager, projection);
+
+ final PersistentEphemeralNode node = new PersistentEphemeralNode(entry.getClient(), PersistentEphemeralNode.Mode.valueOf(mode.name()), path, data);
+ node.start();
- List<LeaseProjection> leaseProjections = Lists.newArrayList();
- for ( final Lease lease : leases )
- {
Closer closer = new Closer()
{
@Override
@@ -542,36 +628,72 @@ public class CuratorProjectionService
{
try
{
- semaphore.returnLease(lease);
+ node.close();
}
catch ( Exception e )
{
- log.error("Could not release semaphore leases for path: " + path, e);
+ log.error("Could not release left-over persistent ephemeral node for path: " + path, e);
}
}
};
- leaseProjections.add(new LeaseProjection(entry.addThing(lease, closer)));
+ String id = entry.addThing(node, closer);
+ return new PersistentEphemeralNodeProjection(id);
+ }
+ catch ( Exception e )
+ {
+ throw new RpcException(e);
}
- return leaseProjections;
}
- public void addEvent(CuratorProjection projection, RpcCuratorEvent event)
+ @ThriftMethod
+ public List<LeaseProjection> startSemaphore(CuratorProjection projection, final String path, int acquireQty, int maxWaitMs, int maxLeases) throws RpcException
{
- CuratorEntry entry = connectionManager.get(projection.id);
- if ( entry != null )
+ try
{
- entry.addEvent(event);
+ CuratorEntry entry = CuratorEntry.mustGetEntry(connectionManager, projection);
+
+ 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;
+ }
+ catch ( Exception e )
+ {
+ throw new RpcException(e);
}
}
- private CuratorEntry getEntry(CuratorProjection projection) throws Exception
+ public void addEvent(CuratorProjection projection, RpcCuratorEvent event)
{
CuratorEntry entry = connectionManager.get(projection.id);
- if ( entry == null )
+ if ( entry != null )
{
- throw new Exception("No client found with id: " + projection.id);
+ entry.addEvent(event);
}
- return entry;
}
private static <T> T castBuilder(Object createBuilder, Class<T> clazz) throws Exception
http://git-wip-us.apache.org/repos/asf/curator/blob/c6229cf2/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/services/EventService.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/services/EventService.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/services/EventService.java
index c10c5df..7b2ef94 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/services/EventService.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/services/EventService.java
@@ -4,6 +4,7 @@ import com.facebook.swift.service.ThriftMethod;
import com.facebook.swift.service.ThriftService;
import org.apache.curator.x.rpc.connections.CuratorEntry;
import org.apache.curator.x.rpc.connections.ConnectionManager;
+import org.apache.curator.x.rpc.idl.exceptions.RpcException;
import org.apache.curator.x.rpc.idl.structs.CuratorProjection;
import org.apache.curator.x.rpc.idl.structs.RpcCuratorEvent;
@@ -20,15 +21,17 @@ public class EventService
}
@ThriftMethod
- public RpcCuratorEvent getNextEvent(CuratorProjection projection) throws InterruptedException
+ public RpcCuratorEvent getNextEvent(CuratorProjection projection) throws RpcException
{
- CuratorEntry entry = connectionManager.get(projection.id);
- if ( entry == null )
+ try
{
- // TODO
- return null;
+ CuratorEntry entry = CuratorEntry.mustGetEntry(connectionManager, projection);
+ RpcCuratorEvent event = entry.pollForEvent(pingTimeMs);
+ return (event != null) ? event : new RpcCuratorEvent();
+ }
+ catch ( InterruptedException e )
+ {
+ throw new RpcException(e);
}
- RpcCuratorEvent event = entry.pollForEvent(pingTimeMs);
- return (event != null) ? event : new RpcCuratorEvent();
}
}
http://git-wip-us.apache.org/repos/asf/curator/blob/c6229cf2/curator-x-rpc/src/main/scripts/generate.sh
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/scripts/generate.sh b/curator-x-rpc/src/main/scripts/generate.sh
index de5e21c..684d8f5 100755
--- a/curator-x-rpc/src/main/scripts/generate.sh
+++ b/curator-x-rpc/src/main/scripts/generate.sh
@@ -31,7 +31,7 @@ RPC_PATH="$BASE_DIR/curator-x-rpc/target/classes"
CLASSES=""
-for p in services structs; do
+for p in services structs exceptions; do
for f in `ls -m1 $RPC_PATH/org/apache/curator/x/rpc/idl/$p/*.class | xargs -n 1 basename | sed s/\.[^\.]*$//`; do
if [[ $f != *[\$]* ]]; then
CLASSES="$CLASSES org.apache.curator.x.rpc.idl.$p.$f";
http://git-wip-us.apache.org/repos/asf/curator/blob/c6229cf2/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 7917a32..4de5cff 100644
--- a/curator-x-rpc/src/main/thrift/curator.thrift
+++ b/curator-x-rpc/src/main/thrift/curator.thrift
@@ -31,6 +31,18 @@ enum PersistentEphemeralNodeMode {
EPHEMERAL, EPHEMERAL_SEQUENTIAL, PROTECTED_EPHEMERAL, PROTECTED_EPHEMERAL_SEQUENTIAL
}
+enum ExceptionType {
+ GENERAL, ZOOKEEPER, NODE
+}
+
+enum NodeExceptionType {
+ NONODE, BADVERSION, NODEEXISTS, NOTEMPTY
+}
+
+enum ZooKeeperExceptionType {
+ SYSTEMERROR, RUNTIMEINCONSISTENCY, DATAINCONSISTENCY, CONNECTIONLOSS, MARSHALLINGERROR, UNIMPLEMENTED, OPERATIONTIMEOUT, BADARGUMENTS, APIERROR, NOAUTH, NOCHILDRENFOREPHEMERALS, INVALIDACL, AUTHFAILED, SESSIONEXPIRED, INVALIDCALLBACK, SESSIONMOVED, NOTREADONLY
+}
+
struct CuratorProjection {
1: string id;
}
@@ -179,6 +191,13 @@ struct SetDataSpec {
6: binary data;
}
+exception CuratorException {
+ 1: ExceptionType type;
+ 2: ZooKeeperExceptionType zooKeeperException;
+ 3: NodeExceptionType nodeException;
+ 4: string message;
+}
+
struct CuratorEvent {
2: CuratorEventType type;
3: i32 resultCode;
@@ -195,29 +214,29 @@ struct CuratorEvent {
}
service CuratorService {
- LockProjection acquireLock(1: CuratorProjection projection, 2: string path, 3: i32 maxWaitMs);
+ LockProjection acquireLock(1: CuratorProjection projection, 2: string path, 3: i32 maxWaitMs) throws (1: CuratorException ex1);
oneway void closeCuratorProjection(1: CuratorProjection projection);
- bool closeGenericProjection(1: CuratorProjection curatorProjection, 2: string id);
- OptionalPath createNode(1: CuratorProjection projection, 2: CreateSpec spec);
- void deleteNode(1: CuratorProjection projection, 2: DeleteSpec spec);
- OptionalStat exists(1: CuratorProjection projection, 2: ExistsSpec spec);
- OptionalChildrenList getChildren(1: CuratorProjection projection, 2: GetChildrenSpec spec);
- binary getData(1: CuratorProjection projection, 2: GetDataSpec spec);
- list<Participant> getLeaderParticipants(1: CuratorProjection projection, 2: LeaderProjection leaderProjection);
- ChildData getNodeCacheData(1: CuratorProjection projection, 2: NodeCacheProjection cacheProjection);
- list<ChildData> getPathChildrenCacheData(1: CuratorProjection projection, 2: PathChildrenCacheProjection cacheProjection);
- ChildData getPathChildrenCacheDataForPath(1: CuratorProjection projection, 2: PathChildrenCacheProjection cacheProjection, 3: string path);
- bool isLeader(1: CuratorProjection projection, 2: LeaderProjection leaderProjection);
+ bool closeGenericProjection(1: CuratorProjection projection, 2: string id) throws (1: CuratorException ex1);
+ OptionalPath createNode(1: CuratorProjection projection, 2: CreateSpec spec) throws (1: CuratorException ex1);
+ void deleteNode(1: CuratorProjection projection, 2: DeleteSpec spec) throws (1: CuratorException ex1);
+ OptionalStat exists(1: CuratorProjection projection, 2: ExistsSpec spec) throws (1: CuratorException ex1);
+ OptionalChildrenList getChildren(1: CuratorProjection projection, 2: GetChildrenSpec spec) throws (1: CuratorException ex1);
+ binary getData(1: CuratorProjection projection, 2: GetDataSpec spec) throws (1: CuratorException ex1);
+ list<Participant> getLeaderParticipants(1: CuratorProjection projection, 2: LeaderProjection leaderProjection) throws (1: CuratorException ex1);
+ ChildData getNodeCacheData(1: CuratorProjection projection, 2: NodeCacheProjection cacheProjection) throws (1: CuratorException ex1);
+ list<ChildData> getPathChildrenCacheData(1: CuratorProjection projection, 2: PathChildrenCacheProjection cacheProjection) throws (1: CuratorException ex1);
+ ChildData getPathChildrenCacheDataForPath(1: CuratorProjection projection, 2: PathChildrenCacheProjection cacheProjection, 3: string path) throws (1: CuratorException ex1);
+ bool isLeader(1: CuratorProjection projection, 2: LeaderProjection leaderProjection) throws (1: CuratorException ex1);
CuratorProjection newCuratorProjection(1: string connectionName);
oneway void pingCuratorProjection(1: CuratorProjection projection);
- Stat setData(1: CuratorProjection projection, 2: SetDataSpec spec);
- LeaderResult startLeaderSelector(1: CuratorProjection projection, 2: string path, 3: string participantId, 4: i32 waitForLeadershipMs);
- 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);
+ Stat setData(1: CuratorProjection projection, 2: SetDataSpec spec) throws (1: CuratorException ex1);
+ LeaderResult startLeaderSelector(1: CuratorProjection projection, 2: string path, 3: string participantId, 4: i32 waitForLeadershipMs) throws (1: CuratorException ex1);
+ NodeCacheProjection startNodeCache(1: CuratorProjection projection, 2: string path, 3: bool dataIsCompressed, 4: bool buildInitial) throws (1: CuratorException ex1);
+ PathChildrenCacheProjection startPathChildrenCache(1: CuratorProjection projection, 2: string path, 3: bool cacheData, 4: bool dataIsCompressed, 5: PathChildrenCacheStartMode startMode) throws (1: CuratorException ex1);
+ PersistentEphemeralNodeProjection startPersistentEphemeralNode(1: CuratorProjection projection, 2: string path, 3: binary data, 4: PersistentEphemeralNodeMode mode) throws (1: CuratorException ex1);
+ list<LeaseProjection> startSemaphore(1: CuratorProjection projection, 2: string path, 3: i32 acquireQty, 4: i32 maxWaitMs, 5: i32 maxLeases) throws (1: CuratorException ex1);
}
service EventService {
- CuratorEvent getNextEvent(1: CuratorProjection projection);
+ CuratorEvent getNextEvent(1: CuratorProjection projection) throws (1: CuratorException ex1);
}
http://git-wip-us.apache.org/repos/asf/curator/blob/c6229cf2/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorException.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorException.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorException.java
new file mode 100644
index 0000000..b397813
--- /dev/null
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorException.java
@@ -0,0 +1,736 @@
+/**
+ * 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 CuratorException extends TException implements org.apache.thrift.TBase<CuratorException, CuratorException._Fields>, java.io.Serializable, Cloneable, Comparable<CuratorException> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CuratorException");
+
+ private static final org.apache.thrift.protocol.TField TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("type", org.apache.thrift.protocol.TType.I32, (short)1);
+ private static final org.apache.thrift.protocol.TField ZOO_KEEPER_EXCEPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("zooKeeperException", org.apache.thrift.protocol.TType.I32, (short)2);
+ private static final org.apache.thrift.protocol.TField NODE_EXCEPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("nodeException", org.apache.thrift.protocol.TType.I32, (short)3);
+ private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)4);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new CuratorExceptionStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new CuratorExceptionTupleSchemeFactory());
+ }
+
+ /**
+ *
+ * @see ExceptionType
+ */
+ public ExceptionType type; // required
+ /**
+ *
+ * @see ZooKeeperExceptionType
+ */
+ public ZooKeeperExceptionType zooKeeperException; // required
+ /**
+ *
+ * @see NodeExceptionType
+ */
+ public NodeExceptionType nodeException; // required
+ public String message; // 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 {
+ /**
+ *
+ * @see ExceptionType
+ */
+ TYPE((short)1, "type"),
+ /**
+ *
+ * @see ZooKeeperExceptionType
+ */
+ ZOO_KEEPER_EXCEPTION((short)2, "zooKeeperException"),
+ /**
+ *
+ * @see NodeExceptionType
+ */
+ NODE_EXCEPTION((short)3, "nodeException"),
+ MESSAGE((short)4, "message");
+
+ 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: // TYPE
+ return TYPE;
+ case 2: // ZOO_KEEPER_EXCEPTION
+ return ZOO_KEEPER_EXCEPTION;
+ case 3: // NODE_EXCEPTION
+ return NODE_EXCEPTION;
+ case 4: // MESSAGE
+ return MESSAGE;
+ 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.TYPE, new org.apache.thrift.meta_data.FieldMetaData("type", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, ExceptionType.class)));
+ tmpMap.put(_Fields.ZOO_KEEPER_EXCEPTION, new org.apache.thrift.meta_data.FieldMetaData("zooKeeperException", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, ZooKeeperExceptionType.class)));
+ tmpMap.put(_Fields.NODE_EXCEPTION, new org.apache.thrift.meta_data.FieldMetaData("nodeException", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, NodeExceptionType.class)));
+ tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", 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(CuratorException.class, metaDataMap);
+ }
+
+ public CuratorException() {
+ }
+
+ public CuratorException(
+ ExceptionType type,
+ ZooKeeperExceptionType zooKeeperException,
+ NodeExceptionType nodeException,
+ String message)
+ {
+ this();
+ this.type = type;
+ this.zooKeeperException = zooKeeperException;
+ this.nodeException = nodeException;
+ this.message = message;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public CuratorException(CuratorException other) {
+ if (other.isSetType()) {
+ this.type = other.type;
+ }
+ if (other.isSetZooKeeperException()) {
+ this.zooKeeperException = other.zooKeeperException;
+ }
+ if (other.isSetNodeException()) {
+ this.nodeException = other.nodeException;
+ }
+ if (other.isSetMessage()) {
+ this.message = other.message;
+ }
+ }
+
+ public CuratorException deepCopy() {
+ return new CuratorException(this);
+ }
+
+ @Override
+ public void clear() {
+ this.type = null;
+ this.zooKeeperException = null;
+ this.nodeException = null;
+ this.message = null;
+ }
+
+ /**
+ *
+ * @see ExceptionType
+ */
+ public ExceptionType getType() {
+ return this.type;
+ }
+
+ /**
+ *
+ * @see ExceptionType
+ */
+ public CuratorException setType(ExceptionType type) {
+ this.type = type;
+ return this;
+ }
+
+ public void unsetType() {
+ this.type = null;
+ }
+
+ /** Returns true if field type is set (has been assigned a value) and false otherwise */
+ public boolean isSetType() {
+ return this.type != null;
+ }
+
+ public void setTypeIsSet(boolean value) {
+ if (!value) {
+ this.type = null;
+ }
+ }
+
+ /**
+ *
+ * @see ZooKeeperExceptionType
+ */
+ public ZooKeeperExceptionType getZooKeeperException() {
+ return this.zooKeeperException;
+ }
+
+ /**
+ *
+ * @see ZooKeeperExceptionType
+ */
+ public CuratorException setZooKeeperException(ZooKeeperExceptionType zooKeeperException) {
+ this.zooKeeperException = zooKeeperException;
+ return this;
+ }
+
+ public void unsetZooKeeperException() {
+ this.zooKeeperException = null;
+ }
+
+ /** Returns true if field zooKeeperException is set (has been assigned a value) and false otherwise */
+ public boolean isSetZooKeeperException() {
+ return this.zooKeeperException != null;
+ }
+
+ public void setZooKeeperExceptionIsSet(boolean value) {
+ if (!value) {
+ this.zooKeeperException = null;
+ }
+ }
+
+ /**
+ *
+ * @see NodeExceptionType
+ */
+ public NodeExceptionType getNodeException() {
+ return this.nodeException;
+ }
+
+ /**
+ *
+ * @see NodeExceptionType
+ */
+ public CuratorException setNodeException(NodeExceptionType nodeException) {
+ this.nodeException = nodeException;
+ return this;
+ }
+
+ public void unsetNodeException() {
+ this.nodeException = null;
+ }
+
+ /** Returns true if field nodeException is set (has been assigned a value) and false otherwise */
+ public boolean isSetNodeException() {
+ return this.nodeException != null;
+ }
+
+ public void setNodeExceptionIsSet(boolean value) {
+ if (!value) {
+ this.nodeException = null;
+ }
+ }
+
+ public String getMessage() {
+ return this.message;
+ }
+
+ public CuratorException setMessage(String message) {
+ this.message = message;
+ return this;
+ }
+
+ public void unsetMessage() {
+ this.message = null;
+ }
+
+ /** Returns true if field message is set (has been assigned a value) and false otherwise */
+ public boolean isSetMessage() {
+ return this.message != null;
+ }
+
+ public void setMessageIsSet(boolean value) {
+ if (!value) {
+ this.message = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case TYPE:
+ if (value == null) {
+ unsetType();
+ } else {
+ setType((ExceptionType)value);
+ }
+ break;
+
+ case ZOO_KEEPER_EXCEPTION:
+ if (value == null) {
+ unsetZooKeeperException();
+ } else {
+ setZooKeeperException((ZooKeeperExceptionType)value);
+ }
+ break;
+
+ case NODE_EXCEPTION:
+ if (value == null) {
+ unsetNodeException();
+ } else {
+ setNodeException((NodeExceptionType)value);
+ }
+ break;
+
+ case MESSAGE:
+ if (value == null) {
+ unsetMessage();
+ } else {
+ setMessage((String)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case TYPE:
+ return getType();
+
+ case ZOO_KEEPER_EXCEPTION:
+ return getZooKeeperException();
+
+ case NODE_EXCEPTION:
+ return getNodeException();
+
+ case MESSAGE:
+ return getMessage();
+
+ }
+ 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 TYPE:
+ return isSetType();
+ case ZOO_KEEPER_EXCEPTION:
+ return isSetZooKeeperException();
+ case NODE_EXCEPTION:
+ return isSetNodeException();
+ case MESSAGE:
+ return isSetMessage();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof CuratorException)
+ return this.equals((CuratorException)that);
+ return false;
+ }
+
+ public boolean equals(CuratorException that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_type = true && this.isSetType();
+ boolean that_present_type = true && that.isSetType();
+ if (this_present_type || that_present_type) {
+ if (!(this_present_type && that_present_type))
+ return false;
+ if (!this.type.equals(that.type))
+ return false;
+ }
+
+ boolean this_present_zooKeeperException = true && this.isSetZooKeeperException();
+ boolean that_present_zooKeeperException = true && that.isSetZooKeeperException();
+ if (this_present_zooKeeperException || that_present_zooKeeperException) {
+ if (!(this_present_zooKeeperException && that_present_zooKeeperException))
+ return false;
+ if (!this.zooKeeperException.equals(that.zooKeeperException))
+ return false;
+ }
+
+ boolean this_present_nodeException = true && this.isSetNodeException();
+ boolean that_present_nodeException = true && that.isSetNodeException();
+ if (this_present_nodeException || that_present_nodeException) {
+ if (!(this_present_nodeException && that_present_nodeException))
+ return false;
+ if (!this.nodeException.equals(that.nodeException))
+ return false;
+ }
+
+ boolean this_present_message = true && this.isSetMessage();
+ boolean that_present_message = true && that.isSetMessage();
+ if (this_present_message || that_present_message) {
+ if (!(this_present_message && that_present_message))
+ return false;
+ if (!this.message.equals(that.message))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public int compareTo(CuratorException other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = Boolean.valueOf(isSetType()).compareTo(other.isSetType());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetType()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.type, other.type);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetZooKeeperException()).compareTo(other.isSetZooKeeperException());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetZooKeeperException()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zooKeeperException, other.zooKeeperException);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetNodeException()).compareTo(other.isSetNodeException());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetNodeException()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nodeException, other.nodeException);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetMessage()).compareTo(other.isSetMessage());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetMessage()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, other.message);
+ 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("CuratorException(");
+ boolean first = true;
+
+ sb.append("type:");
+ if (this.type == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.type);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("zooKeeperException:");
+ if (this.zooKeeperException == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.zooKeeperException);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("nodeException:");
+ if (this.nodeException == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.nodeException);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("message:");
+ if (this.message == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.message);
+ }
+ 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 CuratorExceptionStandardSchemeFactory implements SchemeFactory {
+ public CuratorExceptionStandardScheme getScheme() {
+ return new CuratorExceptionStandardScheme();
+ }
+ }
+
+ private static class CuratorExceptionStandardScheme extends StandardScheme<CuratorException> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, CuratorException 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: // TYPE
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.type = ExceptionType.findByValue(iprot.readI32());
+ struct.setTypeIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // ZOO_KEEPER_EXCEPTION
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.zooKeeperException = ZooKeeperExceptionType.findByValue(iprot.readI32());
+ struct.setZooKeeperExceptionIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // NODE_EXCEPTION
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.nodeException = NodeExceptionType.findByValue(iprot.readI32());
+ struct.setNodeExceptionIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // MESSAGE
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.message = iprot.readString();
+ struct.setMessageIsSet(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, CuratorException struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.type != null) {
+ oprot.writeFieldBegin(TYPE_FIELD_DESC);
+ oprot.writeI32(struct.type.getValue());
+ oprot.writeFieldEnd();
+ }
+ if (struct.zooKeeperException != null) {
+ oprot.writeFieldBegin(ZOO_KEEPER_EXCEPTION_FIELD_DESC);
+ oprot.writeI32(struct.zooKeeperException.getValue());
+ oprot.writeFieldEnd();
+ }
+ if (struct.nodeException != null) {
+ oprot.writeFieldBegin(NODE_EXCEPTION_FIELD_DESC);
+ oprot.writeI32(struct.nodeException.getValue());
+ oprot.writeFieldEnd();
+ }
+ if (struct.message != null) {
+ oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
+ oprot.writeString(struct.message);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class CuratorExceptionTupleSchemeFactory implements SchemeFactory {
+ public CuratorExceptionTupleScheme getScheme() {
+ return new CuratorExceptionTupleScheme();
+ }
+ }
+
+ private static class CuratorExceptionTupleScheme extends TupleScheme<CuratorException> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, CuratorException struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetType()) {
+ optionals.set(0);
+ }
+ if (struct.isSetZooKeeperException()) {
+ optionals.set(1);
+ }
+ if (struct.isSetNodeException()) {
+ optionals.set(2);
+ }
+ if (struct.isSetMessage()) {
+ optionals.set(3);
+ }
+ oprot.writeBitSet(optionals, 4);
+ if (struct.isSetType()) {
+ oprot.writeI32(struct.type.getValue());
+ }
+ if (struct.isSetZooKeeperException()) {
+ oprot.writeI32(struct.zooKeeperException.getValue());
+ }
+ if (struct.isSetNodeException()) {
+ oprot.writeI32(struct.nodeException.getValue());
+ }
+ if (struct.isSetMessage()) {
+ oprot.writeString(struct.message);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, CuratorException struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(4);
+ if (incoming.get(0)) {
+ struct.type = ExceptionType.findByValue(iprot.readI32());
+ struct.setTypeIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.zooKeeperException = ZooKeeperExceptionType.findByValue(iprot.readI32());
+ struct.setZooKeeperExceptionIsSet(true);
+ }
+ if (incoming.get(2)) {
+ struct.nodeException = NodeExceptionType.findByValue(iprot.readI32());
+ struct.setNodeExceptionIsSet(true);
+ }
+ if (incoming.get(3)) {
+ struct.message = iprot.readString();
+ struct.setMessageIsSet(true);
+ }
+ }
+ }
+
+}
+