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/29 19:16:18 UTC
[2/2] git commit: Added leader selector
Added leader selector
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/1f11d389
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/1f11d389
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/1f11d389
Branch: refs/heads/curator-rpc
Commit: 1f11d3899545539803cb8d1a9cc82c94380c1144
Parents: f55b455
Author: randgalt <ra...@apache.org>
Authored: Thu May 29 12:16:05 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Thu May 29 12:16:05 2014 -0500
----------------------------------------------------------------------
.../curator/x/rpc/connections/CuratorEntry.java | 7 +-
.../curator/x/rpc/idl/event/LeaderEvent.java | 28 +
.../curator/x/rpc/idl/event/LeaderResult.java | 25 +
.../x/rpc/idl/event/RpcCuratorEvent.java | 22 +
.../x/rpc/idl/event/RpcCuratorEventType.java | 3 +-
.../projection/CuratorProjectionService.java | 59 +-
curator-x-rpc/src/main/thrift/curator.thrift | 15 +-
.../apache/curator/generated/CuratorEvent.java | 113 +-
.../curator/generated/CuratorEventType.java | 5 +-
.../curator/generated/CuratorService.java | 1160 ++++++++++++++++++
.../apache/curator/generated/LeaderEvent.java | 586 +++++++++
.../apache/curator/generated/LeaderResult.java | 491 ++++++++
.../org/apache/curator/x/rpc/TestClient.java | 4 +
13 files changed, 2508 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/1f11d389/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 0c4bb8b..1ecd795 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
@@ -90,7 +90,12 @@ public class CuratorEntry implements Closeable
public <T> String addThing(T thing, Closer<T> closer)
{
- return addThing(UUID.randomUUID().toString(), thing, closer);
+ return addThing(newId(), thing, closer);
+ }
+
+ public static String newId()
+ {
+ return UUID.randomUUID().toString();
}
public <T> String addThing(String id, T thing, Closer<T> closer)
http://git-wip-us.apache.org/repos/asf/curator/blob/1f11d389/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/LeaderEvent.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/LeaderEvent.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/LeaderEvent.java
new file mode 100644
index 0000000..bd86dce
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/LeaderEvent.java
@@ -0,0 +1,28 @@
+package org.apache.curator.x.rpc.idl.event;
+
+import com.facebook.swift.codec.ThriftField;
+import com.facebook.swift.codec.ThriftStruct;
+
+@ThriftStruct("LeaderEvent")
+public class LeaderEvent
+{
+ @ThriftField(1)
+ public String path;
+
+ @ThriftField(2)
+ public String participantId;
+
+ @ThriftField(3)
+ public boolean isLeader;
+
+ public LeaderEvent()
+ {
+ }
+
+ public LeaderEvent(String path, String participantId, boolean isLeader)
+ {
+ this.path = path;
+ this.participantId = participantId;
+ this.isLeader = isLeader;
+ }
+}
http://git-wip-us.apache.org/repos/asf/curator/blob/1f11d389/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/LeaderResult.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/LeaderResult.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/LeaderResult.java
new file mode 100644
index 0000000..7a67b62
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/LeaderResult.java
@@ -0,0 +1,25 @@
+package org.apache.curator.x.rpc.idl.event;
+
+import com.facebook.swift.codec.ThriftField;
+import com.facebook.swift.codec.ThriftStruct;
+import org.apache.curator.x.rpc.idl.projection.GenericProjection;
+
+@ThriftStruct("LeaderResult")
+public class LeaderResult
+{
+ @ThriftField(1)
+ public GenericProjection projection;
+
+ @ThriftField(2)
+ public boolean hasLeadership;
+
+ public LeaderResult()
+ {
+ }
+
+ public LeaderResult(GenericProjection projection, boolean hasLeadership)
+ {
+ this.projection = projection;
+ this.hasLeadership = hasLeadership;
+ }
+}
http://git-wip-us.apache.org/repos/asf/curator/blob/1f11d389/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcCuratorEvent.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcCuratorEvent.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcCuratorEvent.java
index 50bbbf3..7835b39 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcCuratorEvent.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcCuratorEvent.java
@@ -66,6 +66,9 @@ public class RpcCuratorEvent
@ThriftField(11)
public RpcWatchedEvent watchedEvent;
+ @ThriftField(12)
+ public LeaderEvent leaderEvent;
+
public RpcCuratorEvent()
{
this.type = RpcCuratorEventType.PING;
@@ -78,6 +81,7 @@ public class RpcCuratorEvent
this.children = null;
this.aclList = null;
this.watchedEvent = null;
+ this.leaderEvent = null;
}
public RpcCuratorEvent(CuratorEvent event)
@@ -92,6 +96,7 @@ public class RpcCuratorEvent
this.children = event.getChildren();
this.aclList = toRpcAclList(event.getACLList());
this.watchedEvent = toRpcWatchedEvent(event.getWatchedEvent());
+ this.leaderEvent = null;
}
public RpcCuratorEvent(ConnectionState newState)
@@ -106,6 +111,7 @@ public class RpcCuratorEvent
this.children = null;
this.aclList = null;
this.watchedEvent = null;
+ this.leaderEvent = null;
}
public RpcCuratorEvent(WatchedEvent event)
@@ -120,6 +126,22 @@ public class RpcCuratorEvent
this.children = null;
this.aclList = null;
this.watchedEvent = new RpcWatchedEvent(toRpcKeeperState(event.getState()), toRpcEventType(event.getType()), event.getPath());
+ this.leaderEvent = null;
+ }
+
+ public RpcCuratorEvent(LeaderEvent event)
+ {
+ this.type = RpcCuratorEventType.LEADER;
+ this.resultCode = 0;
+ this.path = event.path;
+ this.context = null;
+ this.stat = null;
+ this.data = null;
+ this.name = null;
+ this.children = null;
+ this.aclList = null;
+ this.watchedEvent = null;
+ this.leaderEvent = event;
}
private RpcCuratorEventType toRpcCuratorEventType(ConnectionState state)
http://git-wip-us.apache.org/repos/asf/curator/blob/1f11d389/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcCuratorEventType.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcCuratorEventType.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcCuratorEventType.java
index f8d6468..1102740 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcCuratorEventType.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcCuratorEventType.java
@@ -39,5 +39,6 @@ public enum RpcCuratorEventType
CONNECTION_SUSPENDED,
CONNECTION_RECONNECTED,
CONNECTION_LOST,
- CONNECTION_READ_ONLY
+ CONNECTION_READ_ONLY,
+ LEADER
}
http://git-wip-us.apache.org/repos/asf/curator/blob/1f11d389/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionService.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionService.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionService.java
index 1daf1e7..97f3a27 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionService.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionService.java
@@ -23,6 +23,8 @@ import com.facebook.swift.service.ThriftMethod;
import com.facebook.swift.service.ThriftService;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.api.*;
+import org.apache.curator.framework.recipes.leader.LeaderLatch;
+import org.apache.curator.framework.recipes.leader.LeaderLatchListener;
import org.apache.curator.framework.recipes.locks.InterProcessSemaphoreMutex;
import org.apache.curator.framework.state.ConnectionState;
import org.apache.curator.framework.state.ConnectionStateListener;
@@ -31,6 +33,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.event.LeaderEvent;
+import org.apache.curator.x.rpc.idl.event.LeaderResult;
import org.apache.curator.x.rpc.idl.event.OptionalChildrenList;
import org.apache.curator.x.rpc.idl.event.OptionalPath;
import org.apache.curator.x.rpc.idl.event.OptionalRpcStat;
@@ -39,8 +43,8 @@ import org.apache.curator.x.rpc.idl.event.RpcStat;
import org.apache.zookeeper.data.Stat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.IOException;
import java.util.List;
-import java.util.UUID;
import java.util.concurrent.TimeUnit;
@ThriftService("CuratorService")
@@ -59,7 +63,7 @@ public class CuratorProjectionService
{
CuratorFramework client = connectionManager.newConnection(connectionName);
- String id = UUID.randomUUID().toString();
+ String id = CuratorEntry.newId();
client.start();
connectionManager.add(id, client);
final CuratorProjection projection = new CuratorProjection(id);
@@ -284,6 +288,57 @@ public class CuratorProjectionService
return new GenericProjection(id);
}
+ @ThriftMethod
+ public LeaderResult startLeaderSelector(final CuratorProjection projection, final String path, final String participantId, int waitForLeadershipMs) throws Exception
+ {
+ CuratorEntry entry = getEntry(projection);
+
+ LeaderLatch leaderLatch = new LeaderLatch(entry.getClient(), path, participantId);
+ leaderLatch.start();
+
+ Closer<LeaderLatch> closer = new Closer<LeaderLatch>()
+ {
+ @Override
+ public void close(LeaderLatch latch)
+ {
+ try
+ {
+ latch.close();
+ }
+ catch ( IOException e )
+ {
+ log.error("Could not close left-over leader latch for path: " + path, e);
+ }
+ }
+ };
+ final String id = CuratorEntry.newId();
+ entry.addThing(id, leaderLatch, closer);
+
+ LeaderLatchListener listener = new LeaderLatchListener()
+ {
+ @Override
+ public void isLeader()
+ {
+ addEvent(projection, new RpcCuratorEvent(new LeaderEvent(path, participantId, true)));
+ }
+
+ @Override
+ public void notLeader()
+ {
+ addEvent(projection, new RpcCuratorEvent(new LeaderEvent(path, participantId, false)));
+ }
+ };
+ leaderLatch.addListener(listener);
+
+ if ( waitForLeadershipMs > 0 )
+ {
+ leaderLatch.await(waitForLeadershipMs, TimeUnit.MILLISECONDS);
+ }
+
+ GenericProjection leaderProjection = new GenericProjection(id);
+ return new LeaderResult(leaderProjection, leaderLatch.hasLeadership());
+ }
+
public void addEvent(CuratorProjection projection, RpcCuratorEvent event)
{
CuratorEntry entry = connectionManager.get(projection.id);
http://git-wip-us.apache.org/repos/asf/curator/blob/1f11d389/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 afcbb08..ec52895 100644
--- a/curator-x-rpc/src/main/thrift/curator.thrift
+++ b/curator-x-rpc/src/main/thrift/curator.thrift
@@ -8,7 +8,7 @@ enum CreateMode {
}
enum CuratorEventType {
- PING, CREATE, DELETE, EXISTS, GET_DATA, SET_DATA, CHILDREN, SYNC, GET_ACL, SET_ACL, WATCHED, CLOSING, CONNECTION_CONNECTED, CONNECTION_SUSPENDED, CONNECTION_RECONNECTED, CONNECTION_LOST, CONNECTION_READ_ONLY
+ PING, CREATE, DELETE, EXISTS, GET_DATA, SET_DATA, CHILDREN, SYNC, GET_ACL, SET_ACL, WATCHED, CLOSING, CONNECTION_CONNECTED, CONNECTION_SUSPENDED, CONNECTION_RECONNECTED, CONNECTION_LOST, CONNECTION_READ_ONLY, LEADER
}
enum EventType {
@@ -60,6 +60,17 @@ struct Version {
1: i32 version;
}
+struct LeaderEvent {
+ 1: string path;
+ 2: string participantId;
+ 3: bool isLeader;
+}
+
+struct LeaderResult {
+ 1: GenericProjection projection;
+ 2: bool hasLeadership;
+}
+
struct OptionalChildrenList {
1: list<string> children;
}
@@ -130,6 +141,7 @@ struct CuratorEvent {
9: list<string> children;
10: list<Acl> aclList;
11: WatchedEvent watchedEvent;
+ 12: LeaderEvent leaderEvent;
}
service CuratorService {
@@ -143,6 +155,7 @@ service CuratorService {
binary getData(1: CuratorProjection projection, 2: GetDataSpec spec);
CuratorProjection newCuratorProjection(1: string connectionName);
Stat setData(1: CuratorProjection projection, 2: SetDataSpec spec);
+ LeaderResult startLeaderSelector(1: CuratorProjection projection, 2: string path, 3: string participantId, 4: i32 waitForLeadershipMs);
}
service EventService {
http://git-wip-us.apache.org/repos/asf/curator/blob/1f11d389/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorEvent.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorEvent.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorEvent.java
index 54afe6b..847e89e 100644
--- a/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorEvent.java
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorEvent.java
@@ -45,6 +45,7 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
private static final org.apache.thrift.protocol.TField CHILDREN_FIELD_DESC = new org.apache.thrift.protocol.TField("children", org.apache.thrift.protocol.TType.LIST, (short)9);
private static final org.apache.thrift.protocol.TField ACL_LIST_FIELD_DESC = new org.apache.thrift.protocol.TField("aclList", org.apache.thrift.protocol.TType.LIST, (short)10);
private static final org.apache.thrift.protocol.TField WATCHED_EVENT_FIELD_DESC = new org.apache.thrift.protocol.TField("watchedEvent", org.apache.thrift.protocol.TType.STRUCT, (short)11);
+ private static final org.apache.thrift.protocol.TField LEADER_EVENT_FIELD_DESC = new org.apache.thrift.protocol.TField("leaderEvent", org.apache.thrift.protocol.TType.STRUCT, (short)12);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
@@ -66,6 +67,7 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
public List<String> children; // required
public List<Acl> aclList; // required
public WatchedEvent watchedEvent; // required
+ public LeaderEvent leaderEvent; // 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 {
@@ -82,7 +84,8 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
NAME((short)8, "name"),
CHILDREN((short)9, "children"),
ACL_LIST((short)10, "aclList"),
- WATCHED_EVENT((short)11, "watchedEvent");
+ WATCHED_EVENT((short)11, "watchedEvent"),
+ LEADER_EVENT((short)12, "leaderEvent");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
@@ -117,6 +120,8 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
return ACL_LIST;
case 11: // WATCHED_EVENT
return WATCHED_EVENT;
+ case 12: // LEADER_EVENT
+ return LEADER_EVENT;
default:
return null;
}
@@ -184,6 +189,8 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Acl.class))));
tmpMap.put(_Fields.WATCHED_EVENT, new org.apache.thrift.meta_data.FieldMetaData("watchedEvent", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, WatchedEvent.class)));
+ tmpMap.put(_Fields.LEADER_EVENT, new org.apache.thrift.meta_data.FieldMetaData("leaderEvent", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, LeaderEvent.class)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CuratorEvent.class, metaDataMap);
}
@@ -201,7 +208,8 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
String name,
List<String> children,
List<Acl> aclList,
- WatchedEvent watchedEvent)
+ WatchedEvent watchedEvent,
+ LeaderEvent leaderEvent)
{
this();
this.type = type;
@@ -215,6 +223,7 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
this.children = children;
this.aclList = aclList;
this.watchedEvent = watchedEvent;
+ this.leaderEvent = leaderEvent;
}
/**
@@ -256,6 +265,9 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
if (other.isSetWatchedEvent()) {
this.watchedEvent = new WatchedEvent(other.watchedEvent);
}
+ if (other.isSetLeaderEvent()) {
+ this.leaderEvent = new LeaderEvent(other.leaderEvent);
+ }
}
public CuratorEvent deepCopy() {
@@ -275,6 +287,7 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
this.children = null;
this.aclList = null;
this.watchedEvent = null;
+ this.leaderEvent = null;
}
/**
@@ -564,6 +577,30 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
}
}
+ public LeaderEvent getLeaderEvent() {
+ return this.leaderEvent;
+ }
+
+ public CuratorEvent setLeaderEvent(LeaderEvent leaderEvent) {
+ this.leaderEvent = leaderEvent;
+ return this;
+ }
+
+ public void unsetLeaderEvent() {
+ this.leaderEvent = null;
+ }
+
+ /** Returns true if field leaderEvent is set (has been assigned a value) and false otherwise */
+ public boolean isSetLeaderEvent() {
+ return this.leaderEvent != null;
+ }
+
+ public void setLeaderEventIsSet(boolean value) {
+ if (!value) {
+ this.leaderEvent = null;
+ }
+ }
+
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case TYPE:
@@ -646,6 +683,14 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
}
break;
+ case LEADER_EVENT:
+ if (value == null) {
+ unsetLeaderEvent();
+ } else {
+ setLeaderEvent((LeaderEvent)value);
+ }
+ break;
+
}
}
@@ -681,6 +726,9 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
case WATCHED_EVENT:
return getWatchedEvent();
+ case LEADER_EVENT:
+ return getLeaderEvent();
+
}
throw new IllegalStateException();
}
@@ -712,6 +760,8 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
return isSetAclList();
case WATCHED_EVENT:
return isSetWatchedEvent();
+ case LEADER_EVENT:
+ return isSetLeaderEvent();
}
throw new IllegalStateException();
}
@@ -819,6 +869,15 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
return false;
}
+ boolean this_present_leaderEvent = true && this.isSetLeaderEvent();
+ boolean that_present_leaderEvent = true && that.isSetLeaderEvent();
+ if (this_present_leaderEvent || that_present_leaderEvent) {
+ if (!(this_present_leaderEvent && that_present_leaderEvent))
+ return false;
+ if (!this.leaderEvent.equals(that.leaderEvent))
+ return false;
+ }
+
return true;
}
@@ -935,6 +994,16 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
return lastComparison;
}
}
+ lastComparison = Boolean.valueOf(isSetLeaderEvent()).compareTo(other.isSetLeaderEvent());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetLeaderEvent()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.leaderEvent, other.leaderEvent);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
return 0;
}
@@ -1030,6 +1099,14 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
sb.append(this.watchedEvent);
}
first = false;
+ if (!first) sb.append(", ");
+ sb.append("leaderEvent:");
+ if (this.leaderEvent == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.leaderEvent);
+ }
+ first = false;
sb.append(")");
return sb.toString();
}
@@ -1043,6 +1120,9 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
if (watchedEvent != null) {
watchedEvent.validate();
}
+ if (leaderEvent != null) {
+ leaderEvent.validate();
+ }
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -1184,6 +1264,15 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
+ case 12: // LEADER_EVENT
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.leaderEvent = new LeaderEvent();
+ struct.leaderEvent.read(iprot);
+ struct.setLeaderEventIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
@@ -1261,6 +1350,11 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
struct.watchedEvent.write(oprot);
oprot.writeFieldEnd();
}
+ if (struct.leaderEvent != null) {
+ oprot.writeFieldBegin(LEADER_EVENT_FIELD_DESC);
+ struct.leaderEvent.write(oprot);
+ oprot.writeFieldEnd();
+ }
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@@ -1309,7 +1403,10 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
if (struct.isSetWatchedEvent()) {
optionals.set(9);
}
- oprot.writeBitSet(optionals, 10);
+ if (struct.isSetLeaderEvent()) {
+ optionals.set(10);
+ }
+ oprot.writeBitSet(optionals, 11);
if (struct.isSetType()) {
oprot.writeI32(struct.type.getValue());
}
@@ -1352,12 +1449,15 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
if (struct.isSetWatchedEvent()) {
struct.watchedEvent.write(oprot);
}
+ if (struct.isSetLeaderEvent()) {
+ struct.leaderEvent.write(oprot);
+ }
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, CuratorEvent struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
- BitSet incoming = iprot.readBitSet(10);
+ BitSet incoming = iprot.readBitSet(11);
if (incoming.get(0)) {
struct.type = CuratorEventType.findByValue(iprot.readI32());
struct.setTypeIsSet(true);
@@ -1419,6 +1519,11 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
struct.watchedEvent.read(iprot);
struct.setWatchedEventIsSet(true);
}
+ if (incoming.get(10)) {
+ struct.leaderEvent = new LeaderEvent();
+ struct.leaderEvent.read(iprot);
+ struct.setLeaderEventIsSet(true);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/curator/blob/1f11d389/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorEventType.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorEventType.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorEventType.java
index ce31158..4e6fad1 100644
--- a/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorEventType.java
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorEventType.java
@@ -28,7 +28,8 @@ public enum CuratorEventType implements org.apache.thrift.TEnum {
CONNECTION_SUSPENDED(13),
CONNECTION_RECONNECTED(14),
CONNECTION_LOST(15),
- CONNECTION_READ_ONLY(16);
+ CONNECTION_READ_ONLY(16),
+ LEADER(17);
private final int value;
@@ -83,6 +84,8 @@ public enum CuratorEventType implements org.apache.thrift.TEnum {
return CONNECTION_LOST;
case 16:
return CONNECTION_READ_ONLY;
+ case 17:
+ return LEADER;
default:
return null;
}
http://git-wip-us.apache.org/repos/asf/curator/blob/1f11d389/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 1cf2786..38a29cc 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
@@ -56,6 +56,8 @@ public class CuratorService {
public Stat setData(CuratorProjection projection, SetDataSpec spec) throws org.apache.thrift.TException;
+ public LeaderResult startLeaderSelector(CuratorProjection projection, String path, String participantId, int waitForLeadershipMs) throws org.apache.thrift.TException;
+
}
public interface AsyncIface {
@@ -80,6 +82,8 @@ public class CuratorService {
public void setData(CuratorProjection projection, SetDataSpec spec, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void startLeaderSelector(CuratorProjection projection, String path, String participantId, int waitForLeadershipMs, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
}
public static class Client extends org.apache.thrift.TServiceClient implements Iface {
@@ -335,6 +339,32 @@ public class CuratorService {
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
+ {
+ send_startLeaderSelector(projection, path, participantId, waitForLeadershipMs);
+ return recv_startLeaderSelector();
+ }
+
+ public void send_startLeaderSelector(CuratorProjection projection, String path, String participantId, int waitForLeadershipMs) throws org.apache.thrift.TException
+ {
+ startLeaderSelector_args args = new startLeaderSelector_args();
+ args.setProjection(projection);
+ args.setPath(path);
+ args.setParticipantId(participantId);
+ args.setWaitForLeadershipMs(waitForLeadershipMs);
+ sendBase("startLeaderSelector", args);
+ }
+
+ public LeaderResult recv_startLeaderSelector() throws org.apache.thrift.TException
+ {
+ startLeaderSelector_result result = new startLeaderSelector_result();
+ receiveBase(result, "startLeaderSelector");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "startLeaderSelector failed: unknown result");
+ }
+
}
public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
@@ -700,6 +730,47 @@ public class CuratorService {
}
}
+ public void startLeaderSelector(CuratorProjection projection, String path, String participantId, int waitForLeadershipMs, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ startLeaderSelector_call method_call = new startLeaderSelector_call(projection, path, participantId, waitForLeadershipMs, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class startLeaderSelector_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private CuratorProjection projection;
+ private String path;
+ private String participantId;
+ private int waitForLeadershipMs;
+ public startLeaderSelector_call(CuratorProjection projection, String path, String participantId, int waitForLeadershipMs, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ super(client, protocolFactory, transport, resultHandler, false);
+ this.projection = projection;
+ this.path = path;
+ this.participantId = participantId;
+ this.waitForLeadershipMs = waitForLeadershipMs;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("startLeaderSelector", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ startLeaderSelector_args args = new startLeaderSelector_args();
+ args.setProjection(projection);
+ args.setPath(path);
+ args.setParticipantId(participantId);
+ args.setWaitForLeadershipMs(waitForLeadershipMs);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public LeaderResult getResult() throws org.apache.thrift.TException {
+ if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+ throw new IllegalStateException("Method call not finished!");
+ }
+ org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+ org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+ return (new Client(prot)).recv_startLeaderSelector();
+ }
+ }
+
}
public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
@@ -723,6 +794,7 @@ public class CuratorService {
processMap.put("getData", new getData());
processMap.put("newCuratorProjection", new newCuratorProjection());
processMap.put("setData", new setData());
+ processMap.put("startLeaderSelector", new startLeaderSelector());
return processMap;
}
@@ -927,6 +999,26 @@ public class CuratorService {
}
}
+ public static class startLeaderSelector<I extends Iface> extends org.apache.thrift.ProcessFunction<I, startLeaderSelector_args> {
+ public startLeaderSelector() {
+ super("startLeaderSelector");
+ }
+
+ public startLeaderSelector_args getEmptyArgsInstance() {
+ return new startLeaderSelector_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ 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);
+ return result;
+ }
+ }
+
}
public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
@@ -950,6 +1042,7 @@ public class CuratorService {
processMap.put("getData", new getData());
processMap.put("newCuratorProjection", new newCuratorProjection());
processMap.put("setData", new setData());
+ processMap.put("startLeaderSelector", new startLeaderSelector());
return processMap;
}
@@ -1462,6 +1555,57 @@ public class CuratorService {
}
}
+ public static class startLeaderSelector<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, startLeaderSelector_args, LeaderResult> {
+ public startLeaderSelector() {
+ super("startLeaderSelector");
+ }
+
+ public startLeaderSelector_args getEmptyArgsInstance() {
+ return new startLeaderSelector_args();
+ }
+
+ public AsyncMethodCallback<LeaderResult> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback<LeaderResult>() {
+ public void onComplete(LeaderResult o) {
+ startLeaderSelector_result result = new startLeaderSelector_result();
+ result.success = o;
+ try {
+ fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+ return;
+ } catch (Exception e) {
+ LOGGER.error("Exception writing to internal frame buffer", e);
+ }
+ fb.close();
+ }
+ public void onError(Exception e) {
+ byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+ org.apache.thrift.TBase msg;
+ startLeaderSelector_result result = new startLeaderSelector_result();
+ {
+ msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+ msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+ }
+ try {
+ fcall.sendResponse(fb,msg,msgType,seqid);
+ return;
+ } catch (Exception ex) {
+ LOGGER.error("Exception writing to internal frame buffer", ex);
+ }
+ fb.close();
+ }
+ };
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public void start(I iface, startLeaderSelector_args args, org.apache.thrift.async.AsyncMethodCallback<LeaderResult> resultHandler) throws TException {
+ iface.startLeaderSelector(args.projection, args.path, args.participantId, args.waitForLeadershipMs,resultHandler);
+ }
+ }
+
}
public static class acquireLock_args implements org.apache.thrift.TBase<acquireLock_args, acquireLock_args._Fields>, java.io.Serializable, Cloneable, Comparable<acquireLock_args> {
@@ -9347,4 +9491,1020 @@ public class CuratorService {
}
+ public static class startLeaderSelector_args implements org.apache.thrift.TBase<startLeaderSelector_args, startLeaderSelector_args._Fields>, java.io.Serializable, Cloneable, Comparable<startLeaderSelector_args> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("startLeaderSelector_args");
+
+ private static final org.apache.thrift.protocol.TField PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("projection", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+ private static final org.apache.thrift.protocol.TField PATH_FIELD_DESC = new org.apache.thrift.protocol.TField("path", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField PARTICIPANT_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("participantId", org.apache.thrift.protocol.TType.STRING, (short)3);
+ private static final org.apache.thrift.protocol.TField WAIT_FOR_LEADERSHIP_MS_FIELD_DESC = new org.apache.thrift.protocol.TField("waitForLeadershipMs", org.apache.thrift.protocol.TType.I32, (short)4);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new startLeaderSelector_argsStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new startLeaderSelector_argsTupleSchemeFactory());
+ }
+
+ public CuratorProjection projection; // required
+ public String path; // required
+ public String participantId; // required
+ public int waitForLeadershipMs; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ PROJECTION((short)1, "projection"),
+ PATH((short)2, "path"),
+ PARTICIPANT_ID((short)3, "participantId"),
+ WAIT_FOR_LEADERSHIP_MS((short)4, "waitForLeadershipMs");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // PROJECTION
+ return PROJECTION;
+ case 2: // PATH
+ return PATH;
+ case 3: // PARTICIPANT_ID
+ return PARTICIPANT_ID;
+ case 4: // WAIT_FOR_LEADERSHIP_MS
+ return WAIT_FOR_LEADERSHIP_MS;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ private static final int __WAITFORLEADERSHIPMS_ISSET_ID = 0;
+ private byte __isset_bitfield = 0;
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("projection", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CuratorProjection.class)));
+ tmpMap.put(_Fields.PATH, new org.apache.thrift.meta_data.FieldMetaData("path", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.PARTICIPANT_ID, new org.apache.thrift.meta_data.FieldMetaData("participantId", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.WAIT_FOR_LEADERSHIP_MS, new org.apache.thrift.meta_data.FieldMetaData("waitForLeadershipMs", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(startLeaderSelector_args.class, metaDataMap);
+ }
+
+ public startLeaderSelector_args() {
+ }
+
+ public startLeaderSelector_args(
+ CuratorProjection projection,
+ String path,
+ String participantId,
+ int waitForLeadershipMs)
+ {
+ this();
+ this.projection = projection;
+ this.path = path;
+ this.participantId = participantId;
+ this.waitForLeadershipMs = waitForLeadershipMs;
+ setWaitForLeadershipMsIsSet(true);
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public startLeaderSelector_args(startLeaderSelector_args other) {
+ __isset_bitfield = other.__isset_bitfield;
+ if (other.isSetProjection()) {
+ this.projection = new CuratorProjection(other.projection);
+ }
+ if (other.isSetPath()) {
+ this.path = other.path;
+ }
+ if (other.isSetParticipantId()) {
+ this.participantId = other.participantId;
+ }
+ this.waitForLeadershipMs = other.waitForLeadershipMs;
+ }
+
+ public startLeaderSelector_args deepCopy() {
+ return new startLeaderSelector_args(this);
+ }
+
+ @Override
+ public void clear() {
+ this.projection = null;
+ this.path = null;
+ this.participantId = null;
+ setWaitForLeadershipMsIsSet(false);
+ this.waitForLeadershipMs = 0;
+ }
+
+ public CuratorProjection getProjection() {
+ return this.projection;
+ }
+
+ public startLeaderSelector_args setProjection(CuratorProjection projection) {
+ this.projection = projection;
+ return this;
+ }
+
+ public void unsetProjection() {
+ this.projection = null;
+ }
+
+ /** Returns true if field projection is set (has been assigned a value) and false otherwise */
+ public boolean isSetProjection() {
+ return this.projection != null;
+ }
+
+ public void setProjectionIsSet(boolean value) {
+ if (!value) {
+ this.projection = null;
+ }
+ }
+
+ public String getPath() {
+ return this.path;
+ }
+
+ public startLeaderSelector_args setPath(String path) {
+ this.path = path;
+ return this;
+ }
+
+ public void unsetPath() {
+ this.path = null;
+ }
+
+ /** Returns true if field path is set (has been assigned a value) and false otherwise */
+ public boolean isSetPath() {
+ return this.path != null;
+ }
+
+ public void setPathIsSet(boolean value) {
+ if (!value) {
+ this.path = null;
+ }
+ }
+
+ public String getParticipantId() {
+ return this.participantId;
+ }
+
+ public startLeaderSelector_args setParticipantId(String participantId) {
+ this.participantId = participantId;
+ return this;
+ }
+
+ public void unsetParticipantId() {
+ this.participantId = null;
+ }
+
+ /** Returns true if field participantId is set (has been assigned a value) and false otherwise */
+ public boolean isSetParticipantId() {
+ return this.participantId != null;
+ }
+
+ public void setParticipantIdIsSet(boolean value) {
+ if (!value) {
+ this.participantId = null;
+ }
+ }
+
+ public int getWaitForLeadershipMs() {
+ return this.waitForLeadershipMs;
+ }
+
+ public startLeaderSelector_args setWaitForLeadershipMs(int waitForLeadershipMs) {
+ this.waitForLeadershipMs = waitForLeadershipMs;
+ setWaitForLeadershipMsIsSet(true);
+ return this;
+ }
+
+ public void unsetWaitForLeadershipMs() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __WAITFORLEADERSHIPMS_ISSET_ID);
+ }
+
+ /** Returns true if field waitForLeadershipMs is set (has been assigned a value) and false otherwise */
+ public boolean isSetWaitForLeadershipMs() {
+ return EncodingUtils.testBit(__isset_bitfield, __WAITFORLEADERSHIPMS_ISSET_ID);
+ }
+
+ public void setWaitForLeadershipMsIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __WAITFORLEADERSHIPMS_ISSET_ID, value);
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case PROJECTION:
+ if (value == null) {
+ unsetProjection();
+ } else {
+ setProjection((CuratorProjection)value);
+ }
+ break;
+
+ case PATH:
+ if (value == null) {
+ unsetPath();
+ } else {
+ setPath((String)value);
+ }
+ break;
+
+ case PARTICIPANT_ID:
+ if (value == null) {
+ unsetParticipantId();
+ } else {
+ setParticipantId((String)value);
+ }
+ break;
+
+ case WAIT_FOR_LEADERSHIP_MS:
+ if (value == null) {
+ unsetWaitForLeadershipMs();
+ } else {
+ setWaitForLeadershipMs((Integer)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PROJECTION:
+ return getProjection();
+
+ case PATH:
+ return getPath();
+
+ case PARTICIPANT_ID:
+ return getParticipantId();
+
+ case WAIT_FOR_LEADERSHIP_MS:
+ return Integer.valueOf(getWaitForLeadershipMs());
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case PROJECTION:
+ return isSetProjection();
+ case PATH:
+ return isSetPath();
+ case PARTICIPANT_ID:
+ return isSetParticipantId();
+ case WAIT_FOR_LEADERSHIP_MS:
+ return isSetWaitForLeadershipMs();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof startLeaderSelector_args)
+ return this.equals((startLeaderSelector_args)that);
+ return false;
+ }
+
+ public boolean equals(startLeaderSelector_args that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_projection = true && this.isSetProjection();
+ boolean that_present_projection = true && that.isSetProjection();
+ if (this_present_projection || that_present_projection) {
+ if (!(this_present_projection && that_present_projection))
+ return false;
+ if (!this.projection.equals(that.projection))
+ return false;
+ }
+
+ boolean this_present_path = true && this.isSetPath();
+ boolean that_present_path = true && that.isSetPath();
+ if (this_present_path || that_present_path) {
+ if (!(this_present_path && that_present_path))
+ return false;
+ if (!this.path.equals(that.path))
+ return false;
+ }
+
+ boolean this_present_participantId = true && this.isSetParticipantId();
+ boolean that_present_participantId = true && that.isSetParticipantId();
+ if (this_present_participantId || that_present_participantId) {
+ if (!(this_present_participantId && that_present_participantId))
+ return false;
+ if (!this.participantId.equals(that.participantId))
+ return false;
+ }
+
+ boolean this_present_waitForLeadershipMs = true;
+ boolean that_present_waitForLeadershipMs = true;
+ if (this_present_waitForLeadershipMs || that_present_waitForLeadershipMs) {
+ if (!(this_present_waitForLeadershipMs && that_present_waitForLeadershipMs))
+ return false;
+ if (this.waitForLeadershipMs != that.waitForLeadershipMs)
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public int compareTo(startLeaderSelector_args other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = Boolean.valueOf(isSetProjection()).compareTo(other.isSetProjection());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetProjection()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.projection, other.projection);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetPath()).compareTo(other.isSetPath());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetPath()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.path, other.path);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetParticipantId()).compareTo(other.isSetParticipantId());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetParticipantId()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.participantId, other.participantId);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetWaitForLeadershipMs()).compareTo(other.isSetWaitForLeadershipMs());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetWaitForLeadershipMs()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.waitForLeadershipMs, other.waitForLeadershipMs);
+ 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("startLeaderSelector_args(");
+ boolean first = true;
+
+ sb.append("projection:");
+ if (this.projection == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.projection);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("path:");
+ if (this.path == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.path);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("participantId:");
+ if (this.participantId == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.participantId);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("waitForLeadershipMs:");
+ sb.append(this.waitForLeadershipMs);
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ // check for sub-struct validity
+ if (projection != null) {
+ projection.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
+ __isset_bitfield = 0;
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class startLeaderSelector_argsStandardSchemeFactory implements SchemeFactory {
+ public startLeaderSelector_argsStandardScheme getScheme() {
+ return new startLeaderSelector_argsStandardScheme();
+ }
+ }
+
+ private static class startLeaderSelector_argsStandardScheme extends StandardScheme<startLeaderSelector_args> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, startLeaderSelector_args struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // PROJECTION
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.projection = new CuratorProjection();
+ struct.projection.read(iprot);
+ struct.setProjectionIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // PATH
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.path = iprot.readString();
+ struct.setPathIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // PARTICIPANT_ID
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.participantId = iprot.readString();
+ struct.setParticipantIdIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // WAIT_FOR_LEADERSHIP_MS
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.waitForLeadershipMs = iprot.readI32();
+ struct.setWaitForLeadershipMsIsSet(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, startLeaderSelector_args struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.projection != null) {
+ oprot.writeFieldBegin(PROJECTION_FIELD_DESC);
+ struct.projection.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ if (struct.path != null) {
+ oprot.writeFieldBegin(PATH_FIELD_DESC);
+ oprot.writeString(struct.path);
+ oprot.writeFieldEnd();
+ }
+ if (struct.participantId != null) {
+ oprot.writeFieldBegin(PARTICIPANT_ID_FIELD_DESC);
+ oprot.writeString(struct.participantId);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldBegin(WAIT_FOR_LEADERSHIP_MS_FIELD_DESC);
+ oprot.writeI32(struct.waitForLeadershipMs);
+ oprot.writeFieldEnd();
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class startLeaderSelector_argsTupleSchemeFactory implements SchemeFactory {
+ public startLeaderSelector_argsTupleScheme getScheme() {
+ return new startLeaderSelector_argsTupleScheme();
+ }
+ }
+
+ private static class startLeaderSelector_argsTupleScheme extends TupleScheme<startLeaderSelector_args> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, startLeaderSelector_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetProjection()) {
+ optionals.set(0);
+ }
+ if (struct.isSetPath()) {
+ optionals.set(1);
+ }
+ if (struct.isSetParticipantId()) {
+ optionals.set(2);
+ }
+ if (struct.isSetWaitForLeadershipMs()) {
+ optionals.set(3);
+ }
+ oprot.writeBitSet(optionals, 4);
+ if (struct.isSetProjection()) {
+ struct.projection.write(oprot);
+ }
+ if (struct.isSetPath()) {
+ oprot.writeString(struct.path);
+ }
+ if (struct.isSetParticipantId()) {
+ oprot.writeString(struct.participantId);
+ }
+ if (struct.isSetWaitForLeadershipMs()) {
+ oprot.writeI32(struct.waitForLeadershipMs);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, startLeaderSelector_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(4);
+ if (incoming.get(0)) {
+ struct.projection = new CuratorProjection();
+ struct.projection.read(iprot);
+ struct.setProjectionIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.path = iprot.readString();
+ struct.setPathIsSet(true);
+ }
+ if (incoming.get(2)) {
+ struct.participantId = iprot.readString();
+ struct.setParticipantIdIsSet(true);
+ }
+ if (incoming.get(3)) {
+ struct.waitForLeadershipMs = iprot.readI32();
+ struct.setWaitForLeadershipMsIsSet(true);
+ }
+ }
+ }
+
+ }
+
+ public static class startLeaderSelector_result implements org.apache.thrift.TBase<startLeaderSelector_result, startLeaderSelector_result._Fields>, java.io.Serializable, Cloneable, Comparable<startLeaderSelector_result> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("startLeaderSelector_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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new startLeaderSelector_resultStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new startLeaderSelector_resultTupleSchemeFactory());
+ }
+
+ public LeaderResult success; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ SUCCESS((short)0, "success");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 0: // SUCCESS
+ return SUCCESS;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, LeaderResult.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(startLeaderSelector_result.class, metaDataMap);
+ }
+
+ public startLeaderSelector_result() {
+ }
+
+ public startLeaderSelector_result(
+ LeaderResult success)
+ {
+ this();
+ this.success = success;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public startLeaderSelector_result(startLeaderSelector_result other) {
+ if (other.isSetSuccess()) {
+ this.success = new LeaderResult(other.success);
+ }
+ }
+
+ public startLeaderSelector_result deepCopy() {
+ return new startLeaderSelector_result(this);
+ }
+
+ @Override
+ public void clear() {
+ this.success = null;
+ }
+
+ public LeaderResult getSuccess() {
+ return this.success;
+ }
+
+ public startLeaderSelector_result setSuccess(LeaderResult success) {
+ this.success = success;
+ return this;
+ }
+
+ public void unsetSuccess() {
+ this.success = null;
+ }
+
+ /** Returns true if field success is set (has been assigned a value) and false otherwise */
+ public boolean isSetSuccess() {
+ return this.success != null;
+ }
+
+ public void setSuccessIsSet(boolean value) {
+ if (!value) {
+ this.success = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case SUCCESS:
+ if (value == null) {
+ unsetSuccess();
+ } else {
+ setSuccess((LeaderResult)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case SUCCESS:
+ return getSuccess();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case SUCCESS:
+ return isSetSuccess();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof startLeaderSelector_result)
+ return this.equals((startLeaderSelector_result)that);
+ return false;
+ }
+
+ public boolean equals(startLeaderSelector_result that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_success = true && this.isSetSuccess();
+ boolean that_present_success = true && that.isSetSuccess();
+ if (this_present_success || that_present_success) {
+ if (!(this_present_success && that_present_success))
+ return false;
+ if (!this.success.equals(that.success))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public int compareTo(startLeaderSelector_result other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetSuccess()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ return 0;
+ }
+
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("startLeaderSelector_result(");
+ boolean first = true;
+
+ sb.append("success:");
+ if (this.success == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.success);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ // check for sub-struct validity
+ if (success != null) {
+ success.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class startLeaderSelector_resultStandardSchemeFactory implements SchemeFactory {
+ public startLeaderSelector_resultStandardScheme getScheme() {
+ return new startLeaderSelector_resultStandardScheme();
+ }
+ }
+
+ private static class startLeaderSelector_resultStandardScheme extends StandardScheme<startLeaderSelector_result> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, startLeaderSelector_result struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 0: // SUCCESS
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.success = new LeaderResult();
+ struct.success.read(iprot);
+ struct.setSuccessIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+
+ // check for required fields of primitive type, which can't be checked in the validate method
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, startLeaderSelector_result struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.success != null) {
+ oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+ struct.success.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class startLeaderSelector_resultTupleSchemeFactory implements SchemeFactory {
+ public startLeaderSelector_resultTupleScheme getScheme() {
+ return new startLeaderSelector_resultTupleScheme();
+ }
+ }
+
+ private static class startLeaderSelector_resultTupleScheme extends TupleScheme<startLeaderSelector_result> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, startLeaderSelector_result struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetSuccess()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetSuccess()) {
+ struct.success.write(oprot);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, startLeaderSelector_result struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.success = new LeaderResult();
+ struct.success.read(iprot);
+ struct.setSuccessIsSet(true);
+ }
+ }
+ }
+
+ }
+
}