You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jcs-dev@jakarta.apache.org by as...@apache.org on 2008/08/20 23:44:07 UTC
svn commit: r687478 [1/2] - in /jakarta/jcs/trunk: ./ src/conf/
src/java/org/apache/jcs/auxiliary/
src/java/org/apache/jcs/auxiliary/disk/jdbc/
src/java/org/apache/jcs/auxiliary/lateral/
src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/ src/java/or...
Author: asmuts
Date: Wed Aug 20 14:44:05 2008
New Revision: 687478
URL: http://svn.apache.org/viewvc?rev=687478&view=rev
Log:
First stage refactoring of the event logging extension.
Added:
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AbstractAuxiliaryCacheEventLogging.java
jakarta/jcs/trunk/src/test-conf/TestRemoteCacheEventLogging.ccf
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/MockAuxiliaryCacheAttributes.java
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/MockAuxiliaryCacheFactory.java
jakarta/jcs/trunk/src/test/org/apache/jcs/engine/logging/
jakarta/jcs/trunk/src/test/org/apache/jcs/engine/logging/MockCacheEventLogger.java (contents, props changed)
- copied, changed from r686881, jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/MockCacheEventLogger.java
jakarta/jcs/trunk/xdocs/CacheEventLogging.xml
Removed:
jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/MockCacheEventLogger.java
Modified:
jakarta/jcs/trunk/pom.xml
jakarta/jcs/trunk/project.xml
jakarta/jcs/trunk/src/conf/cacheRC_CEL.ccf
jakarta/jcs/trunk/src/conf/log4j.properties
jakarta/jcs/trunk/src/conf/remote.cacheCEL.ccf
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AbstractAuxiliaryCache.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AuxiliaryCacheConfigurator.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractManager.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryManager.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryReceiver.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryService.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java
jakarta/jcs/trunk/src/java/org/apache/jcs/engine/PooledCacheEventQueue.java
jakarta/jcs/trunk/src/java/org/apache/jcs/engine/ZombieCacheService.java
jakarta/jcs/trunk/src/java/org/apache/jcs/engine/ZombieCacheWatch.java
jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java
jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/CacheEvent.java
jakarta/jcs/trunk/src/java/org/apache/jcs/engine/memory/mru/MRUMemoryCache.java
jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/LRUMap.java
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/AuxiliaryCacheConfiguratorUnitTest.java
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/MockAuxiliaryCache.java
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexDiskCacheUnitTest.java
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheUnitTest.java
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/MockLateralCache.java
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryUnitTest.java
jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheConfiguratorUnitTest.java
jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/MockCompositeCacheManager.java
jakarta/jcs/trunk/xdocs/RegionProperties.xml
jakarta/jcs/trunk/xdocs/navigation.xml
Modified: jakarta/jcs/trunk/pom.xml
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/pom.xml?rev=687478&r1=687477&r2=687478&view=diff
==============================================================================
--- jakarta/jcs/trunk/pom.xml (original)
+++ jakarta/jcs/trunk/pom.xml Wed Aug 20 14:44:05 2008
@@ -36,7 +36,7 @@
<groupId>org.apache.jcs</groupId>
<artifactId>jcs</artifactId>
<packaging>pom</packaging>
- <version>1.3.1.0-RC</version>
+ <version>1.3.2.0-RC</version>
<name>Jakarta JCS</name>
<url>http://jakarta.apache.org/jcs/</url>
<inceptionYear>2002</inceptionYear>
Modified: jakarta/jcs/trunk/project.xml
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/project.xml?rev=687478&r1=687477&r2=687478&view=diff
==============================================================================
--- jakarta/jcs/trunk/project.xml (original)
+++ jakarta/jcs/trunk/project.xml Wed Aug 20 14:44:05 2008
@@ -1,29 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-
+ <!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to you under the Apache License, Version
+ 2.0 (the "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+ CONDITIONS OF ANY KIND, either express or implied. See the License for
+ the specific language governing permissions and limitations under the
+ License.
+ -->
<project>
-
<pomVersion>3</pomVersion>
<name>JCS</name>
<id>jcs</id>
- <currentVersion>1.3.1.0-RC</currentVersion>
+ <currentVersion>1.3.2.0-RC</currentVersion>
<organization>
<name>Apache Software Foundation</name>
<url>http://jakarta.apache.org/</url>
@@ -32,22 +26,18 @@
<inceptionYear>2002</inceptionYear>
<package>org.apache.jcs</package>
<logo></logo>
-
<gumpRepositoryId>jakarta</gumpRepositoryId>
-
<shortDescription>Cache</shortDescription>
<description>Comprehensive Caching System</description>
<url>http://jakarta.apache.org/jcs/</url>
- <issueTrackingUrl>
- http://issues.apache.org/jira/browse/JCS
+ <issueTrackingUrl> http://issues.apache.org/jira/browse/JCS
</issueTrackingUrl>
<siteAddress>people.apache.org</siteAddress>
- <siteDirectory>/www/jakarta.apache.org/jcs/</siteDirectory>
- <distributionSite>www.apache.org</distributionSite>
- <distributionDirectory>
- /www/www.apache.org/dist/java-repository
- </distributionDirectory>
-
+ <siteDirectory>/www/jakarta.apache.org/jcs/
+ </siteDirectory>
+ <distributionSite>www.apache.org</distributionSite>
+ <distributionDirectory> /www/www.apache.org/dist/java-repository
+ </distributionDirectory>
<repository>
<connection>
scm:svn:http://svn.apache.org/repos/asf/jakarta/jcs/trunk/
@@ -55,30 +45,23 @@
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/jakarta/jcs/trunk/
</developerConnection>
- <url>http://svn.apache.org/viewcvs.cgi/jakarta/jcs/trunk/</url>
+ <url>http://svn.apache.org/viewcvs.cgi/jakarta/jcs/trunk/
+ </url>
</repository>
-
<mailingLists>
<mailingList>
<name>JCS User List</name>
- <subscribe>
- jcs-users-subscribe@jakarta.apache.org
- </subscribe>
- <unsubscribe>
- jcs-users-unsubscribe@jakarta.apache.org
- </unsubscribe>
- <archive>
- http://mail-archives.apache.org/mod_mbox/jakarta-jcs-users/
+ <subscribe> jcs-users-subscribe@jakarta.apache.org</subscribe>
+ <unsubscribe> jcs-users-unsubscribe@jakarta.apache.org</unsubscribe>
+ <archive> http://mail-archives.apache.org/mod_mbox/jakarta-jcs-users/
</archive>
</mailingList>
<mailingList>
<name>JCS Developer List</name>
- <subscribe>jcs-dev-subscribe@jakarta.apache.org</subscribe>
- <unsubscribe>
- jcs-dev-unsubscribe@jakarta.apache.org
- </unsubscribe>
- <archive>
- http://mail-archives.apache.org/mod_mbox/jakarta-jcs-dev/
+ <subscribe>jcs-dev-subscribe@jakarta.apache.org
+ </subscribe>
+ <unsubscribe> jcs-dev-unsubscribe@jakarta.apache.org</unsubscribe>
+ <archive> http://mail-archives.apache.org/mod_mbox/jakarta-jcs-dev/
</archive>
</mailingList>
<mailingList>
@@ -98,7 +81,6 @@
</archive>
</mailingList>
</mailingLists>
-
<developers>
<developer>
<name>Aaron Smuts</name>
@@ -125,7 +107,6 @@
<organization>IFilm</organization>
</developer>
</developers>
-
<contributors>
<contributor>
<name>Scott Eade</name>
@@ -140,7 +121,6 @@
<email>tv@apache.org</email>
</contributor>
</contributors>
-
<dependencies>
<!-- For comparative performance tests only -->
@@ -148,15 +128,16 @@
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2</version>
- <url>http://jakarta.apache.org/commons/collections/</url>
+ <url>http://jakarta.apache.org/commons/collections/
+ </url>
<type>jar</type>
</dependency>
-
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.4</version>
- <url>http://jakarta.apache.org/commons/configuration/</url>
+ <url>http://jakarta.apache.org/commons/configuration/
+ </url>
<type>jar</type>
</dependency>
@@ -165,7 +146,8 @@
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1</version>
- <url>http://jakarta.apache.org/commons/logging/</url>
+ <url>http://jakarta.apache.org/commons/logging/
+ </url>
<type>jar</type>
</dependency>
@@ -174,7 +156,8 @@
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.1</version>
- <url>http://jakarta.apache.org/commons/lang/</url>
+ <url>http://jakarta.apache.org/commons/lang/
+ </url>
<type>jar</type>
</dependency>
@@ -183,7 +166,8 @@
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.2.2</version>
- <url>http://jakarta.apache.org/commons</url>
+ <url>http://jakarta.apache.org/commons
+ </url>
<type>jar</type>
</dependency>
@@ -192,7 +176,8 @@
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
<version>1.3</version>
- <url>http://jakarta.apache.org/commons</url>
+ <url>http://jakarta.apache.org/commons
+ </url>
<type>jar</type>
</dependency>
@@ -207,7 +192,6 @@
</url>
<type>jar</type>
</dependency>
-
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
@@ -215,43 +199,38 @@
<url></url>
<type>jar</type>
</dependency>
-
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>1.7.3.3</version>
<!-- <version>1.8.0.7</version> -->
- <url>http://hsqldb.sourceforge.net/</url>
+ <url>http://hsqldb.sourceforge.net/
+ </url>
<type>jar</type>
</dependency>
-
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.12</version>
- <url>http://logging.apache.org/log4j/</url>
+ <url>http://logging.apache.org/log4j/
+ </url>
<type>jar</type>
</dependency>
-
<dependency>
<groupId>servletapi</groupId>
<artifactId>servletapi</artifactId>
<version>2.3</version>
- <url>http://java.sun.com/products/servlet/</url>
+ <url>http://java.sun.com/products/servlet/
+ </url>
<type>jar</type>
</dependency>
<!-- LGPL! -->
<!--
- <dependency>
- <groupId>jgroups</groupId>
- <artifactId>jgroups-all</artifactId>
- <version>2.2.8</version>
- <url></url>
- <type>jar</type>
- </dependency>
+ <dependency> <groupId>jgroups</groupId>
+ <artifactId>jgroups-all</artifactId> <version>2.2.8</version>
+ <url></url> <type>jar</type> </dependency>
-->
-
<dependency>
<groupId>tomcat</groupId>
<artifactId>tomcat-util</artifactId>
@@ -259,15 +238,14 @@
<url>http://tomcat.apache.org/</url>
<type>jar</type>
</dependency>
-
<dependency>
<groupId>velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.5</version>
- <url>http://jakarta.apache.org/velocity/</url>
+ <url>http://jakarta.apache.org/velocity/
+ </url>
<type>jar</type>
</dependency>
-
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@@ -275,7 +253,6 @@
<url>http://www.junit.org/</url>
<type>jar</type>
</dependency>
-
<dependency>
<groupId>xmlrpc</groupId>
<artifactId>xmlrpc</artifactId>
@@ -283,23 +260,22 @@
<url>http://ws.apache.org/xmlrpc/</url>
<type>jar</type>
</dependency>
-
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.6.2</version>
- <url>http://xml.apache.org/xerces2-j/</url>
+ <url>http://xml.apache.org/xerces2-j/
+ </url>
<type>jar</type>
</dependency>
-
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>2.0.2</version>
- <url>http://xml.apache.org/commons/</url>
+ <url>http://xml.apache.org/commons/
+ </url>
<type>jar</type>
</dependency>
-
<dependency>
<groupId>berkeleydb</groupId>
<artifactId>berkeleydb</artifactId>
@@ -307,8 +283,13 @@
<url></url>
<type>jar</type>
</dependency>
+ <dependency>
+ <groupId>maven-plugins</groupId>
+ <artifactId>maven-cobertura-plugin</artifactId>
+ <version>1.4</version>
+ <type>plugin</type>
+ </dependency>
</dependencies>
-
<build>
<sourceDirectory>src/java</sourceDirectory>
<unitTestSourceDirectory>src/test</unitTestSourceDirectory>
@@ -318,14 +299,23 @@
<include>**/*${test}Test.java</include>
</includes>
<excludes>
- <!-- Several of the test cases rely on background tasks that are timing sensitive. -->
+ <!--
+ Several of the test cases rely on background tasks that are timing
+ sensitive.
+ -->
<!-- You need to manually run these test cases. -->
- <exclude>**/BlockDiskElementDescriptorUnitTest.java</exclude>
- <exclude>**/HSQLDiskCacheConcurrentUnitTest.java</exclude>
- <exclude>**/HSQLDiskCacheUnitTest.java</exclude>
- <exclude>**/IndexedDiskCacheOptimizationUnitTest.java</exclude>
- <exclude>**/TestTCPLateralUnitTest.java</exclude>
- <exclude>**/UDPDiscoveryUnitTest.java</exclude>
+ <exclude>**/BlockDiskElementDescriptorUnitTest.java
+ </exclude>
+ <exclude>**/HSQLDiskCacheConcurrentUnitTest.java
+ </exclude>
+ <exclude>**/HSQLDiskCacheUnitTest.java
+ </exclude>
+ <exclude>**/IndexedDiskCacheOptimizationUnitTest.java
+ </exclude>
+ <exclude>**/TestTCPLateralUnitTest.java
+ </exclude>
+ <exclude>**/UDPDiscoveryUnitTest.java
+ </exclude>
<!-- The ones that fail may be different for you. -->
<!-- <exclude>**/JDBCDiskCacheRemovalUnitTest.java</exclude> -->
<!-- <exclude>**/JDBCDiskCacheUnitTest.java</exclude> -->
@@ -340,23 +330,22 @@
</resource>
</resources>
</unitTest>
- <resources>
- <resource>
- <directory>${basedir}</directory>
- <targetPath>META-INF</targetPath>
- <includes>
- <include>NOTICE</include>
- <include>LICENSE.xerox</include>
- </includes>
- </resource>
- </resources>
+ <resources>
+ <resource>
+ <directory>${basedir}</directory>
+ <targetPath>META-INF</targetPath>
+ <includes>
+ <include>NOTICE</include>
+ <include>LICENSE.xerox</include>
+ </includes>
+ </resource>
+ </resources>
</build>
-
<reports>
<report>maven-jdepend-plugin</report>
- <report>maven-checkstyle-plugin</report>
+ <!-- report>maven-checkstyle-plugin</report-->
<report>maven-changes-plugin</report>
- <report>maven-jcoverage-plugin</report>
+ <report>maven-cobertura-plugin</report>
<report>maven-javadoc-plugin</report>
<report>maven-jxr-plugin</report>
<report>maven-junit-report-plugin</report>
@@ -365,5 +354,4 @@
<report>maven-simian-plugin</report>
<report>maven-faq-plugin</report>
</reports>
-
-</project>
+</project>
\ No newline at end of file
Modified: jakarta/jcs/trunk/src/conf/cacheRC_CEL.ccf
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/conf/cacheRC_CEL.ccf?rev=687478&r1=687477&r2=687478&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/conf/cacheRC_CEL.ccf (original)
+++ jakarta/jcs/trunk/src/conf/cacheRC_CEL.ccf Wed Aug 20 14:44:05 2008
@@ -82,21 +82,6 @@
# #############################################################
# ################# AUXILIARY CACHES AVAILABLE ################
-# Remote RMI cache without failover
-jcs.auxiliary.RGroup=org.apache.jcs.auxiliary.remote.RemoteCacheFactory
-jcs.auxiliary.RGroup.attributes=org.apache.jcs.auxiliary.remote.RemoteCacheAttributes
-jcs.auxiliary.RGroup.attributes.RemoteTypeName=LOCAL
-jcs.auxiliary.RGroup.attributes.RemoteHost=localhost
-jcs.auxiliary.RGroup.attributes.RemotePort=1102
-jcs.auxiliary.RGroup.attributes.GetOnly=true
-
-# Remote RMI Cache set up to failover
-jcs.auxiliary.RFailover=org.apache.jcs.auxiliary.remote.RemoteCacheFactory
-jcs.auxiliary.RFailover.attributes=org.apache.jcs.auxiliary.remote.RemoteCacheAttributes
-jcs.auxiliary.RFailover.attributes.RemoteTypeName=LOCAL
-jcs.auxiliary.RFailover.attributes.FailoverServers=localhost:1102
-jcs.auxiliary.RFailover.attributes.GetOnly=false
-
# Primary Disk Cache-- faster than the rest because of memory key storage
jcs.auxiliary.DC=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory
jcs.auxiliary.DC.attributes=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes
@@ -107,42 +92,6 @@
jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=300000
jcs.auxiliary.DC.attributes.ShutdownSpoolTimeLimit=60
-# Disk Cache Using a Pooled Event Queue -- this allows you
-# to control the maximum number of threads it will use.
-# Each region uses 1 thread by default in the SINGLE model.
-# adding more threads does not help.
-# If you want to use a separate pool for each disk cache, either use
-# the single model or define a different auxiliary for each region and use the Pooled.
-# SINGLE is best unless you ahve a huge # of regions.
-jcs.auxiliary.DC2=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory
-jcs.auxiliary.DC2.attributes=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes
-jcs.auxiliary.DC2.attributes.DiskPath=target/test-sandbox/raf
-jcs.auxiliary.DC2.attributes.MaxPurgatorySize=10000
-jcs.auxiliary.DC2.attributes.MaxKeySize=10000
-jcs.auxiliary.DC2.attributes.MaxRecycleBinSize=5000
-jcs.auxiliary.DC2.attributes.OptimizeAtRemoveCount=300000
-jcs.auxiliary.DC2.attributes.EventQueueType=POOLED
-jcs.auxiliary.DC2.attributes.EventQueuePoolName=disk_cache_event_queue
-
-# Berkeley DB JE
-jcs.auxiliary.JE=org.apache.jcs.auxiliary.disk.bdbje.BDBJECacheFactory
-jcs.auxiliary.JE.attributes=org.apache.jcs.auxiliary.disk.bdbje.BDBJECacheAttributes
-jcs.auxiliary.JE.attributes.DiskPath=target/test-sandbox/bdbje-disk-cache-conc
-# the minimum cache size is 1024
-jcs.auxiliary.indexedDiskCache.attributes.CacheSize=1024
-# jcs.auxiliary.indexedDiskCache.attributes.CachePercent=0
-
-# HSQL Disk Cache -- too slow as is
-jcs.auxiliary.HDC=org.apache.jcs.auxiliary.disk.hsql.HSQLCacheFactory
-jcs.auxiliary.HDC.attributes=org.apache.jcs.auxiliary.disk.hsql.HSQLCacheAttributes
-jcs.auxiliary.HDC.attributes.DiskPath=@project_home_f@hsql
-
-# JISP Disk Cache -- save memory with disk key storage
-jcs.auxiliary.JDC=org.apache.jcs.auxiliary.disk.jisp.JISPCacheFactory
-jcs.auxiliary.JDC.attributes=org.apache.jcs.auxiliary.disk.jisp.JISPCacheAttributes
-jcs.auxiliary.JDC.attributes.DiskPath=@project_home_f@raf
-jcs.auxiliary.JDC.attributes.ClearOnStart=false
-
# need to make put or invalidate an option
# just a remove lock to add
jcs.auxiliary.RC=org.apache.jcs.auxiliary.remote.RemoteCacheFactory
@@ -157,59 +106,7 @@
jcs.auxiliary.RC.attributes.ThreadPoolName=remote_cache_client
jcs.auxiliary.RC.attributes.GetOnly=false
jcs.auxiliary.RC.cacheeventlogger=org.apache.jcs.engine.logging.CacheEventLoggerDebugLoggerImpl
-jcs.auxiliary.RC.cacheeventlogger.attributes.logCategoryName=TestEventLogCategory
-
-# unreliable
-jcs.auxiliary.LUDP=org.apache.jcs.auxiliary.lateral.LateralCacheFactory
-jcs.auxiliary.LUDP.attributes=org.apache.jcs.auxiliary.lateral.LateralCacheAttributes
-jcs.auxiliary.LUDP.attributes.TransmissionTypeName=UDP
-jcs.auxiliary.LUDP.attributes.UdpMulticastAddr=228.5.6.7
-jcs.auxiliary.LUDP.attributes.UdpMulticastPort=6789
-
-jcs.auxiliary.LJG=org.apache.jcs.auxiliary.lateral.LateralCacheFactory
-jcs.auxiliary.LJG.attributes=org.apache.jcs.auxiliary.lateral.LateralCacheAttributes
-jcs.auxiliary.LJG.attributes.TransmissionTypeName=JAVAGROUPS
-jcs.auxiliary.LJG.attributes.PutOnlyMode=true
-jcs.auxiliary.LJG.attributes.JGChannelProperties = UDP(mcast_addr=224.0.0.100;mcast_port=751):PING(timeout=3000):FD:STABLE:NAKACK:UNICAST:FRAG:FLUSH:GMS:VIEW_ENFORCER:QUEUE
-
-
-jcs.auxiliary.JG = org.apache.jcs.auxiliary.javagroups.JavaGroupsCacheFactory
-jcs.auxiliary.JG.attributes = org.apache.jcs.auxiliary.javagroups.JavaGroupsCacheAttributes
-jcs.auxiliary.JG.attributes.ChannelFactoryClassName = org.javagroups.JChannelFactory
-jcs.auxiliary.JG.attributes.ChannelProperties = UDP(mcast_addr=224.0.0.100;mcast_port=7501):PING:FD:STABLE:NAKACK:UNICAST:FRAG:FLUSH:GMS:VIEW_ENFORCER:QUEUE
-
-
-# almost complete
-jcs.auxiliary.LTCP=org.apache.jcs.auxiliary.lateral.LateralCacheFactory
-jcs.auxiliary.LTCP.attributes=org.apache.jcs.auxiliary.lateral.LateralCacheAttributes
-jcs.auxiliary.LTCP.attributes.TransmissionTypeName=TCP
-jcs.auxiliary.LTCP.attributes.TcpServers=localhost:1112
-jcs.auxiliary.LTCP.attributes.TcpListenerPort=1111
-jcs.auxiliary.LTCP.attributes.PutOnlyMode=true
-
-jcs.auxiliary.LTCP2=org.apache.jcs.auxiliary.lateral.LateralCacheFactory
-jcs.auxiliary.LTCP2.attributes=org.apache.jcs.auxiliary.lateral.LateralCacheAttributes
-jcs.auxiliary.LTCP2.attributes.TransmissionTypeName=TCP
-jcs.auxiliary.LTCP2.attributes.TcpServers=localhost:1112
-jcs.auxiliary.LTCP2.attributes.TcpListenerPort=1111
-jcs.auxiliary.LTCP2.attributes.PutOnlyMode=true
-
-jcs.auxiliary.XMLRPC=org.apache.jcs.auxiliary.lateral.LateralCacheFactory
-jcs.auxiliary.XMLRPC.attributes=org.apache.jcs.auxiliary.lateral.LateralCacheAttributes
-jcs.auxiliary.XMLRPC.attributes.TransmissionTypeName=XMLRPC
-jcs.auxiliary.XMLRPC.attributes.HttpServers=localhost:8182
-jcs.auxiliary.XMLRPC.attributes.HttpListenerPort=8181
-jcs.auxiliary.XMLRPC.attributes.PutOnlyMode=false
-
-
-# example of how to configure the http version of the lateral cache
-# not converteed to new cache
-jcs.auxiliary.LCHTTP=org.apache.jcs.auxiliary.lateral.LateralCacheFactory
-jcs.auxiliary.LCHTTP.attributes=org.apache.jcs.auxiliary.lateral.LateralCacheAttributes
-jcs.auxiliary.LCHTTP.attributes.TransmissionType=HTTP
-jcs.auxiliary.LCHTTP.attributes.httpServers=localhost:8080,localhost:7001,localhost:80
-jcs.auxiliary.LCHTTP.attributes.httpReceiveServlet=/cache/LateralCacheReceiverServlet
-jcs.auxiliary.LCHTTP.attributes.httpDeleteServlet=/cache/DeleteCacheServlet
+jcs.auxiliary.RC.cacheeventlogger.attributes.logCategoryName=test.RCCEventLogCategory
# #############################################################
Modified: jakarta/jcs/trunk/src/conf/log4j.properties
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/conf/log4j.properties?rev=687478&r1=687477&r2=687478&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/conf/log4j.properties (original)
+++ jakarta/jcs/trunk/src/conf/log4j.properties Wed Aug 20 14:44:05 2008
@@ -37,7 +37,7 @@
# ################################################################################
-log4j.category.TestEventLogCategory= DEBUG
+log4j.category.test= DEBUG
log4j.category.org.jgroups=WARN
Modified: jakarta/jcs/trunk/src/conf/remote.cacheCEL.ccf
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/conf/remote.cacheCEL.ccf?rev=687478&r1=687477&r2=687478&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/conf/remote.cacheCEL.ccf (original)
+++ jakarta/jcs/trunk/src/conf/remote.cacheCEL.ccf Wed Aug 20 14:44:05 2008
@@ -22,7 +22,7 @@
remote.cache.service.port=1101
remote.cluster.LocalClusterConsistency=true
remote.cacheeventlogger=org.apache.jcs.engine.logging.CacheEventLoggerDebugLoggerImpl
-remote.cacheeventlogger.attributes.logCategoryName=TestEventLogCategory
+remote.cacheeventlogger.attributes.logCategoryName=test.RCSEventLogCategory
# #############################################################
# ################# DEFAULT CACHE REGION #####################
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AbstractAuxiliaryCache.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AbstractAuxiliaryCache.java?rev=687478&r1=687477&r2=687478&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AbstractAuxiliaryCache.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AbstractAuxiliaryCache.java Wed Aug 20 14:44:05 2008
@@ -94,7 +94,7 @@
cacheEventLogger.logApplicationEvent( source, eventName, optionalDetails );
}
}
-
+
/**
* Logs an event if an event logger is configured.
* <p>
@@ -108,8 +108,8 @@
{
cacheEventLogger.logError( source, eventName, errorMessage );
}
- }
-
+ }
+
/**
* Gets the extra info for the event log.
* <p>
Added: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AbstractAuxiliaryCacheEventLogging.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AbstractAuxiliaryCacheEventLogging.java?rev=687478&view=auto
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AbstractAuxiliaryCacheEventLogging.java (added)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AbstractAuxiliaryCacheEventLogging.java Wed Aug 20 14:44:05 2008
@@ -0,0 +1,274 @@
+package org.apache.jcs.auxiliary;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.jcs.engine.behavior.ICacheElement;
+import org.apache.jcs.engine.logging.behavior.ICacheEvent;
+import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
+
+/**
+ * All ICacheEvents are defined as final. Children must implement process events. These are wrapped
+ * in event log parent calls.
+ * <p>
+ * You can override the public method, but if you don't, the default will call getWithTiming.
+ */
+public abstract class AbstractAuxiliaryCacheEventLogging
+ extends AbstractAuxiliaryCache
+{
+ /** Don't change. */
+ private static final long serialVersionUID = -3921738303365238919L;
+
+ /**
+ * Puts an item into the cache.
+ * <p>
+ * @param cacheElement
+ * @throws IOException
+ */
+ public void update( ICacheElement cacheElement )
+ throws IOException
+ {
+ updateWithEventLogging( cacheElement );
+ }
+
+ /**
+ * Puts an item into the cache. Wrapped in logging.
+ * <p>
+ * @param cacheElement
+ * @throws IOException
+ */
+ protected final void updateWithEventLogging( ICacheElement cacheElement )
+ throws IOException
+ {
+ ICacheEvent cacheEvent = createICacheEvent( cacheElement, ICacheEventLogger.UPDATE_EVENT );
+ try
+ {
+ processUpdate( cacheElement );
+ }
+ finally
+ {
+ logICacheEvent( cacheEvent );
+ }
+ }
+
+ /**
+ * Implementation of put.
+ * <p>
+ * @param cacheElement
+ * @throws IOException
+ */
+ protected abstract void processUpdate( ICacheElement cacheElement )
+ throws IOException;
+
+ /**
+ * Gets the item from the cache.
+ * <p>
+ * @param key
+ * @return ICacheElement, a wrapper around the key, value, and attributes
+ * @throws IOException
+ */
+ public ICacheElement get( Serializable key )
+ throws IOException
+ {
+ return getWithEventLogging( key );
+ }
+
+ /**
+ * Gets the item from the cache. Wrapped in logging.
+ * <p>
+ * @param key
+ * @return ICacheElement, a wrapper around the key, value, and attributes
+ * @throws IOException
+ */
+ protected final ICacheElement getWithEventLogging( Serializable key )
+ throws IOException
+ {
+ ICacheEvent cacheEvent = createICacheEvent( getCacheName(), key, ICacheEventLogger.GET_EVENT );
+ try
+ {
+ return processGet( key );
+ }
+ finally
+ {
+ logICacheEvent( cacheEvent );
+ }
+ }
+
+ /**
+ * Implementation of get.
+ * <p>
+ * @param key
+ * @return ICacheElement, a wrapper around the key, value, and attributes
+ * @throws IOException
+ */
+ protected abstract ICacheElement processGet( Serializable key )
+ throws IOException;
+
+ /**
+ * Gets multiple items from the cache based on the given set of keys.
+ * <p>
+ * @param keys
+ * @return a map of Serializable key to ICacheElement element, or an empty map if there is no
+ * data in cache for any of these keys
+ * @throws IOException
+ */
+ public Map getMultiple( Set keys )
+ throws IOException
+ {
+ return getMultipleWithEventLogging( keys );
+ }
+
+ /**
+ * Gets multiple items from the cache based on the given set of keys.
+ * <p>
+ * @param keys
+ * @return a map of Serializable key to ICacheElement element, or an empty map if there is no
+ * data in cache for any of these keys
+ * @throws IOException
+ */
+ protected final Map getMultipleWithEventLogging( Set keys )
+ throws IOException
+ {
+ ICacheEvent cacheEvent = createICacheEvent( getCacheName(), (Serializable) keys,
+ ICacheEventLogger.GETMULTIPLE_EVENT );
+ try
+ {
+ return processGetMultiple( keys );
+ }
+ finally
+ {
+ logICacheEvent( cacheEvent );
+ }
+ }
+
+ /**
+ * Implementation of getMultiple.
+ * <p>
+ * @param keys
+ * @return a map of Serializable key to ICacheElement element, or an empty map if there is no
+ * data in cache for any of these keys
+ */
+ protected abstract Map processGetMultiple( Set keys )
+ throws IOException;
+
+ /**
+ * Removes the item from the cache. Wraps the remove in event logs.
+ * <p>
+ * @param key
+ * @return boolean, whether or not the item was removed
+ * @throws IOException
+ */
+ public boolean remove( Serializable key )
+ throws IOException
+ {
+ return removeWithEventLogging( key );
+ }
+
+ /**
+ * Removes the item from the cache. Wraps the remove in event logs.
+ * <p>
+ * @param key
+ * @return boolean, whether or not the item was removed
+ * @throws IOException
+ */
+ protected final boolean removeWithEventLogging( Serializable key )
+ throws IOException
+ {
+ ICacheEvent cacheEvent = createICacheEvent( getCacheName(), key, ICacheEventLogger.REMOVE_EVENT );
+ try
+ {
+ return processRemove( key );
+ }
+ finally
+ {
+ logICacheEvent( cacheEvent );
+ }
+ }
+
+ /**
+ * Specific implementation of remove.
+ * <p>
+ * @param key
+ * @return boolean, whether or not the item was removed
+ * @throws IOException
+ */
+ protected abstract boolean processRemove( Serializable key )
+ throws IOException;
+
+ /**
+ * Removes all from the region. Wraps the removeAll in event logs.
+ * <p>
+ * @throws IOException
+ */
+ public void removeAll()
+ throws IOException
+ {
+ removeAllWithEventLogging();
+ }
+
+ /**
+ * Removes all from the region. Wraps the removeAll in event logs.
+ * <p>
+ * @throws IOException
+ */
+ protected final void removeAllWithEventLogging()
+ throws IOException
+ {
+ ICacheEvent cacheEvent = createICacheEvent( getCacheName(), "all", ICacheEventLogger.REMOVEALL_EVENT );
+ try
+ {
+ processRemoveAll();
+ }
+ finally
+ {
+ logICacheEvent( cacheEvent );
+ }
+ }
+
+ /**
+ * Specific implementation of removeAll.
+ */
+ protected abstract void processRemoveAll()
+ throws IOException;
+
+ /**
+ * Synchronously dispose the remote cache; if failed, replace the remote handle with a zombie.
+ * <p>
+ * @throws IOException
+ */
+ public final void dispose()
+ throws IOException
+ {
+ disposeWithEventLogging();
+ }
+
+ /**
+ * Synchronously dispose the remote cache; if failed, replace the remote handle with a zombie.
+ * Wraps the removeAll in event logs.
+ * <p>
+ * @throws IOException
+ */
+ protected void disposeWithEventLogging()
+ throws IOException
+ {
+ ICacheEvent cacheEvent = createICacheEvent( getCacheName(), "none", ICacheEventLogger.DISPOSE_EVENT );
+ try
+ {
+ processDispose();
+ }
+ finally
+ {
+ logICacheEvent( cacheEvent );
+ }
+ }
+
+ /**
+ * Specific implementation of dispose.
+ * <p>
+ * @throws IOException
+ */
+ protected abstract void processDispose()
+ throws IOException;
+}
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AuxiliaryCacheConfigurator.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AuxiliaryCacheConfigurator.java?rev=687478&r1=687477&r2=687478&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AuxiliaryCacheConfigurator.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AuxiliaryCacheConfigurator.java Wed Aug 20 14:44:05 2008
@@ -14,21 +14,21 @@
public class AuxiliaryCacheConfigurator
{
/** .attributes */
- final static String ATTRIBUTE_PREFIX = ".attributes";
+ public final static String ATTRIBUTE_PREFIX = ".attributes";
/**
* jcs.auxiliary.NAME.cacheeventlogger=CLASSNAME
* <p>
* jcs.auxiliary.NAME.cacheeventlogger.attributes.CUSTOMPROPERTY=VALUE
*/
- final static String CACHE_EVENT_LOGGER_PREFIX = ".cacheeventlogger";
+ public final static String CACHE_EVENT_LOGGER_PREFIX = ".cacheeventlogger";
/**
* jcs.auxiliary.NAME.serializer=CLASSNAME
* <p>
* jcs.auxiliary.NAME.serializer.attributes.CUSTOMPROPERTY=VALUE
*/
- final static String SERIALIZER_PREFIX = ".serializer";
+ public final static String SERIALIZER_PREFIX = ".serializer";
/**
* Parses the event logger config, if there is any for the auxiliary.
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java?rev=687478&r1=687477&r2=687478&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java Wed Aug 20 14:44:05 2008
@@ -39,6 +39,8 @@
import org.apache.jcs.engine.CacheConstants;
import org.apache.jcs.engine.behavior.ICacheElement;
import org.apache.jcs.engine.behavior.IElementSerializer;
+import org.apache.jcs.engine.logging.behavior.ICacheEvent;
+import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
import org.apache.jcs.engine.stats.StatElement;
import org.apache.jcs.engine.stats.behavior.IStatElement;
import org.apache.jcs.engine.stats.behavior.IStats;
@@ -65,7 +67,6 @@
* PRIMARY KEY (CACHE_KEY, REGION)
* );
* </pre>
- *
* <p>
* The cleanup thread will delete non eternal items where (now - create time) > max life seconds *
* 1000
@@ -125,9 +126,7 @@
log.info( "jdbcDiskCacheAttributes = " + getJdbcDiskCacheAttributes() );
}
- /**
- * This initializes the pool access.
- */
+ // This initializes the pool access.
initializePoolAccess( cattr );
// Initialization finished successfully, so set alive to true.
@@ -161,6 +160,8 @@
}
catch ( Exception e )
{
+ logError( getAuxiliaryCacheAttributes().getName(), "initializePoolAccess", e.getMessage() + " URL: "
+ + getDiskLocation() );
log.error( "Problem getting connection.", e );
}
}
@@ -174,6 +175,26 @@
*/
public void doUpdate( ICacheElement ce )
{
+ ICacheEvent cacheEvent = createICacheEvent( ce, ICacheEventLogger.UPDATE_EVENT );
+ try
+ {
+ processUpdate( ce );
+ }
+ finally
+ {
+ logICacheEvent( cacheEvent );
+ }
+ }
+
+ /**
+ * Inserts or updates. By default it will try to insert. If the item exists we will get an
+ * error. It will then update. This behavior is configurable. The cache can be configured to
+ * check before inserting.
+ * <p>
+ * @param ce
+ */
+ private void processUpdate( ICacheElement ce )
+ {
incrementUpdateCount();
if ( log.isDebugEnabled() )
@@ -255,94 +276,13 @@
// If it doesn't exist, insert it, otherwise update
if ( !exists )
{
- try
- {
- String sqlI = "insert into "
- + getJdbcDiskCacheAttributes().getTableName()
- + " (CACHE_KEY, REGION, ELEMENT, MAX_LIFE_SECONDS, IS_ETERNAL, CREATE_TIME, CREATE_TIME_SECONDS, SYSTEM_EXPIRE_TIME_SECONDS) "
- + " values (?, ?, ?, ?, ?, ?, ?, ?)";
-
- PreparedStatement psInsert = con.prepareStatement( sqlI );
- psInsert.setString( 1, (String) ce.getKey() );
- psInsert.setString( 2, this.getCacheName() );
- psInsert.setBytes( 3, element );
- psInsert.setLong( 4, ce.getElementAttributes().getMaxLifeSeconds() );
- if ( ce.getElementAttributes().getIsEternal() )
- {
- psInsert.setString( 5, "T" );
- }
- else
- {
- psInsert.setString( 5, "F" );
- }
- Date createTime = new Date( ce.getElementAttributes().getCreateTime() );
- psInsert.setDate( 6, createTime );
-
- long now = System.currentTimeMillis() / 1000;
- psInsert.setLong( 7, now );
-
- long expireTime = now + ce.getElementAttributes().getMaxLifeSeconds();
- psInsert.setLong( 8, expireTime );
-
- psInsert.execute();
- psInsert.close();
- }
- catch ( SQLException e )
- {
- if ( e.toString().indexOf( "Violation of unique index" ) != -1
- || e.getMessage().indexOf( "Violation of unique index" ) != -1
- || e.getMessage().indexOf( "Duplicate entry" ) != -1 )
- {
- exists = true;
- }
- else
- {
- log.error( "Could not insert element", e );
- }
-
- // see if it exists, if we didn't already
- if ( !exists && !this.getJdbcDiskCacheAttributes().isTestBeforeInsert() )
- {
- exists = doesElementExist( ce );
- }
- }
+ exists = insertRow( ce, con, element );
}
// update if it exists.
if ( exists )
{
- String sqlU = null;
- try
- {
- sqlU = "update " + getJdbcDiskCacheAttributes().getTableName()
- + " set ELEMENT = ?, CREATE_TIME = ?, CREATE_TIME_SECONDS = ?, "
- + " SYSTEM_EXPIRE_TIME_SECONDS = ? " + " where CACHE_KEY = ? and REGION = ?";
- PreparedStatement psUpdate = con.prepareStatement( sqlU );
- psUpdate.setBytes( 1, element );
-
- Date createTime = new Date( ce.getElementAttributes().getCreateTime() );
- psUpdate.setDate( 2, createTime );
-
- long now = System.currentTimeMillis() / 1000;
- psUpdate.setLong( 3, now );
-
- long expireTime = now + ce.getElementAttributes().getMaxLifeSeconds();
- psUpdate.setLong( 4, expireTime );
-
- psUpdate.setString( 5, (String) ce.getKey() );
- psUpdate.setString( 6, this.getCacheName() );
- psUpdate.execute();
- psUpdate.close();
-
- if ( log.isDebugEnabled() )
- {
- log.debug( "ran update " + sqlU );
- }
- }
- catch ( SQLException e2 )
- {
- log.error( "e2 sql [" + sqlU + "] Exception: ", e2 );
- }
+ updateRow( ce, con, element );
}
}
finally
@@ -368,6 +308,114 @@
}
/**
+ * This inserts a new row in the database.
+ * <p>
+ * @param ce
+ * @param con
+ * @param element
+ * @return true if the insertion fails because the record exists.
+ */
+ private boolean insertRow( ICacheElement ce, Connection con, byte[] element )
+ {
+ boolean exists = false;
+ try
+ {
+ String sqlI = "insert into "
+ + getJdbcDiskCacheAttributes().getTableName()
+ + " (CACHE_KEY, REGION, ELEMENT, MAX_LIFE_SECONDS, IS_ETERNAL, CREATE_TIME, CREATE_TIME_SECONDS, SYSTEM_EXPIRE_TIME_SECONDS) "
+ + " values (?, ?, ?, ?, ?, ?, ?, ?)";
+
+ PreparedStatement psInsert = con.prepareStatement( sqlI );
+ psInsert.setString( 1, (String) ce.getKey() );
+ psInsert.setString( 2, this.getCacheName() );
+ psInsert.setBytes( 3, element );
+ psInsert.setLong( 4, ce.getElementAttributes().getMaxLifeSeconds() );
+ if ( ce.getElementAttributes().getIsEternal() )
+ {
+ psInsert.setString( 5, "T" );
+ }
+ else
+ {
+ psInsert.setString( 5, "F" );
+ }
+ Date createTime = new Date( ce.getElementAttributes().getCreateTime() );
+ psInsert.setDate( 6, createTime );
+
+ long now = System.currentTimeMillis() / 1000;
+ psInsert.setLong( 7, now );
+
+ long expireTime = now + ce.getElementAttributes().getMaxLifeSeconds();
+ psInsert.setLong( 8, expireTime );
+
+ psInsert.execute();
+ psInsert.close();
+ }
+ catch ( SQLException e )
+ {
+ if ( e.toString().indexOf( "Violation of unique index" ) != -1
+ || e.getMessage().indexOf( "Violation of unique index" ) != -1
+ || e.getMessage().indexOf( "Duplicate entry" ) != -1 )
+ {
+ exists = true;
+ }
+ else
+ {
+ log.error( "Could not insert element", e );
+ }
+
+ // see if it exists, if we didn't already
+ if ( !exists && !this.getJdbcDiskCacheAttributes().isTestBeforeInsert() )
+ {
+ exists = doesElementExist( ce );
+ }
+ }
+ return exists;
+ }
+
+ /**
+ * This updates a row in the database.
+ * <p>
+ * @param ce
+ * @param con
+ * @param element
+ */
+ private void updateRow( ICacheElement ce, Connection con, byte[] element )
+ {
+ String sqlU = null;
+ try
+ {
+ sqlU = "update " + getJdbcDiskCacheAttributes().getTableName()
+ + " set ELEMENT = ?, CREATE_TIME = ?, CREATE_TIME_SECONDS = ?, " + " SYSTEM_EXPIRE_TIME_SECONDS = ? "
+ + " where CACHE_KEY = ? and REGION = ?";
+ PreparedStatement psUpdate = con.prepareStatement( sqlU );
+ psUpdate.setBytes( 1, element );
+
+ Date createTime = new Date( ce.getElementAttributes().getCreateTime() );
+ psUpdate.setDate( 2, createTime );
+
+ long now = System.currentTimeMillis() / 1000;
+ psUpdate.setLong( 3, now );
+
+ long expireTime = now + ce.getElementAttributes().getMaxLifeSeconds();
+ psUpdate.setLong( 4, expireTime );
+
+ psUpdate.setString( 5, (String) ce.getKey() );
+ psUpdate.setString( 6, this.getCacheName() );
+ psUpdate.execute();
+ psUpdate.close();
+
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "ran update " + sqlU );
+ }
+ }
+ catch ( SQLException e2 )
+ {
+ log.error( "e2 sql [" + sqlU + "] Exception: ", e2 );
+ }
+ }
+
+ /**
* Does an element exist for this key?
* <p>
* @param ce
@@ -452,6 +500,26 @@
*/
public ICacheElement doGet( Serializable key )
{
+ ICacheElement obj = null;
+ ICacheEvent cacheEvent = createICacheEvent( cacheName, key, ICacheEventLogger.GET_EVENT );
+ try
+ {
+ obj = processGet( key, obj );
+ }
+ finally
+ {
+ logICacheEvent( cacheEvent );
+ }
+ return obj;
+ }
+
+ /**
+ * Queries the database for the value. If it gets a result, the value is deserialized.
+ * <p>
+ * @see org.apache.jcs.auxiliary.disk.AbstractDiskCache#doGet(java.io.Serializable)
+ */
+ private ICacheElement processGet( Serializable key, ICacheElement obj )
+ {
incrementGetCount();
if ( log.isDebugEnabled() )
@@ -464,8 +532,6 @@
return null;
}
- ICacheElement obj = null;
-
byte[] data = null;
try
{
@@ -546,12 +612,11 @@
log.info( "Get Count [" + getCount + "]" );
}
}
-
return obj;
}
/**
- * Returns true if the removal was succesful; or false if there is nothing to remove. Current
+ * Returns true if the removal was successful; or false if there is nothing to remove. Current
* implementation always results in a disk orphan.
* <p>
* @param key
@@ -559,6 +624,26 @@
*/
public boolean doRemove( Serializable key )
{
+ ICacheEvent cacheEvent = createICacheEvent( cacheName, key, ICacheEventLogger.REMOVE_EVENT );
+ try
+ {
+ return processRemove( key );
+ }
+ finally
+ {
+ logICacheEvent( cacheEvent );
+ }
+ }
+
+ /**
+ * Returns true if the removal was successful; or false if there is nothing to remove. Current
+ * implementation always results in a disk orphan.
+ * <p>
+ * @param key
+ * @return boolean
+ */
+ private boolean processRemove( Serializable key )
+ {
// remove single item.
String sql = "delete from " + getJdbcDiskCacheAttributes().getTableName()
+ " where REGION = ? and CACHE_KEY = ?";
@@ -628,6 +713,23 @@
*/
public void doRemoveAll()
{
+ ICacheEvent cacheEvent = createICacheEvent( cacheName, "all", ICacheEventLogger.REMOVEALL_EVENT );
+ try
+ {
+ processRemoveAll();
+ }
+ finally
+ {
+ logICacheEvent( cacheEvent );
+ }
+ }
+
+ /**
+ * This should remove all elements. The auxiliary can be configured to forbid this behavior. If
+ * remove all is not allowed, the method balks.
+ */
+ private void processRemoveAll()
+ {
// it should never get here formt he abstract dis cache.
if ( this.jdbcDiskCacheAttributes.isAllowRemoveAll() )
{
@@ -736,9 +838,13 @@
log.error( "Problem closing statement.", e1 );
}
}
+ logApplicationEvent( getAuxiliaryCacheAttributes().getName(), "deleteExpired",
+ "Deleted expired elements. URL: " + getDiskLocation() );
}
catch ( Exception e )
{
+ logError( getAuxiliaryCacheAttributes().getName(), "deleteExpired", e.getMessage() + " URL: "
+ + getDiskLocation() );
log.error( "Problem removing expired elements from the table.", e );
reset();
}
@@ -761,13 +867,21 @@
/** Shuts down the pool */
public void doDispose()
{
+ ICacheEvent cacheEvent = createICacheEvent( cacheName, "none", ICacheEventLogger.DISPOSE_EVENT );
try
{
- poolAccess.shutdownDriver();
+ try
+ {
+ poolAccess.shutdownDriver();
+ }
+ catch ( Exception e )
+ {
+ log.error( "Problem shutting down.", e );
+ }
}
- catch ( Exception e )
+ finally
{
- log.error( "Problem shutting down.", e );
+ logICacheEvent( cacheEvent );
}
}
@@ -1023,7 +1137,7 @@
{
return this.getStats();
}
-
+
/**
* This is used by the event logging.
* <p>
@@ -1032,5 +1146,5 @@
protected String getDiskLocation()
{
return this.jdbcDiskCacheAttributes.getUrl();
- }
+ }
}
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java?rev=687478&r1=687477&r2=687478&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java Wed Aug 20 14:44:05 2008
@@ -28,27 +28,30 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.jcs.auxiliary.AbstractAuxiliaryCacheEventLogging;
import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes;
import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheService;
import org.apache.jcs.engine.CacheConstants;
-import org.apache.jcs.engine.behavior.ICache;
import org.apache.jcs.engine.behavior.ICacheElement;
import org.apache.jcs.engine.behavior.ICacheType;
import org.apache.jcs.engine.behavior.IZombie;
+import org.apache.jcs.engine.stats.Stats;
+import org.apache.jcs.engine.stats.behavior.IStats;
/**
- * Lateral distributor. Returns null on get by default. Net search not
- * implemented.
+ * Lateral distributor. Returns null on get by default. Net search not implemented.
*/
public class LateralCache
- implements ICache
+ extends AbstractAuxiliaryCacheEventLogging
{
+ /** Don't change. */
private static final long serialVersionUID = 6274549256562382782L;
+ /** The logger. */
private final static Log log = LogFactory.getLog( LateralCache.class );
- // generalize this, use another interface
+ /** generalize this, use another interface */
private ILateralCacheAttributes cattr;
final String cacheName;
@@ -56,6 +59,7 @@
/** either http, socket.udp, or socket.tcp can set in config */
private ILateralCacheService lateral;
+ /** Monitors the connection. */
private LateralCacheMonitor monitor;
/**
@@ -90,7 +94,7 @@
* @param ce
* @throws IOException
*/
- public void update( ICacheElement ce )
+ protected void processUpdate( ICacheElement ce )
throws IOException
{
try
@@ -115,14 +119,13 @@
}
/**
- * The performace costs are too great. It is not recommended that you enable
- * lateral gets.
+ * The performance costs are too great. It is not recommended that you enable lateral gets.
* <p>
* @param key
- * @return
+ * @return ICacheElement or null
* @throws IOException
*/
- public ICacheElement get( Serializable key )
+ protected ICacheElement processGet( Serializable key )
throws IOException
{
ICacheElement obj = null;
@@ -147,10 +150,11 @@
* Gets multiple items from the cache based on the given set of keys.
* <p>
* @param keys
- * @return a map of Serializable key to ICacheElement element, or an empty map if there is no data in cache for any of these keys
- * @throws IOException
+ * @return a map of Serializable key to ICacheElement element, or an empty map if there is no
+ * data in cache for any of these keys
+ * @throws IOException
*/
- public Map getMultiple( Set keys )
+ protected Map processGetMultiple( Set keys )
throws IOException
{
Map elements = new HashMap();
@@ -176,7 +180,6 @@
}
/**
- *
* @param groupName
* @return A set of group keys.
*/
@@ -186,17 +189,20 @@
}
/**
- * Synchronously remove from the remote cache; if failed, replace the remote
- * handle with a zombie.
+ * Synchronously remove from the remote cache; if failed, replace the remote handle with a
+ * zombie.
* <p>
* @param key
* @return false always
* @throws IOException
*/
- public boolean remove( Serializable key )
+ protected boolean processRemove( Serializable key )
throws IOException
{
- log.debug( "removing key:" + key );
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "removing key:" + key );
+ }
try
{
@@ -210,12 +216,12 @@
}
/**
- * Synchronously removeAll from the remote cache; if failed, replace the
- * remote handle with a zombie.
+ * Synchronously removeAll from the remote cache; if failed, replace the remote handle with a
+ * zombie.
* <p>
* @throws IOException
*/
- public void removeAll()
+ protected void processRemoveAll()
throws IOException
{
try
@@ -230,10 +236,10 @@
/**
* Synchronously dispose the cache. Not sure we want this.
- *
+ * <p>
* @throws IOException
*/
- public void dispose()
+ protected void processDispose()
throws IOException
{
log.debug( "Disposing of lateral cache" );
@@ -252,7 +258,6 @@
log.error( "Couldn't dispose", ex );
handleException( ex, "Failed to dispose " + this.cattr.getCacheName() );
}
- //*/
}
/**
@@ -357,10 +362,8 @@
return cattr;
}
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
+ /**
+ * @return debugging data.
*/
public String toString()
{
@@ -371,4 +374,23 @@
return buf.toString();
}
+ /**
+ * @return extra data.
+ */
+ public String getEventLoggingExtraInfo()
+ {
+ return null;
+ }
+
+ /**
+ * The NoWait on top does not call out to here yet.
+ * <p>
+ * @return almost nothing
+ */
+ public IStats getStatistics()
+ {
+ IStats stats = new Stats();
+ stats.setTypeName( "LateralCache" );
+ return stats;
+ }
}
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractManager.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractManager.java?rev=687478&r1=687477&r2=687478&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractManager.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractManager.java Wed Aug 20 14:44:05 2008
@@ -32,6 +32,8 @@
import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheManager;
import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheObserver;
import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheService;
+import org.apache.jcs.engine.behavior.IElementSerializer;
+import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
/**
* Creates lateral caches. Lateral caches are primarily used for removing non
@@ -43,22 +45,22 @@
* This is currently not implemented in the lateral cache.
* <p>
*
- * @TODO: - need freeCache, release, getStats - need to find an interface
+ * TODO: - need freeCache, release, getStats - need to find an interface
* Acceptable for all - cache managers or a manager within a type
*/
public abstract class LateralCacheAbstractManager
implements ILateralCacheManager
{
+ /** Don't change */
+ private static final long serialVersionUID = -515393179178435508L;
+
+ /** The logger. */
private final static Log log = LogFactory.getLog( LateralCacheAbstractManager.class );
- /**
- * Each manager instance has caches.
- */
+ /** Each manager instance has caches. */
protected final Map caches = new HashMap();
- /**
- * Description of the Field
- */
+ /** Configuration */
protected ILateralCacheAttributes lca;
/**
@@ -73,6 +75,12 @@
*/
private LateralCacheWatchRepairable lateralWatch;
+ /** The event logger. */
+ protected ICacheEventLogger cacheEventLogger;
+
+ /** The serializer. */
+ protected IElementSerializer elementSerializer;
+
/**
* Adds the lateral cache listener to the underlying cache-watch service.
*
@@ -152,8 +160,9 @@
}
}
- /* (non-Javadoc)
- * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheManager#getCaches()
+ /**
+ * @return Map
+ *
*/
public Map getCaches()
{
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java?rev=687478&r1=687477&r2=687478&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java Wed Aug 20 14:44:05 2008
@@ -69,12 +69,12 @@
private int removeCount = 0;
private int putCount = 0;
-
+
/** An optional event logger */
- private ICacheEventLogger cacheEventLogger;
-
+ private ICacheEventLogger cacheEventLogger;
+
/** The serializer. */
- private IElementSerializer elementSerializer;
+ private IElementSerializer elementSerializer;
/**
* Constructs with the given lateral cache, and fires up an event queue for aysnchronous
@@ -167,7 +167,8 @@
* Gets multiple items from the cache based on the given set of keys.
* <p>
* @param keys
- * @return a map of Serializable key to ICacheElement element, or an empty map if there is no data in cache for any of these keys
+ * @return a map of Serializable key to ICacheElement element, or an empty map if there is no
+ * data in cache for any of these keys
*/
public Map getMultiple( Set keys )
{
@@ -193,6 +194,10 @@
return elements;
}
+ /**
+ * @param groupName
+ * @return Set
+ */
public Set getGroupKeys( String groupName )
{
return cache.getGroupKeys( groupName );
@@ -332,8 +337,8 @@
public void setCacheEventLogger( ICacheEventLogger cacheEventLogger )
{
this.cacheEventLogger = cacheEventLogger;
- }
-
+ }
+
/**
* Allows you to inject a custom serializer. A good example would be a compressing standard
* serializer.
@@ -344,7 +349,7 @@
{
this.elementSerializer = elementSerializer;
}
-
+
/**
* getStats
* @return String
@@ -400,9 +405,8 @@
return stats;
}
- /*
- * (non-Javadoc)
- * @see java.lang.Object#toString()
+ /**
+ * @return debugging info.
*/
public String toString()
{
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java?rev=687478&r1=687477&r2=687478&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java Wed Aug 20 14:44:05 2008
@@ -85,7 +85,8 @@
}
ITCPLateralCacheAttributes lacC = (ITCPLateralCacheAttributes) lac.copy();
lacC.setTcpServer( server );
- LateralTCPCacheManager lcm = LateralTCPCacheManager.getInstance( lacC, cacheMgr );
+ LateralTCPCacheManager lcm = LateralTCPCacheManager.getInstance( lacC, cacheMgr, cacheEventLogger,
+ elementSerializer );
ICache ic = lcm.getCache( lacC.getCacheName() );
if ( ic != null )
{
@@ -108,7 +109,7 @@
.toArray( new LateralCacheNoWait[0] ), (ILateralCacheAttributes) iaca );
// create udp discovery if available.
- createDiscoveryService( lac, lcnwf, cacheMgr );
+ createDiscoveryService( lac, lcnwf, cacheMgr, cacheEventLogger, elementSerializer );
return lcnwf;
}
@@ -156,7 +157,9 @@
* @return null if none is created.
*/
private UDPDiscoveryService createDiscoveryService( ITCPLateralCacheAttributes lac, LateralCacheNoWaitFacade lcnwf,
- ICompositeCacheManager cacheMgr )
+ ICompositeCacheManager cacheMgr,
+ ICacheEventLogger cacheEventLogger,
+ IElementSerializer elementSerializer )
{
UDPDiscoveryService discovery = null;
@@ -165,7 +168,8 @@
{
// need a factory for this so it doesn't
// get dereferenced, also we don't want one for every region.
- discovery = UDPDiscoveryManager.getInstance().getService( lac, cacheMgr );
+ discovery = UDPDiscoveryManager.getInstance().getService( lac, cacheMgr, cacheEventLogger,
+ elementSerializer );
discovery.addNoWaitFacade( lcnwf, lac.getCacheName() );
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java?rev=687478&r1=687477&r2=687478&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java Wed Aug 20 14:44:05 2008
@@ -39,19 +39,19 @@
import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheService;
import org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes;
import org.apache.jcs.engine.behavior.ICompositeCacheManager;
+import org.apache.jcs.engine.behavior.IElementSerializer;
+import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
/**
- * Creates lateral caches. Lateral caches are primarily used for removing non
- * laterally configured caches. Non laterally configured cache regions should
- * still be able to participate in removal. But if there is a non laterally
- * configured cache hub, then lateral removals may be necessary. For flat
- * webserver production environments, without a strong machine at the app server
- * level, distribution and search may need to occur at the lateral cache level.
- * This is currently not implemented in the lateral cache.
+ * Creates lateral caches. Lateral caches are primarily used for removing non laterally configured
+ * caches. Non laterally configured cache regions should still be able to participate in removal.
+ * But if there is a non laterally configured cache hub, then lateral removals may be necessary. For
+ * flat webserver production environments, without a strong machine at the app server level,
+ * distribution and search may need to occur at the lateral cache level. This is currently not
+ * implemented in the lateral cache.
* <p>
- *
- * @TODO: - need freeCache, release, getStats - need to find an interface
- * acceptable for all - cache managers or a manager within a type
+ * TODO: - need freeCache, release, getStats - need to find an interface acceptable for all - cache
+ * managers or a manager within a type
*/
public class LateralTCPCacheManager
extends LateralCacheAbstractManager
@@ -62,38 +62,40 @@
private static LateralCacheMonitor monitor;
- /** Address to instance map. */
+ /** Address to instance map. */
protected static Map instances = new HashMap();
- /** ITCPLateralCacheAttributes */
+ /** ITCPLateralCacheAttributes */
protected ITCPLateralCacheAttributes lca;
private int clients;
/**
- * Handle to the lateral cache service; or a zombie handle if failed to
- * connect.
+ * Handle to the lateral cache service; or a zombie handle if failed to connect.
*/
private ILateralCacheService lateralService;
/**
- * Wrapper of the lateral cache watch service; or wrapper of a zombie
- * service if failed to connect.
+ * Wrapper of the lateral cache watch service; or wrapper of a zombie service if failed to
+ * connect.
*/
private LateralCacheWatchRepairable lateralWatch;
- /** This is set in the constructor. */
+ /** This is set in the constructor. */
private ICompositeCacheManager cacheMgr;
/**
* Returns an instance of the LateralCacheManager.
* <p>
* @param lca
- * @param cacheMgr
- * this allows the auxiliary to be passed a cache manager.
- * @return
+ * @param cacheMgr this allows the auxiliary to be passed a cache manager.
+ * @param cacheEventLogger
+ * @param elementSerializer
+ * @return LateralTCPCacheManager
*/
- public static LateralTCPCacheManager getInstance( ITCPLateralCacheAttributes lca, ICompositeCacheManager cacheMgr )
+ public static LateralTCPCacheManager getInstance( ITCPLateralCacheAttributes lca, ICompositeCacheManager cacheMgr,
+ ICacheEventLogger cacheEventLogger,
+ IElementSerializer elementSerializer )
{
LateralTCPCacheManager ins = (LateralTCPCacheManager) instances.get( lca.toString() );
synchronized ( instances )
@@ -105,7 +107,7 @@
ins = (LateralTCPCacheManager) instances.get( lca.toString() );
if ( ins == null )
{
- ins = new LateralTCPCacheManager( lca, cacheMgr );
+ ins = new LateralTCPCacheManager( lca, cacheMgr, cacheEventLogger, elementSerializer );
instances.put( lca.toString(), ins );
}
}
@@ -146,11 +148,13 @@
* @param lcaA
* @param cacheMgr
*/
- private LateralTCPCacheManager( ITCPLateralCacheAttributes lcaA, ICompositeCacheManager cacheMgr )
+ private LateralTCPCacheManager( ITCPLateralCacheAttributes lcaA, ICompositeCacheManager cacheMgr,
+ ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer )
{
this.lca = lcaA;
-
this.cacheMgr = cacheMgr;
+ this.cacheEventLogger = cacheEventLogger;
+ this.elementSerializer = elementSerializer;
if ( log.isDebugEnabled() )
{
@@ -196,10 +200,8 @@
/**
* Adds the lateral cache listener to the underlying cache-watch service.
* <p>
- * @param cacheName
- * The feature to be added to the LateralCacheListener attribute
- * @param listener
- * The feature to be added to the LateralCacheListener attribute
+ * @param cacheName The feature to be added to the LateralCacheListener attribute
+ * @param listener The feature to be added to the LateralCacheListener attribute
* @exception IOException
*/
public void addLateralCacheListener( String cacheName, ILateralCacheListener listener )
@@ -212,15 +214,13 @@
}
/**
- * Called to access a precreated region or construct one with defaults.
- * Since all aux cache access goes through the manager, this will never be
- * called.
+ * Called to access a precreated region or construct one with defaults. Since all aux cache
+ * access goes through the manager, this will never be called.
* <p>
- * After getting the manager instance for a server, the factory gets a cache
- * for the region name it is constructing.
+ * After getting the manager instance for a server, the factory gets a cache for the region name
+ * it is constructing.
* <p>
- * There should be one manager per server and one cache per region per
- * manager.
+ * There should be one manager per server and one cache per region per manager.
* <p>
* @return AuxiliaryCache
* @param cacheName
@@ -237,11 +237,18 @@
attr.setCacheName( cacheName );
LateralCache cache = new LateralCache( attr, this.lateralService, monitor );
+ cache.setCacheEventLogger( cacheEventLogger );
+ cache.setElementSerializer( elementSerializer );
+
if ( log.isDebugEnabled() )
{
log.debug( "Created cache for noWait, cache [" + cache + "]" );
}
+
lateralNoWait = new LateralCacheNoWait( cache );
+ lateralNoWait.setCacheEventLogger( cacheEventLogger );
+ lateralNoWait.setElementSerializer( elementSerializer );
+
this.caches.put( cacheName, lateralNoWait );
if ( log.isInfoEnabled() )
@@ -280,20 +287,17 @@
return lateralNoWait;
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jcs.auxiliary.lateral.LateralCacheAbstractManager#getInstances()
+ /**
+ * @return Map
*/
public Map getInstances()
{
return instances;
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheManager#fixService()
+ /**
+ * @return a new service
+ * @throws IOException
*/
public Object fixService()
throws IOException
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java?rev=687478&r1=687477&r2=687478&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java Wed Aug 20 14:44:05 2008
@@ -41,21 +41,20 @@
/**
* A lateral cache service implementation. Does not implement getGroupKey
- * <p>
- * @version $Id$
*/
public class LateralTCPService
implements ILateralCacheService, ILateralCacheObserver
{
+ /** The logger. */
private final static Log log = LogFactory.getLog( LateralTCPService.class );
+ /** special configuration */
private ITCPLateralCacheAttributes tcpLateralCacheAttributes;
+ /** Sends to another lateral. */
private LateralTCPSender sender;
- /**
- * use the vmid by default
- */
+ /** use the vmid by default */
private long listenerId = LateralCacheInfo.listenerId;
/**
@@ -175,9 +174,8 @@
sender.send( led );
}
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.engine.behavior.ICacheService#release()
+ /**
+ * Does nothing.
*/
public void release()
throws IOException
@@ -243,10 +241,11 @@
/**
* Gets multiple items from the cache based on the given set of keys.
* <p>
- * @param cacheName
+ * @param cacheName
* @param keys
- * @return a map of Serializable key to ICacheElement element, or an empty map if there is no data in cache for any of these keys
- * @throws IOException
+ * @return a map of Serializable key to ICacheElement element, or an empty map if there is no
+ * data in cache for any of these keys
+ * @throws IOException
*/
public Map getMultiple( String cacheName, Set keys )
throws IOException
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryManager.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryManager.java?rev=687478&r1=687477&r2=687478&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryManager.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryManager.java Wed Aug 20 14:44:05 2008
@@ -26,12 +26,14 @@
import org.apache.commons.logging.LogFactory;
import org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes;
import org.apache.jcs.engine.behavior.ICompositeCacheManager;
+import org.apache.jcs.engine.behavior.IElementSerializer;
+import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
/**
* This manages UDPDiscovery Services. We should end up with one service per
* Lateral Cache Manager Instance. One service works for multiple regions. We
* don't want a connection for each region.
- *
+ * <p>
* @author Aaron Smuts
*
*/
@@ -42,6 +44,7 @@
private static UDPDiscoveryManager INSTANCE = new UDPDiscoveryManager();
private Map services = new HashMap();
+
private UDPDiscoveryManager()
{
@@ -64,11 +67,14 @@
* @param lca
* ITCPLateralCacheAttributes
* @param cacheMgr
- * @return
+ * @param cacheEventLogger
+ * @param elementSerializer
+ * @return instance for this address
*/
- public synchronized UDPDiscoveryService getService( ITCPLateralCacheAttributes lca, ICompositeCacheManager cacheMgr )
+ public synchronized UDPDiscoveryService getService( ITCPLateralCacheAttributes lca, ICompositeCacheManager cacheMgr, ICacheEventLogger cacheEventLogger,
+ IElementSerializer elementSerializer )
{
- UDPDiscoveryService service = getService( lca.getUdpDiscoveryAddr(), lca.getUdpDiscoveryPort(), lca.getTcpListenerPort(), cacheMgr );
+ UDPDiscoveryService service = getService( lca.getUdpDiscoveryAddr(), lca.getUdpDiscoveryPort(), lca.getTcpListenerPort(), cacheMgr, cacheEventLogger, elementSerializer );
// TODO find a way to remote these attributes from the service, the manager needs it on disocvery.
service.setTcpLateralCacheAttributes( lca );
@@ -84,10 +90,13 @@
* @param discoveryPort
* @param servicePort
* @param cacheMgr
- * @return
+ * @param cacheEventLogger
+ * @param elementSerializer *
+ * @return UDPDiscoveryService
*/
- public synchronized UDPDiscoveryService getService( String discoveryAddress, int discoveryPort, int servicePort,
- ICompositeCacheManager cacheMgr )
+ private synchronized UDPDiscoveryService getService( String discoveryAddress, int discoveryPort, int servicePort,
+ ICompositeCacheManager cacheMgr, ICacheEventLogger cacheEventLogger,
+ IElementSerializer elementSerializer )
{
String key = discoveryAddress + ":" + discoveryPort;
@@ -99,7 +108,7 @@
log.info( "Creating service for address:port [" + key + "]" );
}
- service = new UDPDiscoveryService( discoveryAddress, discoveryPort, servicePort, cacheMgr );
+ service = new UDPDiscoveryService( discoveryAddress, discoveryPort, servicePort, cacheMgr, cacheEventLogger, elementSerializer );
services.put( key, service );
}
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryReceiver.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryReceiver.java?rev=687478&r1=687477&r2=687478&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryReceiver.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryReceiver.java Wed Aug 20 14:44:05 2008
@@ -38,7 +38,9 @@
import org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes;
import org.apache.jcs.engine.behavior.ICache;
import org.apache.jcs.engine.behavior.ICompositeCacheManager;
+import org.apache.jcs.engine.behavior.IElementSerializer;
import org.apache.jcs.engine.behavior.IShutdownObserver;
+import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
import EDU.oswego.cs.dl.util.concurrent.BoundedBuffer;
import EDU.oswego.cs.dl.util.concurrent.PooledExecutor;
@@ -79,25 +81,36 @@
private boolean shutdown = false;
+ /** The event logger. */
+ protected ICacheEventLogger cacheEventLogger;
+
+ /** The serializer. */
+ protected IElementSerializer elementSerializer;
+
/**
* Constructor for the LateralUDPReceiver object.
* <p>
* We determine out own host using InetAddress
- *
+ *<p>
* @param service
* @param multicastAddressString
* @param multicastPort
* @param cacheMgr
+ * @param cacheEventLogger
+ * @param elementSerializer
* @exception IOException
*/
public UDPDiscoveryReceiver( UDPDiscoveryService service, String multicastAddressString, int multicastPort,
- ICompositeCacheManager cacheMgr )
+ ICompositeCacheManager cacheMgr, ICacheEventLogger cacheEventLogger,
+ IElementSerializer elementSerializer )
throws IOException
{
this.service = service;
this.multicastAddressString = multicastAddressString;
this.multicastPort = multicastPort;
this.cacheMgr = cacheMgr;
+ this.cacheEventLogger = cacheEventLogger;
+ this.elementSerializer = elementSerializer;
// create a small thread pool to handle a barage
pooledExecutor = new PooledExecutor( new BoundedBuffer( 100 ), maxPoolSize );
@@ -124,7 +137,6 @@
/**
* Creates the socket for this class.
- *
* @param multicastAddressString
* @param multicastPort
* @throws IOException
@@ -145,9 +157,8 @@
}
/**
- * Highly unreliable. If it is processing one message while another comes in ,
- * the second message is lost. This is for low concurency peppering.
- *
+ * Highly unreliable. If it is processing one message while another comes in , the second
+ * message is lost. This is for low concurency peppering.
* @return the object message
* @throws IOException
*/
@@ -238,8 +249,7 @@
}
/**
- * @param cnt
- * The cnt to set.
+ * @param cnt The cnt to set.
*/
public void setCnt( int cnt )
{
@@ -321,7 +331,8 @@
}
lca.setTransmissionType( LateralCacheAttributes.TCP );
lca.setTcpServer( message.getHost() + ":" + message.getPort() );
- LateralTCPCacheManager lcm = LateralTCPCacheManager.getInstance( lca, cacheMgr );
+ LateralTCPCacheManager lcm = LateralTCPCacheManager.getInstance( lca, cacheMgr, cacheEventLogger,
+ elementSerializer );
ArrayList regions = message.getCacheNames();
if ( regions != null )
@@ -373,9 +384,7 @@
/**
* Allows us to set the daemon status on the executor threads
- *
* @author aaronsm
- *
*/
class MyThreadFactory
implements ThreadFactory
---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-dev-help@jakarta.apache.org