Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 81399 invoked from network); 4 Sep 2007 14:47:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Sep 2007 14:47:48 -0000 Received: (qmail 35496 invoked by uid 500); 4 Sep 2007 14:47:43 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 35477 invoked by uid 500); 4 Sep 2007 14:47:43 -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 35466 invoked by uid 99); 4 Sep 2007 14:47:43 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Sep 2007 07:47:43 -0700 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; Tue, 04 Sep 2007 14:47:48 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id CC5671A9832; Tue, 4 Sep 2007 07:47:27 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r572693 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/services/cache/ConcurrentCache.java Date: Tue, 04 Sep 2007 14:47:27 -0000 To: derby-commits@db.apache.org From: kahatlen@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20070904144727.CC5671A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kahatlen Date: Tue Sep 4 07:47:27 2007 New Revision: 572693 URL: http://svn.apache.org/viewvc?rev=572693&view=rev Log: DERBY-2911 (partial) Implemented CacheManager.values() for ConcurrentCache Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/cache/ConcurrentCache.java Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/cache/ConcurrentCache.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/services/cache/ConcurrentCache.java?rev=572693&r1=572692&r2=572693&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/impl/services/cache/ConcurrentCache.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/impl/services/cache/ConcurrentCache.java Tue Sep 4 07:47:27 2007 @@ -21,6 +21,7 @@ package org.apache.derby.impl.services.cache; +import java.util.ArrayList; import java.util.Collection; import java.util.concurrent.ConcurrentHashMap; import org.apache.derby.iapi.error.StandardException; @@ -401,8 +402,28 @@ return allRemoved; } - public Collection values() { - // TODO - return null; + /** + * Return a collection view of all the Cacheables in the + * cache. There is no guarantee that the objects in the collection can be + * accessed in a thread-safe manner once this method has returned, so it + * should only be used for diagnostic purposes. (Currently, it is only used + * by the StatementCache VTI.) + * + * @return a collection view of the objects in the cache + */ + public Collection values() { + ArrayList values = new ArrayList(); + for (CacheEntry entry : cache.values()) { + entry.lock(); + try { + Cacheable c = entry.getCacheable(); + if (c != null) { + values.add(c); + } + } finally { + entry.unlock(); + } + } + return values; } }