Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1021510BD8 for ; Wed, 8 Jan 2014 11:17:15 +0000 (UTC) Received: (qmail 34452 invoked by uid 500); 8 Jan 2014 11:17:09 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 34202 invoked by uid 500); 8 Jan 2014 11:17:08 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 34191 invoked by uid 99); 8 Jan 2014 11:17:06 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Jan 2014 11:17:06 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Jan 2014 11:17:00 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 573AA2388868; Wed, 8 Jan 2014 11:16:38 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1556494 - in /commons/proper/jcs/trunk/src: changes/ java/org/apache/commons/jcs/admin/ java/org/apache/commons/jcs/engine/control/ test/org/apache/commons/jcs/admin/ Date: Wed, 08 Jan 2014 11:16:37 -0000 To: commits@commons.apache.org From: tv@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140108111638.573AA2388868@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: tv Date: Wed Jan 8 11:16:37 2014 New Revision: 1556494 URL: http://svn.apache.org/r1556494 Log: Add simple JMX monitoring feature by exposing the JCSAdminBean to JMX Added: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/admin/JCSJMXBean.java (with props) commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/admin/TestJMX.java (with props) Modified: commons/proper/jcs/trunk/src/changes/changes.xml commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/admin/CacheElementInfo.java commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/admin/CacheRegionInfo.java commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/admin/JCSAdmin.jsp commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/admin/JCSAdminBean.java commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/control/CompositeCacheManager.java commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/admin/AdminBeanUnitTest.java Modified: commons/proper/jcs/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/changes/changes.xml?rev=1556494&r1=1556493&r2=1556494&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/changes/changes.xml (original) +++ commons/proper/jcs/trunk/src/changes/changes.xml Wed Jan 8 11:16:37 2014 @@ -20,6 +20,9 @@ + + Add simple JMX monitoring feature by exposing the JCSAdminBean to JMX + Improve performance of BlockDisk.write(Serializable) Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/admin/CacheElementInfo.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/admin/CacheElementInfo.java?rev=1556494&r1=1556493&r2=1556494&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/admin/CacheElementInfo.java (original) +++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/admin/CacheElementInfo.java Wed Jan 8 11:16:37 2014 @@ -1,5 +1,7 @@ package org.apache.commons.jcs.admin; +import java.beans.ConstructorProperties; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -25,21 +27,42 @@ package org.apache.commons.jcs.admin; public class CacheElementInfo { /** element key */ - String key = null; + private String key = null; /** is it eternal */ - boolean eternal = false; + private boolean eternal = false; /** when it was created */ - String createTime = null; + private String createTime = null; /** max life */ - long maxLifeSeconds = -1; + private long maxLifeSeconds = -1; /** when it will expire */ - long expiresInSeconds = -1; + private long expiresInSeconds = -1; /** + * Parameterized constructor + * + * @param key element key + * @param eternal is it eternal + * @param createTime when it was created + * @param maxLifeSeconds max life + * @param expiresInSeconds when it will expire + */ + @ConstructorProperties({"key", "eternal", "createTime", "maxLifeSeconds", "expiresInSeconds"}) + public CacheElementInfo(String key, boolean eternal, String createTime, + long maxLifeSeconds, long expiresInSeconds) + { + super(); + this.key = key; + this.eternal = eternal; + this.createTime = createTime; + this.maxLifeSeconds = maxLifeSeconds; + this.expiresInSeconds = expiresInSeconds; + } + + /** * @return a string representation of the key */ public String getKey() Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/admin/CacheRegionInfo.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/admin/CacheRegionInfo.java?rev=1556494&r1=1556493&r2=1556494&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/admin/CacheRegionInfo.java (original) +++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/admin/CacheRegionInfo.java Wed Jan 8 11:16:37 2014 @@ -1,5 +1,7 @@ package org.apache.commons.jcs.admin; +import java.beans.ConstructorProperties; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -19,51 +21,142 @@ package org.apache.commons.jcs.admin; * under the License. */ -import org.apache.commons.jcs.engine.control.CompositeCache; /** * Stores info on a cache region for the template */ public class CacheRegionInfo { - /** The cache region we are getting info on. */ - CompositeCache cache = null; + /** The name of the cache region */ + private String cacheName; - /** number of bytes counted so far, will be a total of all items. */ - long byteCount = 0; + /** The size of the cache region */ + private int cacheSize; - /** - * @return the underlying region - */ - public CompositeCache getCache() - { - return this.cache; - } + /** The status of the cache region */ + private String cacheStatus; + + /** The statistics of the cache region */ + private String cacheStatistics; + + /** The number of memory hits in the cache region */ + private int hitCountRam; + + /** The number of auxiliary hits in the cache region */ + private int hitCountAux; + + /** The number of misses in the cache region because the items were not found */ + private int missCountNotFound; + + /** The number of misses in the cache region because the items were expired */ + private int missCountExpired; + + /** The number of bytes counted so far, will be a total of all items */ + private long byteCount; /** - * @return total byte count + * Parameterized constructor + * + * @param cacheName The name of the cache region + * @param cacheSize The size of the cache region + * @param cacheStatus The status of the cache region + * @param cacheStatistics The statistics of the cache region + * @param hitCountRam The number of memory hits in the cache region + * @param hitCountAux The number of auxiliary hits in the cache region + * @param missCountNotFound The number of misses in the cache region because the items were not found + * @param missCountExpired The number of misses in the cache region because the items were expired + * @param byteCount The number of bytes counted so far, will be a total of all items + */ + @ConstructorProperties({"cacheName", "cacheSize", "cacheStatus", "cacheStatistics", + "hitCountRam", "hitCountAux", "missCountNotFound", "missCountExpired", "byteCount"}) + public CacheRegionInfo(String cacheName, int cacheSize, String cacheStatus, + String cacheStatistics, int hitCountRam, int hitCountAux, + int missCountNotFound, int missCountExpired, long byteCount) + { + super(); + this.cacheName = cacheName; + this.cacheSize = cacheSize; + this.cacheStatus = cacheStatus; + this.cacheStatistics = cacheStatistics; + this.hitCountRam = hitCountRam; + this.hitCountAux = hitCountAux; + this.missCountNotFound = missCountNotFound; + this.missCountExpired = missCountExpired; + this.byteCount = byteCount; + } + + /** + * @return the cacheName + */ + public String getCacheName() + { + return this.cacheName; + } + + /** + * @return the cacheSize + */ + public int getCacheSize() + { + return this.cacheSize; + } + + /** + * @return a status string */ - public long getByteCount() + public String getCacheStatus() { - return this.byteCount; + return this.cacheStatus; } /** - * @return a status string + * Return the statistics for the region. + *

