hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sur...@apache.org
Subject svn commit: r1507416 - in /hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common: CHANGES.txt src/main/java/org/apache/hadoop/ipc/RetryCache.java
Date Fri, 26 Jul 2013 20:02:36 GMT
Author: suresh
Date: Fri Jul 26 20:02:35 2013
New Revision: 1507416

URL: http://svn.apache.org/r1507416
Log:
HADOOP-9770. Merge 1507414 from trunk.

Modified:
    hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/CHANGES.txt
    hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/RetryCache.java

Modified: hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/CHANGES.txt?rev=1507416&r1=1507415&r2=1507416&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/CHANGES.txt (original)
+++ hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/CHANGES.txt Fri Jul
26 20:02:35 2013
@@ -223,6 +223,8 @@ Release 2.1.0-beta - 2013-07-02
     HADOOP-9760. Move GSet and related classes to common from HDFS.
     (suresh)
 
+    HADOOP-9770. Make RetryCache#state non volatile. (suresh)
+
   OPTIMIZATIONS
 
     HADOOP-9150. Avoid unnecessary DNS resolution attempts for logical URIs

Modified: hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/RetryCache.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/RetryCache.java?rev=1507416&r1=1507415&r2=1507416&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/RetryCache.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/RetryCache.java
Fri Jul 26 20:02:35 2013
@@ -52,7 +52,7 @@ public class RetryCache {
     private static byte SUCCESS = 1;
     private static byte FAILED = 2;
 
-    private volatile byte state = INPROGRESS;
+    private byte state = INPROGRESS;
     
     // Store uuid as two long for better memory utilization
     private final long clientIdMsb; // Most signficant bytes
@@ -63,8 +63,10 @@ public class RetryCache {
     private LightWeightGSet.LinkedElement next;
 
     CacheEntry(byte[] clientId, int callId, long expirationTime) {
-      Preconditions.checkArgument(clientId.length == 16, "Invalid clientId");
-      // Conver UUID bytes to two longs
+      // ClientId must be a UUID - that is 16 octets.
+      Preconditions.checkArgument(clientId.length == 16,
+          "Invalid clientId - must be UUID of size 16 octets");
+      // Convert UUID bytes to two longs
       long tmp = 0;
       for (int i=0; i<8; i++) {
         tmp = (tmp << 8) | (clientId[i] & 0xff);
@@ -116,7 +118,7 @@ public class RetryCache {
       this.notifyAll();
     }
 
-    public boolean isSuccess() {
+    public synchronized boolean isSuccess() {
       return state == SUCCESS;
     }
 
@@ -241,13 +243,13 @@ public class RetryCache {
 
   private static CacheEntry newEntry(long expirationTime) {
     return new CacheEntry(Server.getClientId(), Server.getCallId(),
-        expirationTime);
+        System.nanoTime() + expirationTime);
   }
 
   private static CacheEntryWithPayload newEntry(Object payload,
       long expirationTime) {
     return new CacheEntryWithPayload(Server.getClientId(), Server.getCallId(),
-        payload, expirationTime);
+        payload, System.nanoTime() + expirationTime);
   }
 
   /** Static method that provides null check for retryCache */



Mime
View raw message