Return-Path: Delivered-To: apmail-cocoon-cvs-archive@www.apache.org Received: (qmail 33941 invoked from network); 6 Dec 2007 20:00:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Dec 2007 20:00:13 -0000 Received: (qmail 7236 invoked by uid 500); 6 Dec 2007 20:00:01 -0000 Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 7167 invoked by uid 500); 6 Dec 2007 20:00:01 -0000 Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@cocoon.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@cocoon.apache.org Received: (qmail 7147 invoked by uid 99); 6 Dec 2007 20:00:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Dec 2007 12:00:01 -0800 X-ASF-Spam-Status: No, hits=-100.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; Thu, 06 Dec 2007 19:59:48 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 0C1FC1A9832; Thu, 6 Dec 2007 11:59:52 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r601836 - /cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java Date: Thu, 06 Dec 2007 19:59:51 -0000 To: cvs@cocoon.apache.org From: vgritsenko@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071206195952.0C1FC1A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: vgritsenko Date: Thu Dec 6 11:59:47 2007 New Revision: 601836 URL: http://svn.apache.org/viewvc?rev=601836&view=rev Log: better, more informative debug messages. returned boolean value was not used, switching to void return value. Modified: cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java Modified: cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java?rev=601836&r1=601835&r2=601836&view=diff ============================================================================== --- cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java (original) +++ cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java Thu Dec 6 11:59:47 2007 @@ -168,8 +168,9 @@ protected boolean waitForLock(Object key) { if (transientStore != null) { + final String lockKey = PIPELOCK_PREFIX + key; + // Get a lock object from the store - String lockKey = PIPELOCK_PREFIX + key; Object lock; synchronized (transientStore) { lock = transientStore.get(lockKey); @@ -177,20 +178,22 @@ // Avoid deadlock with self (see JIRA COCOON-1985). if (lock != null && lock != Thread.currentThread()) { + if (getLogger().isDebugEnabled()) { + getLogger().debug("Waiting on Lock '" + lockKey + "'"); + } + try { - // become owner of monitor synchronized (lock) { lock.wait(); } - } catch (InterruptedException e) { + if (getLogger().isDebugEnabled()) { - getLogger().debug("Interrupted waiting for other pipeline to finish processing, retrying...", e); + getLogger().debug("Notified on Lock '" + lockKey + "'"); } - return false; - } - if (getLogger().isDebugEnabled()) { - getLogger().debug("Other pipeline finished processing, retrying to get cached response."); + } catch (InterruptedException e) { + /* ignored */ } + return false; } } @@ -199,75 +202,61 @@ } /** - * makes the lock (instantiates a new object and puts it into the store) + * Makes the lock (instantiates a new object and puts it into the store) */ - protected boolean generateLock(Object key) { - boolean succeeded = true; - + protected void generateLock(Object key) { if (transientStore != null && key != null) { - String lockKey = PIPELOCK_PREFIX + key; + final String lockKey = PIPELOCK_PREFIX + key; + if (getLogger().isDebugEnabled()) { + getLogger().debug("Adding Lock '" + lockKey + "'"); + } synchronized (transientStore) { if (transientStore.containsKey(lockKey)) { - succeeded = false; if (getLogger().isDebugEnabled()) { - getLogger().debug("Lock already present in the store!"); + getLogger().debug("Lock EXISTS: '" + lockKey + "'"); } } else { Object lock = Thread.currentThread(); try { transientStore.store(lockKey, lock); } catch (IOException e) { - if (getLogger().isDebugEnabled()) { - getLogger().debug("Could not put lock in the store!", e); - } - succeeded = false; + /* should not happen */ } } } } - - return succeeded; } /** - * releases the lock (notifies it and removes it from the store) + * Releases the lock (notifies it and removes it from the store) */ - protected boolean releaseLock(Object key) { - boolean succeeded = true; - + protected void releaseLock(Object key) { if (transientStore != null && key != null) { - String lockKey = PIPELOCK_PREFIX + key; + final String lockKey = PIPELOCK_PREFIX + key; + if (getLogger().isDebugEnabled()) { + getLogger().debug("Releasing Lock '" + lockKey + "'"); + } Object lock = null; synchronized (transientStore) { if (!transientStore.containsKey(lockKey)) { - succeeded = false; if (getLogger().isDebugEnabled()) { - getLogger().debug("Lock not present in the store!"); + getLogger().debug("Lock MISSING: '" + lockKey + "'"); } } else { - try { - lock = transientStore.get(lockKey); - transientStore.remove(lockKey); - } catch (Exception e) { - if (getLogger().isDebugEnabled()) { - getLogger().debug("Could not get lock from the store!", e); - } - succeeded = false; - } + lock = transientStore.get(lockKey); + transientStore.remove(lockKey); } } - if (succeeded && lock != null) { - // become monitor owner + if (lock != null) { + // Notify everybody who's waiting synchronized (lock) { lock.notifyAll(); } } } - - return succeeded; } /**