curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From madrob <...@git.apache.org>
Subject [GitHub] curator pull request: CURATOR-164 prevent phantom services
Date Tue, 21 Apr 2015 18:05:30 GMT
Github user madrob commented on a diff in the pull request:

    https://github.com/apache/curator/pull/72#discussion_r28805374
  
    --- Diff: curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceDiscoveryImpl.java
---
    @@ -228,15 +234,18 @@ protected void     internalRegisterService(ServiceInstance<T>
service) throws Ex
         public void     unregisterService(ServiceInstance<T> service) throws Exception
         {
             String          path = pathForInstance(service.getName(), service.getId());
    -        try
    -        {
    -            client.delete().forPath(path);
    -        }
    -        catch ( KeeperException.NoNodeException ignore )
    -        {
    -            // ignore
    +        synchronized(service) {
    --- End diff --
    
    Imagine the following sequence:
    
    T1: reconnect()
    T2: unregister(X)
    T1: for each service in cache:
    T1:   register(X)
    T2: services.remove(X)
    T2: client.delete(X)
    T1: client.create(X)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message