ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yzhda...@apache.org
Subject ignite git commit: fixed https://issues.apache.org/jira/browse/IGNITE-2078
Date Thu, 10 Dec 2015 17:07:26 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-1.5 5ba664c48 -> 1bc137394


fixed https://issues.apache.org/jira/browse/IGNITE-2078


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1bc13739
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1bc13739
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1bc13739

Branch: refs/heads/ignite-1.5
Commit: 1bc137394e7530096f10cf5f38f4982d6c1115f3
Parents: 5ba664c
Author: Yakov Zhdanov <yzhdanov@gridgain.com>
Authored: Thu Dec 10 20:07:16 2015 +0300
Committer: Yakov Zhdanov <yzhdanov@gridgain.com>
Committed: Thu Dec 10 20:07:16 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/examples/model/Organization.java  | 16 ++++------------
 .../org/apache/ignite/examples/model/Person.java    | 16 ++++------------
 2 files changed, 8 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/1bc13739/examples/src/main/java/org/apache/ignite/examples/model/Organization.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/model/Organization.java b/examples/src/main/java/org/apache/ignite/examples/model/Organization.java
index 3dcaa44..2500584 100644
--- a/examples/src/main/java/org/apache/ignite/examples/model/Organization.java
+++ b/examples/src/main/java/org/apache/ignite/examples/model/Organization.java
@@ -17,17 +17,16 @@
 
 package org.apache.ignite.examples.model;
 
-import org.apache.ignite.cache.query.annotations.QuerySqlField;
-
 import java.io.Serializable;
-import java.util.Random;
+import java.util.concurrent.atomic.AtomicLong;
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
 
 /**
  * Organization class.
  */
 public class Organization implements Serializable {
     /** */
-    private static final Random RND = new Random();
+    private static final AtomicLong ID_GEN = new AtomicLong();
 
     /** Organization ID (indexed). */
     @QuerySqlField(index = true)
@@ -38,19 +37,12 @@ public class Organization implements Serializable {
     public String name;
 
     /**
-     * Default empty constructor.
-     */
-    public Organization() {
-        // No-op.
-    }
-
-    /**
      * Create organization.
      *
      * @param name Organization name.
      */
     public Organization(String name) {
-        id = RND.nextLong();
+        id = ID_GEN.incrementAndGet();
 
         this.name = name;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/1bc13739/examples/src/main/java/org/apache/ignite/examples/model/Person.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/model/Person.java b/examples/src/main/java/org/apache/ignite/examples/model/Person.java
index 5ccda51..5f7deae 100644
--- a/examples/src/main/java/org/apache/ignite/examples/model/Person.java
+++ b/examples/src/main/java/org/apache/ignite/examples/model/Person.java
@@ -17,19 +17,18 @@
 
 package org.apache.ignite.examples.model;
 
+import java.io.Serializable;
+import java.util.concurrent.atomic.AtomicLong;
 import org.apache.ignite.cache.affinity.AffinityKey;
 import org.apache.ignite.cache.query.annotations.QuerySqlField;
 import org.apache.ignite.cache.query.annotations.QueryTextField;
 
-import java.io.Serializable;
-import java.util.Random;
-
 /**
  * Person class.
  */
 public class Person implements Serializable {
     /** */
-    private static final Random RND = new Random();
+    private static final AtomicLong ID_GEN = new AtomicLong();
 
     /** Person ID (indexed). */
     @QuerySqlField(index = true)
@@ -59,13 +58,6 @@ public class Person implements Serializable {
     private transient AffinityKey<Long> key;
 
     /**
-     * Default empty constructor.
-     */
-    public Person() {
-        // No-op.
-    }
-
-    /**
      * Constructs person record.
      *
      * @param org       Organization.
@@ -76,7 +68,7 @@ public class Person implements Serializable {
      */
     public Person(Organization org, String firstName, String lastName, double salary, String
resume) {
         // Generate unique ID for this person.
-        id = RND.nextLong();
+        id = ID_GEN.incrementAndGet();
 
         orgId = org.id;
 


Mime
View raw message