cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From skolbac...@apache.org
Subject [1/2] cayenne git commit: using AtomicLong.getAndIncrement() instead of UUID.randomUUID() in DefaultListBuilder
Date Mon, 30 Nov 2015 16:06:03 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master fcc9d922d -> 5bb12cd36


using AtomicLong.getAndIncrement() instead of UUID.randomUUID() in DefaultListBuilder


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

Branch: refs/heads/master
Commit: 82c2ed5917041fa47a2f2046d6569a44809501bf
Parents: fcc9d92
Author: Savva Kolbachev <s.kolbachev@gmail.com>
Authored: Mon Nov 30 16:30:14 2015 +0300
Committer: Savva Kolbachev <s.kolbachev@gmail.com>
Committed: Mon Nov 30 16:30:14 2015 +0300

----------------------------------------------------------------------
 .../java/org/apache/cayenne/di/spi/DefaultListBuilder.java    | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/82c2ed59/cayenne-di/src/main/java/org/apache/cayenne/di/spi/DefaultListBuilder.java
----------------------------------------------------------------------
diff --git a/cayenne-di/src/main/java/org/apache/cayenne/di/spi/DefaultListBuilder.java b/cayenne-di/src/main/java/org/apache/cayenne/di/spi/DefaultListBuilder.java
index fcf6a28..c05ae10 100644
--- a/cayenne-di/src/main/java/org/apache/cayenne/di/spi/DefaultListBuilder.java
+++ b/cayenne-di/src/main/java/org/apache/cayenne/di/spi/DefaultListBuilder.java
@@ -29,13 +29,14 @@ import java.util.Collection;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.UUID;
+import java.util.concurrent.atomic.AtomicLong;
 
 /**
  * @since 3.1
  */
 class DefaultListBuilder<T> implements ListBuilder<T> {
 
+    protected static AtomicLong incrementer = new AtomicLong();
     protected DefaultInjector injector;
     protected Key<List<?>> bindingKey;
 
@@ -80,7 +81,7 @@ class DefaultListBuilder<T> implements ListBuilder<T> {
         Provider<T> provider0 = new InstanceProvider<T>(object);
         Provider<T> provider1 = new FieldInjectingProvider<T>(provider0, injector);
 
-        getListProvider().add(Key.get(object.getClass(), UUID.randomUUID().toString()), provider1);
+        getListProvider().add(Key.get(object.getClass(), String.valueOf(incrementer.getAndIncrement())),
provider1);
         return this;
     }
 
@@ -124,7 +125,7 @@ class DefaultListBuilder<T> implements ListBuilder<T> {
             Provider<T> provider0 = new InstanceProvider<T>(object);
             Provider<T> provider1 = new FieldInjectingProvider<T>(provider0,
injector);
 
-            keyProviderMap.put(Key.get(object.getClass(), UUID.randomUUID().toString()),
provider1);
+            keyProviderMap.put(Key.get(object.getClass(), String.valueOf(incrementer.getAndIncrement())),
provider1);
         }
 
         getListProvider().addAll(keyProviderMap);


Mime
View raw message