Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 70DD9DF91 for ; Tue, 4 Sep 2012 02:29:36 +0000 (UTC) Received: (qmail 11995 invoked by uid 500); 4 Sep 2012 02:29:36 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 11962 invoked by uid 500); 4 Sep 2012 02:29:36 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 11955 invoked by uid 99); 4 Sep 2012 02:29:36 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Sep 2012 02:29:36 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Sep 2012 02:29:35 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 3F41723889B8; Tue, 4 Sep 2012 02:28:52 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1380435 - in /camel/branches/camel-2.9.x: ./ components/camel-hazelcast/src/main/java/org/apache/camel/processor/idempotent/hazelcast/HazelcastIdempotentRepository.java Date: Tue, 04 Sep 2012 02:28:52 -0000 To: commits@camel.apache.org From: ningjiang@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120904022852.3F41723889B8@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ningjiang Date: Tue Sep 4 02:28:51 2012 New Revision: 1380435 URL: http://svn.apache.org/viewvc?rev=1380435&view=rev Log: Merged revisions 1380418 via svnmerge from https://svn.apache.org/repos/asf/camel/branches/camel-2.10.x ................ r1380418 | ningjiang | 2012-09-04 09:17:18 +0800 (Tue, 04 Sep 2012) | 9 lines Merged revisions 1380157 via svnmerge from https://svn.apache.org/repos/asf/camel/trunk ........ r1380157 | ningjiang | 2012-09-03 15:54:01 +0800 (Mon, 03 Sep 2012) | 1 line CAMEL-5556 fixed the thread issue of camel-hazelcast ........ ................ Modified: camel/branches/camel-2.9.x/ (props changed) camel/branches/camel-2.9.x/components/camel-hazelcast/src/main/java/org/apache/camel/processor/idempotent/hazelcast/HazelcastIdempotentRepository.java Propchange: camel/branches/camel-2.9.x/ ------------------------------------------------------------------------------ Merged /camel/trunk:r1380157 Merged /camel/branches/camel-2.10.x:r1380418 Propchange: camel/branches/camel-2.9.x/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: camel/branches/camel-2.9.x/components/camel-hazelcast/src/main/java/org/apache/camel/processor/idempotent/hazelcast/HazelcastIdempotentRepository.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-hazelcast/src/main/java/org/apache/camel/processor/idempotent/hazelcast/HazelcastIdempotentRepository.java?rev=1380435&r1=1380434&r2=1380435&view=diff ============================================================================== --- camel/branches/camel-2.9.x/components/camel-hazelcast/src/main/java/org/apache/camel/processor/idempotent/hazelcast/HazelcastIdempotentRepository.java (original) +++ camel/branches/camel-2.9.x/components/camel-hazelcast/src/main/java/org/apache/camel/processor/idempotent/hazelcast/HazelcastIdempotentRepository.java Tue Sep 4 02:28:51 2012 @@ -24,7 +24,7 @@ import org.apache.camel.support.ServiceS public class HazelcastIdempotentRepository extends ServiceSupport implements IdempotentRepository { private String repositoryName; - private IMap repo; + private IMap repo; private HazelcastInstance hazelcastInstance; public HazelcastIdempotentRepository(HazelcastInstance hazelcastInstance) { @@ -48,22 +48,21 @@ public class HazelcastIdempotentReposito @Override public boolean add(String key) { - if (this.contains(key)) { - return false; - } else { - this.repo.put(key, false); - return true; + + Boolean found = this.repo.get(key); + if (found == null) { + Boolean returned = this.repo.putIfAbsent(key, false); + if (returned == null) { + return true; + } } + return false; + } @Override public boolean confirm(String key) { - if (this.contains(key)) { - this.repo.put(key, true); - return true; - } else { - return false; - } + return this.repo.replace(key, false, true); } @Override