+ * @return String */ - public String getStatus() + public String getCacheStatistics() { - return this.cache.getStatus().toString(); + return this.cacheStatistics; } /** - * Return the stats for the region. - *

- * @return String + * @return the hitCountRam + */ + public int getHitCountRam() + { + return hitCountRam; + } + + /** + * @return the hitCountAux + */ + public int getHitCountAux() + { + return hitCountAux; + } + + /** + * @return the missCountNotFound + */ + public int getMissCountNotFound() + { + return missCountNotFound; + } + + /** + * @return the missCountExpired + */ + public int getMissCountExpired() + { + return missCountExpired; + } + + /** + * @return total byte count */ - public String getStats() + public long getByteCount() { - return this.cache.getStats(); + return this.byteCount; } /** @@ -74,10 +167,10 @@ public class CacheRegionInfo { StringBuffer buf = new StringBuffer(); buf.append( "\nCacheRegionInfo " ); - if ( getCache() != null ) + if ( cacheName != null ) { - buf.append( "\n CacheName [" + getCache().getCacheName() + "]" ); - buf.append( "\n Status [" + getStatus() + "]" ); + buf.append( "\n CacheName [" + cacheName + "]" ); + buf.append( "\n Status [" + cacheStatus + "]" ); } buf.append( "\n ByteCount [" + getByteCount() + "]" ); Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/admin/JCSAdmin.jsp URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/admin/JCSAdmin.jsp?rev=1556494&r1=1556493&r2=1556494&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/admin/JCSAdmin.jsp (original) +++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/admin/JCSAdmin.jsp Wed Jan 8 11:16:37 2014 @@ -201,8 +201,7 @@ Till Expiration (s) <% - @SuppressWarnings("unchecked") - List list = (List) context.get( "elementInfoRecords" ); + CacheElementInfo[] list = (CacheElementInfo[]) context.get( "elementInfoRecords" ); for (CacheElementInfo element : list) { %> @@ -252,12 +251,11 @@ which empties the entire cache. Retrieve (key)   (region)