Return-Path: X-Original-To: apmail-curator-dev-archive@minotaur.apache.org Delivered-To: apmail-curator-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D55FE17845 for ; Tue, 21 Apr 2015 17:29:35 +0000 (UTC) Received: (qmail 72147 invoked by uid 500); 21 Apr 2015 17:29:35 -0000 Delivered-To: apmail-curator-dev-archive@curator.apache.org Received: (qmail 72105 invoked by uid 500); 21 Apr 2015 17:29:35 -0000 Mailing-List: contact dev-help@curator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@curator.apache.org Delivered-To: mailing list dev@curator.apache.org Delivered-To: moderator for dev@curator.apache.org Received: (qmail 54785 invoked by uid 99); 21 Apr 2015 17:23:54 -0000 From: Randgalt To: dev@curator.apache.org Reply-To: dev@curator.apache.org References: In-Reply-To: Subject: [GitHub] curator pull request: CURATOR-164 prevent phantom services Content-Type: text/plain Message-Id: <20150421172354.91C46E04B7@git1-us-west.apache.org> Date: Tue, 21 Apr 2015 17:23:54 +0000 (UTC) Github user Randgalt commented on a diff in the pull request: https://github.com/apache/curator/pull/72#discussion_r28801137 --- Diff: curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceDiscoveryImpl.java --- @@ -207,9 +207,15 @@ protected void internalRegisterService(ServiceInstance service) throws Ex { try { - CreateMode mode = (service.getServiceType() == ServiceType.DYNAMIC) ? CreateMode.EPHEMERAL : CreateMode.PERSISTENT; - client.create().creatingParentsIfNeeded().withMode(mode).forPath(path, bytes); - isDone = true; + synchronized(service) { + // Check that the service didn't get deleted while we were reconnecting + if (services.containsKey(service.getId())) --- End diff -- Why is this needed? The test passes without this and logically it seems unnecessary. --- 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. ---