Author: pats
Date: Mon Feb 14 03:37:05 2011
New Revision: 1070380

URL: http://svn.apache.org/viewvc?rev=1070380&view=rev
Log:
RIVER-391
Use a static synchronized method to update a static field, ensuring correct 
synchronization.

Modified:
    
river/jtsk/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/NBEUniqueEntry.java
    
river/jtsk/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/UniqueEntry.java

Modified: 
river/jtsk/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/NBEUniqueEntry.java
URL: 
http://svn.apache.org/viewvc/river/jtsk/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/NBEUniqueEntry.java?rev=1070380&r1=1070379&r2=1070380&view=diff
==============================================================================
--- 
river/jtsk/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/NBEUniqueEntry.java
 (original)
+++ 
river/jtsk/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/NBEUniqueEntry.java
 Mon Feb 14 03:37:05 2011
@@ -128,13 +128,14 @@ public class NBEUniqueEntry implements n
         originatingHostVM = ourVMName;
 
         // Grab nextID
-        int id;
-        synchronized (getClass()) {
-            id = nextID++;
-        }
+        int id = getID();
         entryID = new Integer(id);
     }
 
+    private static synchronized int getID() {
+        return nextID++;
+    }
+
     /**
      * Create a new <code>UniqueEntry</code> that can service as a
      * template to retrieve the passed UniqueEntry (or subclass) from
@@ -144,4 +145,12 @@ public class NBEUniqueEntry implements n
         originatingHostVM = entry.originatingHostVM;
         entryID = entry.entryID;
     }
+
+    @Override
+    public String toString() {
+        return "NBEUniqueEntry [entryID=" + entryID + ", originatingHostVM="
+                + originatingHostVM + ", toString()=" + super.toString() + "]";
+    }
+    
+ 
 }

Modified: 
river/jtsk/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/UniqueEntry.java
URL: 
http://svn.apache.org/viewvc/river/jtsk/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/UniqueEntry.java?rev=1070380&r1=1070379&r2=1070380&view=diff
==============================================================================
--- 
river/jtsk/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/UniqueEntry.java
 (original)
+++ 
river/jtsk/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/UniqueEntry.java
 Mon Feb 14 03:37:05 2011
@@ -122,12 +122,11 @@ public class UniqueEntry extends net.jin
         }
         originatingHostVM = ourVMName;
 
-        // Grab nextID
-        int id;
-        synchronized (getClass()) {
-            id = nextID++;
-        }
-        entryID = new Integer(id);
+        entryID = new Integer(getID());
+    }
+
+    private static synchronized int getID() {
+        return nextID++;
     }
 
     /**


Reply via email to