removed some unneeded APIs

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

Branch: refs/heads/master
Commit: 1665084376546b518965294aab2e32e2ad24d6ac
Parents: d6a51f4
Author: randgalt <randg...@apache.org>
Authored: Tue Apr 21 17:49:53 2015 -0500
Committer: randgalt <randg...@apache.org>
Committed: Tue Apr 21 17:49:53 2015 -0500

----------------------------------------------------------------------
 .../curator/x/discovery/details/Holder.java     | 42 +-------------------
 .../discovery/details/ServiceDiscoveryImpl.java |  5 +--
 2 files changed, 4 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/16650843/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java
----------------------------------------------------------------------
diff --git 
a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java
 
b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java
index 69c7667..c126b29 100644
--- 
a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java
+++ 
b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java
@@ -19,8 +19,9 @@ class Holder<T>
     private long stateChangeMs;
     private final ReentrantLock lock = new ReentrantLock();
 
-    Holder(ServiceInstance<T> service)
+    Holder(ServiceInstance<T> service, NodeCache nodeCache)
     {
+        cache = nodeCache;
         this.service = service;
         setState(State.NEW);
     }
@@ -64,19 +65,6 @@ class Holder<T>
         }
     }
 
-    NodeCache getCache()
-    {
-        lock.lock();
-        try
-        {
-            return cache;
-        }
-        finally
-        {
-            lock.unlock();
-        }
-    }
-
     NodeCache getAndClearCache()
     {
         lock.lock();
@@ -92,32 +80,6 @@ class Holder<T>
         }
     }
 
-    void setCache(NodeCache cache)
-    {
-        lock.lock();
-        try
-        {
-            this.cache = cache;
-        }
-        finally
-        {
-            lock.unlock();
-        }
-    }
-
-    State getState()
-    {
-        lock.lock();
-        try
-        {
-            return state;
-        }
-        finally
-        {
-            lock.unlock();
-        }
-    }
-
     boolean isRegistered()
     {
         lock.lock();

http://git-wip-us.apache.org/repos/asf/curator/blob/16650843/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 ec049fd..f15a387 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
@@ -185,7 +185,7 @@ public class ServiceDiscoveryImpl<T> implements 
ServiceDiscovery<T>
         holder.getLock().lock();
         try
         {
-            if ( holder.getState() == Holder.State.UNREGISTERED )
+            if ( !holder.isRegistered() )
             {
                 throw new Exception("Service has been unregistered: " + 
service);
             }
@@ -516,10 +516,9 @@ public class ServiceDiscoveryImpl<T> implements 
ServiceDiscovery<T>
 
     private Holder<T> getOrMakeHolder(ServiceInstance<T> instance, NodeCache 
nodeCache)
     {
-        Holder<T> newHolder = new Holder<T>(instance);
+        Holder<T> newHolder = new Holder<T>(instance, nodeCache);
         Holder<T> oldHolder = services.putIfAbsent(instance.getId(), 
newHolder);
         Holder<T> useHolder = (oldHolder != null) ? oldHolder : newHolder;
-        useHolder.setCache(nodeCache);
         return useHolder;
     }
 

Reply via email to