camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
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 GMT
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<String>
{
 
     private String repositoryName;
-    private IMap<String, Object> repo;
+    private IMap<String, Boolean> 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



Mime
View raw message