You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/07/23 12:03:16 UTC

[32/33] incubator-ignite git commit: # gg-10561: session expiration (change)

# gg-10561: session expiration (change)


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

Branch: refs/heads/ignite-gg-10561
Commit: 1f86c20c61af501b3348d678ccfded5052d0c483
Parents: 3bfbb9b
Author: ashutak <as...@gridgain.com>
Authored: Thu Jul 23 12:07:44 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Thu Jul 23 12:07:44 2015 +0300

----------------------------------------------------------------------
 .../processors/rest/GridRestProcessor.java         | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1f86c20c/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
index 754bdb3..3f10f0a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
@@ -64,7 +64,7 @@ public class GridRestProcessor extends GridProcessorAdapter {
     /** Delay between sessions expire checks*/
     private static final int SES_EXPIRE_CHECK_DELAY = 1_000;
 
-    /** TODO */
+    /** */
     private static final int SES_EXPERATION_TIME = 30_000;
 
     /** Protocols. */
@@ -840,7 +840,7 @@ public class GridRestProcessor extends GridProcessorAdapter {
             if (U.currentTimeMillis() - time0 > SES_EXPERATION_TIME)
                 lastTouchTime.compareAndSet(time0, EXPIRED_FLAG);
 
-            return lastTouchTime.get() == EXPIRED_FLAG;
+            return isExpired();
         }
 
         /**
@@ -848,17 +848,14 @@ public class GridRestProcessor extends GridProcessorAdapter {
          * @return <code>True</code> if expired.
          */
         boolean checkExpirationAndTryUpdateLastTouchTime() {
-            while(true) {
-                long time0 = lastTouchTime.get();
+            long time0 = lastTouchTime.get();
 
-                if (time0 == EXPIRED_FLAG)
-                    return true;
+            if (time0 == EXPIRED_FLAG)
+                return true;
 
-                boolean success = lastTouchTime.compareAndSet(time0, U.currentTimeMillis());
+            lastTouchTime.compareAndSet(time0, U.currentTimeMillis());
 
-                if (success)
-                    return false;
-            }
+            return isExpired();
         }
 
         /**