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 2006/06/08 22:51:13 UTC
svn commit: r412854 - in /jakarta/jcs/trunk: src/conf/
src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/
src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/
src/test-conf/ src/test/org/apache/jcs/auxiliary/disk/indexed/ tempbuild/
xdocs/
Author: asmuts
Date: Thu Jun 8 13:51:12 2006
New Revision: 412854
URL: http://svn.apache.org/viewvc?rev=412854&view=rev
Log:
fixed udp discovery configuration bug that i introduced in the last build.
fixed old udp discovery xdoc, that had a bad tcp cache config.
added a brief jdbc disk cache xdoc.
updated the changes file.
increased the temp build version to 1.2.7.6
improved log messages for lateral tcp and udp discovery.
added a manual test that puts lots of stuff in the disk cache.
added a new 1.2.7.6 temp build compiled under jdk 1.3.1
Added:
jakarta/jcs/trunk/src/conf/cacheID.ccf
jakarta/jcs/trunk/src/test-conf/TestDiskCacheHuge.ccf
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/HugeQuantityIndDiskCacheLoadTest.java
jakarta/jcs/trunk/tempbuild/jcs-1.2.7.6.jar (with props)
jakarta/jcs/trunk/xdocs/JDBCDiskCache.xml
Modified:
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/LateralTCPListener.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/UDPDiscoverySender.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoverySenderThread.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryService.java
jakarta/jcs/trunk/xdocs/LateralUDPDiscovery.xml
jakarta/jcs/trunk/xdocs/changes.xml
jakarta/jcs/trunk/xdocs/navigation.xml
Added: jakarta/jcs/trunk/src/conf/cacheID.ccf
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/conf/cacheID.ccf?rev=412854&view=auto
==============================================================================
--- jakarta/jcs/trunk/src/conf/cacheID.ccf (added)
+++ jakarta/jcs/trunk/src/conf/cacheID.ccf Thu Jun 8 13:51:12 2006
@@ -0,0 +1,49 @@
+##############################################################
+################## DEFAULT CACHE REGION #####################
+# sets the default aux value for any non configured caches
+jcs.default=DC
+jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
+jcs.default.cacheattributes.MaxObjects=0
+jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
+jcs.default.cacheattributes.UseMemoryShrinker=true
+jcs.default.cacheattributes.MaxMemoryIdleTimeSeconds=3600
+jcs.default.cacheattributes.ShrinkerIntervalSeconds=60
+jcs.default.elementattributes=org.apache.jcs.engine.ElementAttributes
+jcs.default.elementattributes.IsEternal=false
+jcs.default.elementattributes.MaxLifeSeconds=700
+jcs.default.elementattributes.IdleTime=1800
+jcs.default.elementattributes.IsSpool=true
+jcs.default.elementattributes.IsRemote=true
+jcs.default.elementattributes.IsLateral=true
+
+
+##############################################################
+################## CACHE REGIONS AVAILABLE ###################
+# Regions preconfirgured for caching
+jcs.region.testCache1=DC
+jcs.region.testCache1.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
+jcs.region.testCache1.cacheattributes.MaxObjects=0
+jcs.region.testCache1.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
+jcs.region.testCache1.cacheattributes.UseMemoryShrinker=true
+jcs.region.testCache1.cacheattributes.ShrinkerIntervalSeconds=30
+jcs.region.testCache1.cacheattributes.MaxMemoryIdleTimeSeconds=300
+jcs.region.testCache1.cacheattributes.MaxSpoolPerRun=100
+jcs.region.testCache1.elementattributes=org.apache.jcs.engine.ElementAttributes
+jcs.region.testCache1.elementattributes.IsEternal=false
+jcs.region.testCache1.elementattributes.MaxLifeSeconds=60000
+jcs.region.testCache1.elementattributes.IsLateral=true
+jcs.region.testCache1.elementattributes.IsRemote=true
+
+
+##############################################################
+################## AUXILIARY CACHES AVAILABLE ################
+
+# 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
+jcs.auxiliary.DC.attributes.DiskPath=target/test-sandbox/raf
+jcs.auxiliary.DC.attributes.MaxPurgatorySize=10000000
+jcs.auxiliary.DC.attributes.MaxKeySize=1000000
+jcs.auxiliary.DC.attributes.MaxRecycleBinSize=50000
+jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=300000
+jcs.auxiliary.DC.attributes.ShutdownSpoolTimeLimit=60
\ No newline at end of file
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=412854&r1=412853&r2=412854&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 Thu Jun 8 13:51:12 2006
@@ -36,10 +36,12 @@
/**
* Constructs a LateralCacheNoWaitFacade for the given configuration. Each
* lateral service / local relationship is managed by one manager. This manager
- * canl have multiple caches. The remote relationships are consolidated and
- * restored via these managers. The facade provides a front to the composite
- * cache so the implmenetation is transparent.
- *
+ * can have multiple caches. The remote relationships are consolidated and
+ * restored via these managers.
+ *
+ * The facade provides a front to the composite cache so the implmentation is
+ * transparent.
+ *
*/
public class LateralTCPCacheFactory
extends LateralCacheAbstractFactory
@@ -54,11 +56,10 @@
*/
public AuxiliaryCache createCache( AuxiliaryCacheAttributes iaca, ICompositeCacheManager cacheMgr )
{
-
ITCPLateralCacheAttributes lac = (ITCPLateralCacheAttributes) iaca;
ArrayList noWaits = new ArrayList();
- //pars up the tcp servers and set the tcpServer value and
+ // pars up the tcp servers and set the tcpServer value and
// get the manager and then get the cache
// no servers are required.
if ( lac.getTcpServers() != null )
@@ -66,7 +67,7 @@
StringTokenizer it = new StringTokenizer( lac.getTcpServers(), "," );
if ( log.isDebugEnabled() )
{
- log.debug( "Configured for " + it.countTokens() + " servers." );
+ log.debug( "Configured for [" + it.countTokens() + "] servers." );
}
while ( it.hasMoreElements() )
{
@@ -82,15 +83,18 @@
if ( ic != null )
{
noWaits.add( ic );
- }
+ }
else
{
- log.debug( "noWait is null, no lateral connection made" );
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "noWait is null, no lateral connection made" );
+ }
}
}
}
- createListener( (LateralCacheAttributes)iaca, cacheMgr );
+ createListener( (LateralCacheAttributes) iaca, cacheMgr );
// create the no wait facade.
LateralCacheNoWaitFacade lcnwf = new LateralCacheNoWaitFacade( (LateralCacheNoWait[]) noWaits
@@ -110,12 +114,10 @@
*/
public void createListener( LateralCacheAttributes lac, ICompositeCacheManager cacheMgr )
{
-
- ITCPLateralCacheAttributes attr = (ITCPLateralCacheAttributes)lac;
+ ITCPLateralCacheAttributes attr = (ITCPLateralCacheAttributes) lac;
// don't create a listener if we are not receiving.
if ( attr.isReceive() )
{
-
if ( log.isInfoEnabled() )
{
log.info( "Creating listener for " + lac );
@@ -123,10 +125,8 @@
try
{
-
// make a listener. if one doesn't exist
LateralTCPListener.getInstance( attr, cacheMgr );
-
}
catch ( Exception e )
{
@@ -146,7 +146,8 @@
* Creates the discovery service. Only creates this for tcp laterals right
* now.
*
- * @param lac ITCPLateralCacheAttributes
+ * @param lac
+ * ITCPLateralCacheAttributes
* @param lcnwf
* @param cacheMgr
* @return null if none is created.
@@ -156,10 +157,9 @@
{
UDPDiscoveryService discovery = null;
- // create the UDP discovery for the TCP lateral
+ // create the UDP discovery for the TCP lateral
if ( lac.isUdpDiscoveryEnabled() )
{
-
// 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 );
@@ -170,9 +170,7 @@
{
log.info( "Created UDPDiscoveryService for TCP lateral cache." );
}
-
}
return discovery;
}
-
}
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=412854&r1=412853&r2=412854&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 Thu Jun 8 13:51:12 2006
@@ -53,21 +53,16 @@
public class LateralTCPCacheManager
extends LateralCacheAbstractManager
{
-
private static final long serialVersionUID = -9213011856644392480L;
private final static Log log = LogFactory.getLog( LateralTCPCacheManager.class );
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;
@@ -84,6 +79,7 @@
*/
private LateralCacheWatchRepairable lateralWatch;
+ /** This is set in the constructor. */
private ICompositeCacheManager cacheMgr;
/**
@@ -110,11 +106,8 @@
instances.put( lca.toString(), ins );
}
}
-
createMonitor( ins );
-
}
-
ins.clients++;
return ins;
@@ -129,7 +122,7 @@
*/
private static synchronized void createMonitor( ILateralCacheManager instance )
{
- // only want one monitor per lateral type
+ // only want one monitor per lateral type
// Fires up the monitoring daemon.
if ( monitor == null )
{
@@ -142,11 +135,10 @@
t.start();
}
}
-
}
/**
- * Constructor for the LateralCacheManager object
+ * Constructor for the LateralCacheManager object.
*
* @param lcaA
* @param cacheMgr
@@ -162,33 +154,29 @@
log.debug( "Creating lateral cache service, lca = " + this.lca );
}
- // need to create the service based on the type
-
+ // Create the service
try
{
-
- log.debug( "Creating TCP service" );
- log.info( "Creating TCP service, lca = " + this.lca );
-
+ if ( log.isInfoEnabled() )
+ {
+ log.info( "Creating TCP service, lca = " + this.lca );
+ }
this.lateralService = new LateralTCPService( this.lca );
if ( this.lateralService == null )
{
log.error( "No service created, must zombie" );
-
throw new Exception( "No service created for lateral cache." );
}
this.lateralWatch = new LateralCacheWatchRepairable();
this.lateralWatch.setCacheWatch( new ZombieLateralCacheWatch() );
-
}
catch ( Exception ex )
{
// Failed to connect to the lateral server.
// Configure this LateralCacheManager instance to use the
// "zombie" services.
-
log.error( "Failure, lateral instance will use zombie service", ex );
this.lateralService = new ZombieLateralCacheService();
@@ -236,23 +224,28 @@
*/
public AuxiliaryCache getCache( String cacheName )
{
- LateralCacheNoWait c = null;
+ LateralCacheNoWait lateralNoWait = null;
synchronized ( this.caches )
{
- c = (LateralCacheNoWait) this.caches.get( cacheName );
- if ( c == null )
+ lateralNoWait = (LateralCacheNoWait) this.caches.get( cacheName );
+ if ( lateralNoWait == null )
{
LateralCacheAttributes attr = (LateralCacheAttributes) lca.copy();
attr.setCacheName( cacheName );
+
LateralCache cache = new LateralCache( attr, this.lateralService, monitor );
if ( log.isDebugEnabled() )
{
- log.debug( "Created cache for noWait, cache = [" + cache + "]" );
+ log.debug( "Created cache for noWait, cache [" + cache + "]" );
}
- c = new LateralCacheNoWait( cache );
- this.caches.put( cacheName, c );
+ lateralNoWait = new LateralCacheNoWait( cache );
+ this.caches.put( cacheName, lateralNoWait );
- log.info( "Created LateralCacheNoWait for " + this.lca + " LateralCacheNoWait = [" + c + "]" );
+ if ( log.isInfoEnabled() )
+ {
+ log.info( "Created LateralCacheNoWait for [" + this.lca + "] LateralCacheNoWait = ["
+ + lateralNoWait + "]" );
+ }
}
}
@@ -261,9 +254,7 @@
{
try
{
-
addLateralCacheListener( cacheName, LateralTCPListener.getInstance( this.lca, cacheMgr ) );
-
}
catch ( IOException ioe )
{
@@ -281,10 +272,9 @@
log.debug( "Not creating a listener since we are not receiving." );
}
}
-
// TODO: need listener repair
- return c;
+ return lateralNoWait;
}
/*
@@ -317,5 +307,4 @@
}
return service;
}
-
}
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java?rev=412854&r1=412853&r2=412854&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java Thu Jun 8 13:51:12 2006
@@ -142,7 +142,6 @@
pooledExecutor = new PooledExecutor();
pooledExecutor.setThreadFactory( new MyThreadFactory() );
-
}
catch ( Exception ex )
{
@@ -422,7 +421,7 @@
}
/**
- * Separate thread run when a command comes into the LateralTCPReceiver.
+ * A Separate thread taht runs when a command comes into the LateralTCPReceiver.
*/
public class ConnectionHandler
implements Runnable
@@ -488,11 +487,11 @@
}
catch ( java.io.EOFException e )
{
- log.info( "Caught java.io.EOFException closing conneciton." );
+ log.info( "Caught java.io.EOFException closing connection." );
}
catch ( java.net.SocketException e )
{
- log.info( "Caught java.net.SocketException closing conneciton." );
+ log.info( "Caught java.net.SocketException closing connection." );
}
catch ( Exception e )
{
@@ -586,7 +585,6 @@
class MyThreadFactory
implements ThreadFactory
{
-
/*
* (non-Javadoc)
*
@@ -599,6 +597,5 @@
t.setPriority( Thread.MIN_PRIORITY );
return t;
}
-
}
}
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=412854&r1=412853&r2=412854&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 Thu Jun 8 13:51:12 2006
@@ -49,7 +49,7 @@
*/
public synchronized UDPDiscoveryService getService( ITCPLateralCacheAttributes lca, ICompositeCacheManager cacheMgr )
{
- UDPDiscoveryService service = getService( lca.getTcpServer(), lca.getUdpDiscoveryPort(), lca.getTcpListenerPort(), cacheMgr );
+ UDPDiscoveryService service = getService( lca.getUdpDiscoveryAddr(), lca.getUdpDiscoveryPort(), lca.getTcpListenerPort(), cacheMgr );
// TODO find a way to remote these attributes from the service, the manager needs it on disocvery.
service.setTcpLateralCacheAttributes( lca );
@@ -75,9 +75,9 @@
UDPDiscoveryService service = (UDPDiscoveryService) services.get( key );
if ( service == null )
{
- if ( log.isDebugEnabled() )
+ if ( log.isInfoEnabled() )
{
- log.debug( "Creating service for " + key );
+ log.info( "Creating service for address:port [" + key + "]" );
}
service = new UDPDiscoveryService( discoveryAddress, discoveryPort, servicePort, cacheMgr );
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=412854&r1=412853&r2=412854&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 Thu Jun 8 13:51:12 2006
@@ -102,7 +102,10 @@
//pooledExecutor.setMinimumPoolSize(1);
pooledExecutor.setThreadFactory( new MyThreadFactory() );
- log.debug( "constructing listener, " + this.multicastAddressString + ":" + this.multicastPort );
+ if ( log.isInfoEnabled() )
+ {
+ log.info( "constructing listener, [" + this.multicastAddressString + ":" + this.multicastPort + "]" );
+ }
try
{
@@ -133,7 +136,7 @@
}
catch ( IOException e )
{
- log.error( "Could not bind to multicast address " + multicastAddressString + ":" + multicastPort, e );
+ log.error( "Could not bind to multicast address [" + multicastAddressString + ":" + multicastPort + "]", e );
throw e;
}
}
@@ -172,12 +175,10 @@
/** Main processing method for the LateralUDPReceiver object */
public void run()
{
-
try
{
while ( !shutdown )
{
-
Object obj = waitForMessage();
// not thread safe, but just for debugging
@@ -209,7 +210,6 @@
{
log.warn( "message is null" );
}
-
}
catch ( ClassCastException cce )
{
@@ -257,7 +257,6 @@
public class MessageHandler
implements Runnable
{
-
private UDPDiscoveryMessage message = null;
/**
@@ -275,7 +274,6 @@
*/
public void run()
{
-
// consider comparing ports here instead.
if ( message.getRequesterId() == LateralCacheInfo.listenerId )
{
@@ -333,7 +331,6 @@
try
{
-
ICache ic = lcm.getCache( cacheName );
if ( log.isDebugEnabled() )
@@ -355,7 +352,8 @@
{
log.error( "Problem creating no wait", e );
}
- } // end while
+ }
+ // end while
}
else
{
@@ -366,7 +364,6 @@
{
log.error( "Problem getting lateral maanger", e );
}
-
}
}
}
@@ -380,7 +377,6 @@
class MyThreadFactory
implements ThreadFactory
{
-
/*
* (non-Javadoc)
*
@@ -393,7 +389,6 @@
t.setPriority( Thread.MIN_PRIORITY );
return t;
}
-
}
/*
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoverySender.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoverySender.java?rev=412854&r1=412853&r2=412854&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoverySender.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoverySender.java Thu Jun 8 13:51:12 2006
@@ -32,7 +32,7 @@
* This is a generic sender for the UDPDiscovery process.
*
* @author Aaron Smuts
- *
+ *
*/
public class UDPDiscoverySender
{
@@ -61,7 +61,6 @@
{
try
{
-
m_localSocket = new MulticastSocket();
// Remote address.
@@ -79,36 +78,37 @@
/**
* Closes the socket connection.
- *
+ *
*/
public void destroy()
{
- try
+ try
{
// TODO when we move to jdk 1.4 reinstate the isClosed check
if ( this.m_localSocket != null )
- //&& !this.m_localSocket.isClosed() )
+ // && !this.m_localSocket.isClosed() )
{
this.m_localSocket.close();
}
}
- catch( Exception e )
+ catch ( Exception e )
{
log.error( "Problem destrying sender", e );
}
}
-
+
/**
* Just being careful about closing the socket.
+ *
* @throws Throwable
*/
public void finalize()
- throws Throwable
+ throws Throwable
{
super.finalize();
destroy();
}
-
+
/**
* Send messages.
*
@@ -118,17 +118,17 @@
public void send( UDPDiscoveryMessage message )
throws IOException
{
- if ( this.m_localSocket == null)
+ if ( this.m_localSocket == null )
{
- throw new IOException( "Socket is null, cannot send message." );
+ throw new IOException( "Socket is null, cannot send message." );
}
-
- // TODO when we move to jdk 1.4 reinstate the isClosed check
- //if (this.m_localSocket.isClosed() )
- //{
- // throw new IOException( "Socket is closed, cannot send message." );
- //}
-
+
+ // TODO when we move to jdk 1.4 reinstate the isClosed check
+ // if (this.m_localSocket.isClosed() )
+ // {
+ // throw new IOException( "Socket is closed, cannot send message." );
+ // }
+
if ( log.isDebugEnabled() )
{
log.debug( "sending UDPDiscoveryMessage, message = " + message );
@@ -151,7 +151,6 @@
catch ( IOException e )
{
log.error( "Error sending message", e );
-
throw e;
}
}
@@ -206,7 +205,6 @@
protected void passiveBroadcast( String host, int port, ArrayList cacheNames, long listenerId )
throws IOException
{
-
if ( log.isDebugEnabled() )
{
log.debug( "sending passiveBroadcast " );
@@ -220,7 +218,6 @@
message.setMessageType( UDPDiscoveryMessage.PASSIVE_BROADCAST );
send( message );
}
-
}
/**
@@ -233,7 +230,6 @@
class MyByteArrayOutputStream
extends ByteArrayOutputStream
{
-
/**
* Gets the bytes attribute of the MyByteArrayOutputStream object
*
@@ -245,4 +241,3 @@
}
}
// end class
-
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoverySenderThread.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoverySenderThread.java?rev=412854&r1=412853&r2=412854&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoverySenderThread.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoverySenderThread.java Thu Jun 8 13:51:12 2006
@@ -10,12 +10,11 @@
* listening.
*
* @author Aaron Smuts
- *
+ *
*/
public class UDPDiscoverySenderThread
implements Runnable
{
-
private final static Log log = LogFactory.getLog( UDPDiscoverySenderThread.class );
// the UDP multicast port
@@ -65,7 +64,8 @@
* host name we can be found at
* @param myPort
* port we are listening on
- * @param cacheNames List of strings of the names of the regiond participating.
+ * @param cacheNames
+ * List of strings of the names of the regiond participating.
*/
public UDPDiscoverySenderThread( String discoveryAddress, int discoveryPort, String myHostName, int myPort,
ArrayList cacheNames )
@@ -90,7 +90,7 @@
// move this to the run method and determine how often to call it.
sender = new UDPDiscoverySender( discoveryAddress, discoveryPort );
sender.requestBroadcast();
-
+
if ( log.isDebugEnabled() )
{
log.debug( "Sent a request broadcast to the group" );
@@ -106,7 +106,7 @@
{
if ( sender != null )
{
- sender.destroy();
+ sender.destroy();
}
}
catch ( Exception e )
@@ -143,13 +143,13 @@
}
catch ( Exception e )
{
- log.error( "Problem calling the UDP Discovery Sender", e );
+ log.error( "Problem calling the UDP Discovery Sender [" + discoveryAddress + ":" + discoveryPort + "]", e );
}
finally
{
try
{
- sender.destroy();
+ sender.destroy();
}
catch ( Exception e )
{
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryService.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryService.java?rev=412854&r1=412853&r2=412854&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryService.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryService.java Thu Jun 8 13:51:12 2006
@@ -36,7 +36,6 @@
public class UDPDiscoveryService
implements IShutdownObserver
{
-
private final static Log log = LogFactory.getLog( UDPDiscoveryService.class );
// The background broadcaster.
@@ -64,7 +63,7 @@
private int servicePort;
private ITCPLateralCacheAttributes tcpLateralCacheAttributes;
-
+
/**
*
* @param discoveryAddress
@@ -111,7 +110,8 @@
}
catch ( Exception e )
{
- log.error( "Problem creating UDPDiscoveryReceiver, we won't be able to find any other caches", e );
+ log.error( "Problem creating UDPDiscoveryReceiver, address [" + getDiscoveryAddress() + "] port [" + getDiscoveryPort()
+ + "] we won't be able to find any other caches", e );
}
// todo only do the passive if receive is inenabled, perhaps set the
@@ -158,7 +158,6 @@
}
return isNew;
-
}
/**
@@ -219,11 +218,11 @@
{
log.debug( "Called sender to issue a passive broadcast" );
}
-
}
catch ( Exception e )
{
- log.error( "Problem calling the UDP Discovery Sender", e );
+ log.error( "Problem calling the UDP Discovery Sender. address [" + getDiscoveryAddress() + "] port ["
+ + getDiscoveryPort() + "]", e );
}
finally
{
@@ -268,7 +267,6 @@
class MyThreadFactory
implements ThreadFactory
{
-
/*
* (non-Javadoc)
*
@@ -281,7 +279,6 @@
t.setPriority( Thread.MIN_PRIORITY );
return t;
}
-
}
/*
@@ -321,7 +318,6 @@
{
log.error( "Problem shutting down UDP sender." );
}
-
}
/**
@@ -376,7 +372,8 @@
}
/**
- * @param tCPLateralCacheAttributes The tCPLateralCacheAttributes to set.
+ * @param tCPLateralCacheAttributes
+ * The tCPLateralCacheAttributes to set.
*/
public void setTcpLateralCacheAttributes( ITCPLateralCacheAttributes tCPLateralCacheAttributes )
{
Added: jakarta/jcs/trunk/src/test-conf/TestDiskCacheHuge.ccf
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test-conf/TestDiskCacheHuge.ccf?rev=412854&view=auto
==============================================================================
--- jakarta/jcs/trunk/src/test-conf/TestDiskCacheHuge.ccf (added)
+++ jakarta/jcs/trunk/src/test-conf/TestDiskCacheHuge.ccf Thu Jun 8 13:51:12 2006
@@ -0,0 +1,46 @@
+# Cache configuration for the 'TestDiskCacheNoMemory' test. The memory cache has a
+# a maximum of 0 objects, so objects should get pushed into the disk cache
+
+jcs.default=indexedDiskCache
+jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
+jcs.default.cacheattributes.MaxObjects=0
+jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
+
+
+##### CACHE REGIONS FOR TEST
+
+jcs.region.indexedRegion1=indexedDiskCache
+jcs.region.indexedRegion1.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
+jcs.region.indexedRegion1.cacheattributes.MaxObjects=0
+jcs.region.indexedRegion1.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
+
+
+##### AUXILIARY CACHES
+
+# Indexed Disk Cache
+jcs.auxiliary.indexedDiskCache=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory
+jcs.auxiliary.indexedDiskCache.attributes=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes
+jcs.auxiliary.indexedDiskCache.attributes.DiskPath=target/test-sandbox/indexed-disk-cache-conc
+jcs.auxiliary.indexedDiskCache.attributes.MaxPurgatorySize=300000
+jcs.auxiliary.indexedDiskCache.attributes.MaxKeySize=500000
+jcs.auxiliary.indexedDiskCache.attributes.MaxRecycleBinSize=50000
+jcs.auxiliary.indexedDiskCache.attributes.OptimizeAtRemoveCount=300000
+jcs.auxiliary.indexedDiskCache.attributes.EventQueueType=SINGLE
+#jcs.auxiliary.indexedDiskCache.attributes.EventQueuePoolName=disk_cache_event_queue
+
+##############################################################
+################## THREAD POOL CONFIGURATION ###################
+# Default thread pool config
+thread_pool.default.boundarySize=2000
+thread_pool.default.maximumPoolSize=150
+thread_pool.default.minimumPoolSize=4
+thread_pool.default.keepAliveTime=350000
+#RUN ABORT WAIT BLOCK DISCARDOLDEST
+thread_pool.default.whenBlockedPolicy=RUN
+thread_pool.default.startUpSize=4
+
+# Disk Cache pool
+thread_pool.disk_cache_event_queue.useBoundary=false
+thread_pool.disk_cache_event_queue.minimumPoolSize=2
+thread_pool.disk_cache_event_queue.keepAliveTime=3500
+thread_pool.disk_cache_event_queue.startUpSize=10
Added: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/HugeQuantityIndDiskCacheLoadTest.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/HugeQuantityIndDiskCacheLoadTest.java?rev=412854&view=auto
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/HugeQuantityIndDiskCacheLoadTest.java (added)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/HugeQuantityIndDiskCacheLoadTest.java Thu Jun 8 13:51:12 2006
@@ -0,0 +1,113 @@
+package org.apache.jcs.auxiliary.disk.indexed;
+
+import junit.framework.TestCase;
+
+import org.apache.jcs.JCS;
+
+/**
+ * Put a few hundred thousand entries in the disk cache.
+ *
+ * @author Aaron Smuts
+ *
+ */
+public class HugeQuantityIndDiskCacheLoadTest
+ extends TestCase
+{
+
+ /**
+ * Test setup
+ */
+ public void setUp()
+ {
+ JCS.setConfigFilename( "/TestDiskCacheHuge.ccf" );
+ }
+
+ /**
+ * Adds items to cache, gets them, and removes them. The item count is more
+ * than the size of the memory cache, so items should spool to disk.
+ *
+ * @param region
+ * Name of the region to access
+ *
+ * @exception Exception
+ * If an error occurs
+ */
+ public void testLargeNumberOfItems()
+ throws Exception
+ {
+ int items = 300000;
+ String region = "testCache1";
+
+ JCS jcs = JCS.getInstance( region );
+
+ try
+ {
+
+ System.out.println( "Start: " + measureMemoryUse() );
+
+ // Add items to cache
+
+ for ( int i = 0; i <= items; i++ )
+ {
+ jcs.put( i + ":key", region + " data " + i );
+ }
+
+ System.out.println( jcs.getStats() );
+ System.out.println( "--------------------------" );
+ System.out.println( "After put: " + measureMemoryUse() );
+
+ Thread.sleep( 5000 );
+
+ System.out.println( jcs.getStats() );
+ System.out.println( "--------------------------" );
+ System.out.println( "After wait: " + measureMemoryUse() );
+
+ // Test that all items are in cache
+
+ for ( int i = 0; i <= items; i++ )
+ {
+ String value = (String) jcs.get( i + ":key" );
+
+ assertEquals( region + " data " + i, value );
+ }
+
+ System.out.println( "After get: " + measureMemoryUse() );
+
+ // // Remove all the items
+ // for ( int i = 0; i <= items; i++ )
+ // {
+ // jcs.remove( i + ":key" );
+ // }
+ //
+ // // Verify removal
+ // for ( int i = 0; i <= items; i++ )
+ // {
+ // assertNull( "Removed key should be null: " + i + ":key" + "\n
+ // stats " + jcs.getStats(), jcs.get( i + ":key" ) );
+ // }
+
+ }
+ finally
+ {
+ // dump the stats to the report
+ System.out.println( jcs.getStats() );
+ System.out.println( "--------------------------" );
+ System.out.println( "End: " + measureMemoryUse() );
+ }
+ }
+
+ /**
+ * Measure memory used by the VM.
+ *
+ * @return
+ * @throws InterruptedException
+ */
+ protected long measureMemoryUse()
+ throws InterruptedException
+ {
+ System.gc();
+ Thread.sleep( 3000 );
+ System.gc();
+ return Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
+ }
+}
Added: jakarta/jcs/trunk/tempbuild/jcs-1.2.7.6.jar
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/tempbuild/jcs-1.2.7.6.jar?rev=412854&view=auto
==============================================================================
Binary file - no diff available.
Propchange: jakarta/jcs/trunk/tempbuild/jcs-1.2.7.6.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: jakarta/jcs/trunk/xdocs/JDBCDiskCache.xml
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/xdocs/JDBCDiskCache.xml?rev=412854&view=auto
==============================================================================
--- jakarta/jcs/trunk/xdocs/JDBCDiskCache.xml (added)
+++ jakarta/jcs/trunk/xdocs/JDBCDiskCache.xml Thu Jun 8 13:51:12 2006
@@ -0,0 +1,107 @@
+<?xml version="1.0"?>
+
+<document>
+ <properties>
+ <title>JDBC Disk Cache</title>
+ <author email="asmuts@apache.org">Aaron Smuts</author>
+ </properties>
+
+ <body>
+ <section name="JDBC Disk Auxiliary Cache">
+ <p>
+ The JDBC disk cache uses a relational database such as
+ MySQL as a persistent store. It works with Oracle, MySQL
+ and HSQL. The cache elements are serialized and written
+ into a BLOB. Mutliple regions can share a single table.
+ You can define multiple, differently configured JDBC
+ disk caches in one JCS instance. This allows you to use
+ different tables for different cache regions.
+ </p>
+
+ <subsection name="Example cache.ccf (MySQL)">
+ <source>
+ <![CDATA[
+##############################################################
+################## DEFAULT CACHE REGION #####################
+# sets the default aux value for any non configured caches
+jcs.default=MYSQL,RCluster
+jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
+jcs.default.cacheattributes.MaxObjects=5000
+jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
+jcs.default.cacheattributes.UseMemoryShrinker=true
+jcs.default.cacheattributes.MaxMemoryIdleTimeSeconds=7200
+jcs.default.cacheattributes.ShrinkerIntervalSeconds=60
+jcs.default.elementattributes=org.apache.jcs.engine.ElementAttributes
+jcs.default.elementattributes.IsEternal=false
+jcs.default.elementattributes.MaxLifeSeconds=14400
+jcs.default.elementattributes.IdleTime=14400
+jcs.default.elementattributes.IsSpool=true
+jcs.default.elementattributes.IsRemote=true
+jcs.default.elementattributes.IsLateral=true
+
+##############################################################
+################## CACHE REGIONS AVAILABLE ###################
+
+##############################################################
+################## AUXILIARY CACHES AVAILABLE ################
+# MYSQL disk cache used for flight options
+jcs.auxiliary.MYSQL=org.apache.jcs.auxiliary.disk.jdbc.JDBCDiskCacheFactory
+jcs.auxiliary.MYSQL.attributes=org.apache.jcs.auxiliary.disk.jdbc.JDBCDiskCacheAttributes
+jcs.auxiliary.MYSQL.attributes.userName=myUsername
+jcs.auxiliary.MYSQL.attributes.password=myPassword
+jcs.auxiliary.MYSQL.attributes.url=${MYSQL}
+jcs.auxiliary.MYSQL.attributes.driverClassName=org.gjt.mm.mysql.Driver
+jcs.auxiliary.MYSQL.attributes.tableName=JCS_STORE
+jcs.auxiliary.MYSQL.attributes.testBeforeInsert=false
+jcs.auxiliary.MYSQL.attributes.maxActive=100
+jcs.auxiliary.MYSQL.attributes.MaxPurgatorySize=10000000
+jcs.auxiliary.MYSQL.attributes.UseDiskShrinker=true
+jcs.auxiliary.MYSQL.attributes.ShrinkerIntervalSeconds=1800
+jcs.auxiliary.MYSQL.attributes.allowRemoveAll=false
+jcs.auxiliary.MYSQL.attributes.EventQueueType=POOLED
+jcs.auxiliary.MYSQL.attributes.EventQueuePoolName=disk_cache_event_queue
+
+##############################################################
+################## OPTIONAL THREAD POOL CONFIGURATION #########
+# Disk Cache pool
+thread_pool.disk_cache_event_queue.useBoundary=true
+thread_pool.disk_cache_event_queue.boundarySize=1000
+thread_pool.disk_cache_event_queue.maximumPoolSize=50
+thread_pool.disk_cache_event_queue.minimumPoolSize=10
+thread_pool.disk_cache_event_queue.keepAliveTime=3500
+thread_pool.disk_cache_event_queue.whenBlockedPolicy=RUN
+thread_pool.disk_cache_event_queue.startUpSize=10
+ ]]>
+ </source>
+ </subsection>
+
+
+ <subsection name="Table Creation Script (MySQL)">
+ <source>
+ <![CDATA[
+drop TABLE JCS_STORE;
+
+CREATE TABLE JCS_STORE
+(
+ CACHE_KEY VARCHAR(250) NOT NULL,
+ REGION VARCHAR(250) NOT NULL,
+ ELEMENT BLOB,
+ CREATE_TIME DATETIME,
+ CREATE_TIME_SECONDS BIGINT,
+ MAX_LIFE_SECONDS BIGINT,
+ SYSTEM_EXPIRE_TIME_SECONDS BIGINT,
+ IS_ETERNAL CHAR(1),
+ PRIMARY KEY (CACHE_KEY, REGION)
+);
+
+alter table JCS_STORE MAX_ROWS = 10000000;
+
+alter table JCS_STORE AVG_ROW_LENGTH = 2100;
+
+create index JCS_STORE_DELETE_IDX on JCS_STORE (SYSTEM_EXPIRE_TIME_SECONDS,IS_ETERNAL,REGION);
+ ]]>
+ </source>
+ </subsection>
+ </section>
+ </body>
+</document>
\ No newline at end of file
Modified: jakarta/jcs/trunk/xdocs/LateralUDPDiscovery.xml
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/xdocs/LateralUDPDiscovery.xml?rev=412854&r1=412853&r2=412854&view=diff
==============================================================================
--- jakarta/jcs/trunk/xdocs/LateralUDPDiscovery.xml (original)
+++ jakarta/jcs/trunk/xdocs/LateralUDPDiscovery.xml Thu Jun 8 13:51:12 2006
@@ -40,11 +40,8 @@
It listens to port <code>1110</code>.
</p>
<source><![CDATA[
-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=org.apache.jcs.auxiliary.lateral.socket.tcp.LateralTCPCacheFactory
+jcs.auxiliary.LTCP.attributes=org.apache.jcs.auxiliary.lateral.socket.tcp.TCPLateralCacheAttributes
jcs.auxiliary.LTCP.attributes.TcpListenerPort=1110
jcs.auxiliary.LTCP.attributes.PutOnlyMode=true
jcs.auxiliary.LTCP.attributes.UdpDiscoveryAddr=228.5.6.8
Modified: jakarta/jcs/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/xdocs/changes.xml?rev=412854&r1=412853&r2=412854&view=diff
==============================================================================
--- jakarta/jcs/trunk/xdocs/changes.xml (original)
+++ jakarta/jcs/trunk/xdocs/changes.xml Thu Jun 8 13:51:12 2006
@@ -6,6 +6,20 @@
<body>
<release version="1.2.7.3" date="in CVS">
+ <action dev="asmuts" type="fix"
+ due-to="Rick Szeto @vizible.com">
+ Fixed UDP discovery configuration problem. The discovery
+ address was not being used. It was broken in the last
+ release.
+ </action>
+ <action dev="asmuts" type="fix" due-to="Alistair Forbes">
+ Fixed disk cache class cast problem when running inside
+ the remote cache. The disk cache was casting to an
+ instance and not the ICacheElement interface.
+ </action>
+ </release>
+
+ <release version="1.2.7.3" date="in CVS">
<action dev="asmuts" type="update" due-to="">
You can now configure the remote cache client to not
receive from the remote server.
@@ -95,7 +109,8 @@
</release>
<release version="1.2.6.7" date="in CVS">
- <action dev="asmuts" type="fix" due-to="Adam Siefker">
+ <action dev="asmuts" type="fix"
+ due-to="Adam Siefker @amazon.com">
Fixed shutdown for lateral. Added shutdown observer
framework. Changed listener thread to a daemon. Made
executor on listener use a daemon setting thread
Modified: jakarta/jcs/trunk/xdocs/navigation.xml
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/xdocs/navigation.xml?rev=412854&r1=412853&r2=412854&view=diff
==============================================================================
--- jakarta/jcs/trunk/xdocs/navigation.xml (original)
+++ jakarta/jcs/trunk/xdocs/navigation.xml Thu Jun 8 13:51:12 2006
@@ -45,6 +45,8 @@
href="/IndexedDiskAuxCache.html" />
<item name="Indexed Disk Properties"
href="/IndexedDiskCacheProperties.html" />
+ <item name="JDBC Disk Cache"
+ href="/JDBCDiskCache.html" />
<item name="JDBC Disk Properties"
href="/JDBCDiskCacheProperties.html" />
<item name="Remote Cache" href="/RemoteAuxCache.html" />
---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-dev-help@jakarta.apache.org