Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 38866 invoked from network); 30 Mar 2008 14:44:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Mar 2008 14:44:09 -0000 Received: (qmail 53183 invoked by uid 500); 30 Mar 2008 14:44:08 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 53158 invoked by uid 500); 30 Mar 2008 14:44:08 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 53147 invoked by uid 99); 30 Mar 2008 14:44:08 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 30 Mar 2008 07:44:08 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 30 Mar 2008 14:43:26 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id D680B1A9832; Sun, 30 Mar 2008 07:43:45 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: derby-commits@db.apache.org From: kahatlen@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080330144345.D680B1A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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) {