db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r642752 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/services/cache/ClockPolicy.java
Date Sun, 30 Mar 2008 14:43:45 GMT
Author: kahatlen
Date: Sun Mar 30 07:43:45 2008
New Revision: 642752

URL: http://svn.apache.org/viewvc?rev=642752&view=rev
Log:
DERBY-2911: Implement a buffer manager using java.util.concurrent classes

Minor change in ClockPolicy.shrinkMe() to make it easier to read.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/services/cache/ClockPolicy.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/cache/ClockPolicy.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/services/cache/ClockPolicy.java?rev=642752&r1=642751&r2=642752&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/services/cache/ClockPolicy.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/services/cache/ClockPolicy.java
Sun Mar 30 07:43:45 2008
@@ -611,20 +611,24 @@
             final Holder h;
             final int size;
 
-            // The index of the holder we're looking at. Since no one else than
-            // us can remove elements from the clock while we're in this
-            // method, and new elements will be added at the end of the list,
-            // the index for a holder does not change until we remove it.
-            final int index;
-
+            // Fetch the next holder from the clock.
             synchronized (clock) {
                 size = clock.size();
                 if (pos >= size) {
                     pos = 0;
                 }
-                index = pos++;
-                h = clock.get(index);
+                h = clock.get(pos);
             }
+
+            // The index of the holder we're looking at. Since no one else than
+            // us can remove elements from the clock while we're in this
+            // method, and new elements will be added at the end of the list,
+            // the index for a holder does not change until we remove it.
+            final int index = pos;
+
+            // Let pos point at the index of the holder we'll look at in the
+            // next iteration.
+            pos++;
 
             // No need to shrink if the size isn't greater than maxSize.
             if (size <= maxSize) {



Mime
View raw message