curator-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From randg...@apache.org
Subject [1/4] curator git commit: Added a new DYNAMIC_SEQUENTIAL ServiceType which creates an EPHEMERAL_SEQUENTIAL node in Zookeeper
Date Mon, 28 Mar 2016 22:39:55 GMT
Repository: curator
Updated Branches:
  refs/heads/master 849968018 -> 3d1fca231


Added a new DYNAMIC_SEQUENTIAL ServiceType which creates an
EPHEMERAL_SEQUENTIAL node in Zookeeper


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

Branch: refs/heads/master
Commit: 6ebc69717570dc39d5f3d6a6b16828b35324356f
Parents: 33c19d6
Author: nirdothan <nir.dothan@amdocs.com>
Authored: Thu Mar 3 11:25:32 2016 +0200
Committer: nirdothan <nir.dothan@amdocs.com>
Committed: Thu Mar 3 11:27:04 2016 +0200

----------------------------------------------------------------------
 .../org/apache/curator/x/discovery/ServiceType.java     |  3 ++-
 .../x/discovery/details/ServiceDiscoveryImpl.java       | 12 +++++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/6ebc6971/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/ServiceType.java
----------------------------------------------------------------------
diff --git a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/ServiceType.java
b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/ServiceType.java
index a919ace..3268e62 100644
--- a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/ServiceType.java
+++ b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/ServiceType.java
@@ -22,5 +22,6 @@ public enum ServiceType
 {
     DYNAMIC,
     STATIC,
-    PERMANENT
+    PERMANENT, 
+    DYNAMIC_SEQUENTIAL
 }

http://git-wip-us.apache.org/repos/asf/curator/blob/6ebc6971/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceDiscoveryImpl.java
----------------------------------------------------------------------
diff --git a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceDiscoveryImpl.java
b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceDiscoveryImpl.java
index de81612..dd4d6ce 100644
--- a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceDiscoveryImpl.java
+++ b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceDiscoveryImpl.java
@@ -220,7 +220,17 @@ public class ServiceDiscoveryImpl<T> implements ServiceDiscovery<T>
         {
             try
             {
-                CreateMode mode = (service.getServiceType() == ServiceType.DYNAMIC) ? CreateMode.EPHEMERAL
: CreateMode.PERSISTENT;
+            	CreateMode mode;
+            	switch (service.getServiceType()){
+            	case DYNAMIC:
+            		mode =  CreateMode.EPHEMERAL;
+            		break; 
+            	case  DYNAMIC_SEQUENTIAL:
+            		mode =  CreateMode.EPHEMERAL_SEQUENTIAL;
+            		break; 
+            	default:
+            		mode = CreateMode.PERSISTENT;
+            	}
                 client.create().creatingParentContainersIfNeeded().withMode(mode).forPath(path,
bytes);
                 isDone = true;
             }


Mime
View raw message