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/09/26 17:37:01 UTC
svn commit: r699369 - in /jakarta/jcs/trunk: ./
src/java/org/apache/jcs/auxiliary/remote/server/
src/java/org/apache/jcs/engine/ src/java/org/apache/jcs/engine/stats/
src/java/org/apache/jcs/utils/threadpool/
src/test/org/apache/jcs/auxiliary/remote/se...
Author: asmuts
Date: Fri Sep 26 08:37:01 2008
New Revision: 699369
URL: http://svn.apache.org/viewvc?rev=699369&view=rev
Log:
Cleaning up javadocs here and there. Added a timeout configurable custom socket factory. Increased the version in preparation for temp build.
Added:
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/TimeoutConfigurableRMIScoketFactory.java
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/TimeoutConfigurableRMIScoketFactoryUnitTest.java
Modified:
jakarta/jcs/trunk/pom.xml
jakarta/jcs/trunk/project.xml
jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheWatchRepairable.java
jakarta/jcs/trunk/src/java/org/apache/jcs/engine/PooledCacheEventQueue.java
jakarta/jcs/trunk/src/java/org/apache/jcs/engine/stats/Stats.java
jakarta/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/PoolConfiguration.java
jakarta/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/ThreadPool.java
jakarta/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/ThreadPoolManager.java
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactoryUnitTest.java
jakarta/jcs/trunk/xdocs/changes.xml
Modified: jakarta/jcs/trunk/pom.xml
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/pom.xml?rev=699369&r1=699368&r2=699369&view=diff
==============================================================================
--- jakarta/jcs/trunk/pom.xml (original)
+++ jakarta/jcs/trunk/pom.xml Fri Sep 26 08:37:01 2008
@@ -36,7 +36,7 @@
<groupId>org.apache.jcs</groupId>
<artifactId>jcs</artifactId>
<packaging>pom</packaging>
- <version>1.3.2.2-RC</version>
+ <version>1.3.2.3-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=699369&r1=699368&r2=699369&view=diff
==============================================================================
--- jakarta/jcs/trunk/project.xml (original)
+++ jakarta/jcs/trunk/project.xml Fri Sep 26 08:37:01 2008
@@ -17,7 +17,7 @@
<pomVersion>3</pomVersion>
<name>JCS</name>
<id>jcs</id>
- <currentVersion>1.3.2.2-RC</currentVersion>
+ <currentVersion>1.3.2.3-RC</currentVersion>
<organization>
<name>Apache Software Foundation</name>
<url>http://jakarta.apache.org/</url>
Added: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/TimeoutConfigurableRMIScoketFactory.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/TimeoutConfigurableRMIScoketFactory.java?rev=699369&view=auto
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/TimeoutConfigurableRMIScoketFactory.java (added)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/TimeoutConfigurableRMIScoketFactory.java Fri Sep 26 08:37:01 2008
@@ -0,0 +1,90 @@
+package org.apache.jcs.auxiliary.remote.server;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.net.InetSocketAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.rmi.server.RMISocketFactory;
+
+/**
+ * This can be injected into the the remote cache server as follows:
+ *
+ * <pre>
+ * jcs.remotecache.customrmisocketfactory=org.apache.jcs.auxiliary.remote.server.TimeoutConfigurableRMIScoketFactory
+ * jcs.remotecache.customrmisocketfactory.readTimeout=5000
+ * jcs.remotecache.customrmisocketfactory.openTimeout=5000
+ * </pre>
+ */
+public class TimeoutConfigurableRMIScoketFactory
+ extends RMISocketFactory
+ implements Serializable
+{
+ /** Don't change. */
+ private static final long serialVersionUID = 1489909775271203334L;
+
+ /** The socket read timeout */
+ private int readTimeout = 5000;
+
+ /** The socket open timeout */
+ private int openTimeout = 5000;
+
+ /**
+ * @param port
+ * @return ServerSocket
+ * @throws IOException
+ */
+ public ServerSocket createServerSocket( int port )
+ throws IOException
+ {
+ return new ServerSocket( port );
+ }
+
+ /**
+ * @param host
+ * @param port
+ * @return Socket
+ * @throws IOException
+ */
+ public Socket createSocket( String host, int port )
+ throws IOException
+ {
+ Socket socket = new Socket();
+ socket.setSoTimeout( readTimeout );
+ socket.setSoLinger( false, 0 );
+ socket.connect( new InetSocketAddress( host, port ), openTimeout );
+ return socket;
+ }
+
+ /**
+ * @param readTimeout the readTimeout to set
+ */
+ public void setReadTimeout( int readTimeout )
+ {
+ this.readTimeout = readTimeout;
+ }
+
+ /**
+ * @return the readTimeout
+ */
+ public int getReadTimeout()
+ {
+ return readTimeout;
+ }
+
+ /**
+ * @param openTimeout the openTimeout to set
+ */
+ public void setOpenTimeout( int openTimeout )
+ {
+ this.openTimeout = openTimeout;
+ }
+
+ /**
+ * @return the openTimeout
+ */
+ public int getOpenTimeout()
+ {
+ return openTimeout;
+ }
+}
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheWatchRepairable.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheWatchRepairable.java?rev=699369&r1=699368&r2=699369&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheWatchRepairable.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheWatchRepairable.java Fri Sep 26 08:37:01 2008
@@ -20,34 +20,33 @@
*/
import java.io.IOException;
-
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
-import org.apache.jcs.engine.behavior.ICacheObserver;
-import org.apache.jcs.engine.behavior.ICacheListener;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.jcs.engine.behavior.ICacheListener;
+import org.apache.jcs.engine.behavior.ICacheObserver;
/**
* Intercepts the requests to the underlying ICacheObserver object so that the
* listeners can be recorded locally for remote connection recovery purposes.
* (Durable subscription like those in JMS is not implemented at this stage for
* it can be too expensive on the runtime.)
- *
*/
public class CacheWatchRepairable
implements ICacheObserver
{
+ /** The logger */
private final static Log log = LogFactory.getLog( CacheWatchRepairable.class );
- // the underlying ICacheObserver.
+ /** the underlying ICacheObserver. */
private ICacheObserver cacheWatch;
+ /** Map of cache regions. */
private Map cacheMap = new HashMap();
/**
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/PooledCacheEventQueue.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/PooledCacheEventQueue.java?rev=699369&r1=699368&r2=699369&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/PooledCacheEventQueue.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/PooledCacheEventQueue.java Fri Sep 26 08:37:01 2008
@@ -380,8 +380,10 @@
private abstract class AbstractCacheEvent
implements Runnable
{
+ /** Times failed to process */
int failures = 0;
+ /** Has the event been processed */
boolean done = false;
/**
@@ -445,6 +447,7 @@
private class PutEvent
extends AbstractCacheEvent
{
+ /** The payload */
private ICacheElement ice;
/**
@@ -484,6 +487,7 @@
private class RemoveEvent
extends AbstractCacheEvent
{
+ /** The payload, the key to remove */
private Serializable key;
/**
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/stats/Stats.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/stats/Stats.java?rev=699369&r1=699368&r2=699369&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/stats/Stats.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/stats/Stats.java Fri Sep 26 08:37:01 2008
@@ -22,64 +22,55 @@
import org.apache.jcs.engine.stats.behavior.IStatElement;
import org.apache.jcs.engine.stats.behavior.IStats;
-
/**
* @author aaronsm
- *
*/
public class Stats
implements IStats
{
+ /** Don't change */
private static final long serialVersionUID = 227327902875154010L;
+ /** The stats */
private IStatElement[] stats = null;
+ /** The type of stat */
private String typeName = null;
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jcs.engine.stats.behavior.IStats#getStatElements()
+ /**
+ * @return IStatElement[]
*/
public IStatElement[] getStatElements()
{
return stats;
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jcs.engine.stats.behavior.IStats#setStatElements(org.apache.jcs.engine.stats.behavior.IStatElement[])
+ /**
+ * @param stats
*/
public void setStatElements( IStatElement[] stats )
{
this.stats = stats;
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jcs.engine.stats.behavior.IStats#getTypeName()
+ /**
+ * @return typeName
*/
public String getTypeName()
{
return typeName;
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jcs.engine.stats.behavior.IStats#setTypeName(java.lang.String)
+ /**
+ * @param name
*/
public void setTypeName( String name )
{
typeName = name;
}
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
+ /**
+ * @return the stats in a readable string
*/
public String toString()
{
@@ -98,5 +89,4 @@
return buf.toString();
}
-
}
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/PoolConfiguration.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/PoolConfiguration.java?rev=699369&r1=699368&r2=699369&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/PoolConfiguration.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/PoolConfiguration.java Fri Sep 26 08:37:01 2008
@@ -21,7 +21,6 @@
import org.apache.jcs.utils.threadpool.behavior.IPoolConfiguration;
-
/**
* This object holds configuration data for a thread pool.
* <p>
@@ -30,27 +29,32 @@
public class PoolConfiguration
implements Cloneable, IPoolConfiguration
{
+ /** Should we bound the queue */
private boolean useBoundary = true;
+ /** If the queue is boudned, how big can it get */
private int boundarySize = 2000;
- // only has meaning if a bounday is used
+ /** only has meaning if a bounday is used */
private int maximumPoolSize = 150;
- // the exact number that will be used in a boundless queue. If the queue has
- // a boundary, more will be created if the queue fills.
+ /**
+ * the exact number that will be used in a boundless queue. If the queue has a boundary, more
+ * will be created if the queue fills.
+ */
private int minimumPoolSize = 4;
+ /** How long idle threads above the minimum should be kept alive. */
private int keepAliveTime = 1000 * 60 * 5;
- // should be ABORT, BLOCK, RUN, WAIT, DISCARDOLDEST,
+ /** should be ABORT, BLOCK, RUN, WAIT, DISCARDOLDEST, */
private String whenBlockedPolicy = POLICY_RUN;
+ /** The number of threads to create on startup */
private int startUpSize = 4;
/**
- * @param useBoundary
- * The useBoundary to set.
+ * @param useBoundary The useBoundary to set.
*/
public void setUseBoundary( boolean useBoundary )
{
@@ -85,7 +89,7 @@
* @param startUpSize
*/
public PoolConfiguration( boolean useBoundary, int boundarySize, int maximumPoolSize, int minimumPoolSize,
- int keepAliveTime, String whenBlockedPolicy, int startUpSize )
+ int keepAliveTime, String whenBlockedPolicy, int startUpSize )
{
setUseBoundary( useBoundary );
setBoundarySize( boundarySize );
@@ -97,8 +101,7 @@
}
/**
- * @param boundarySize
- * The boundarySize to set.
+ * @param boundarySize The boundarySize to set.
*/
public void setBoundarySize( int boundarySize )
{
@@ -114,8 +117,7 @@
}
/**
- * @param maximumPoolSize
- * The maximumPoolSize to set.
+ * @param maximumPoolSize The maximumPoolSize to set.
*/
public void setMaximumPoolSize( int maximumPoolSize )
{
@@ -131,8 +133,7 @@
}
/**
- * @param minimumPoolSize
- * The minimumPoolSize to set.
+ * @param minimumPoolSize The minimumPoolSize to set.
*/
public void setMinimumPoolSize( int minimumPoolSize )
{
@@ -148,8 +149,7 @@
}
/**
- * @param keepAliveTime
- * The keepAliveTime to set.
+ * @param keepAliveTime The keepAliveTime to set.
*/
public void setKeepAliveTime( int keepAliveTime )
{
@@ -165,8 +165,7 @@
}
/**
- * @param whenBlockedPolicy
- * The whenBlockedPolicy to set.
+ * @param whenBlockedPolicy The whenBlockedPolicy to set.
*/
public void setWhenBlockedPolicy( String whenBlockedPolicy )
{
@@ -216,8 +215,7 @@
}
/**
- * @param startUpSize
- * The startUpSize to set.
+ * @param startUpSize The startUpSize to set.
*/
public void setStartUpSize( int startUpSize )
{
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/ThreadPool.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/ThreadPool.java?rev=699369&r1=699368&r2=699369&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/ThreadPool.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/ThreadPool.java Fri Sep 26 08:37:01 2008
@@ -30,8 +30,10 @@
*/
public class ThreadPool
{
+ /** The worker */
private PooledExecutor pool = null;
+ /** The queue */
private Channel queue = null;
/**
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/ThreadPoolManager.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/ThreadPoolManager.java?rev=699369&r1=699368&r2=699369&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/ThreadPoolManager.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/ThreadPoolManager.java Fri Sep 26 08:37:01 2008
@@ -37,85 +37,93 @@
import EDU.oswego.cs.dl.util.concurrent.ThreadFactory;
/**
- * This manages threadpools for an application using Doug Lea's Util Concurrent
- * package.
+ * This manages threadpools for an application using Doug Lea's Util Concurrent package.
* http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html
* <p>
* It is a singleton since threads need to be managed vm wide.
* <p>
- * This manager forces you to use a bounded queue. By default it uses the
- * current thread for execuion when the buffer is full and no free threads can
- * be created.
+ * This manager forces you to use a bounded queue. By default it uses the current thread for
+ * execution when the buffer is full and no free threads can be created.
* <p>
- * You can specify the props file to use or pass in a properties object prior to
- * configuration. By default it looks for configuration information in
- * thread_pool.properties.
+ * You can specify the props file to use or pass in a properties object prior to configuration. By
+ * default it looks for configuration information in thread_pool.properties.
* <p>
* If set, the Properties object will take precedence.
* <p>
- * If a value is not set for a particular pool, the hard coded defaults will be
- * used.
- *
+ * If a value is not set for a particular pool, the hard coded defaults will be used.
+ *
* <pre>
* int boundarySize_DEFAULT = 2000;
- *
+ *
* int maximumPoolSize_DEFAULT = 150;
- *
+ *
* int minimumPoolSize_DEFAULT = 4;
- *
+ *
* int keepAliveTime_DEFAULT = 1000 * 60 * 5;
- *
+ *
* boolean abortWhenBlocked = false;
- *
+ *
* String whenBlockedPolicy_DEFAULT = IPoolConfiguration.POLICY_RUN;
- *
+ *
* int startUpSize_DEFAULT = 4;
* </pre>
- *
- * You can configure default settings by specifying a default pool in the
- * properties, ie "cache.ccf"
+ *
+ * You can configure default settings by specifying a default pool in the properties, ie "cache.ccf"
* <p>
* @author Aaron Smuts
*/
public class ThreadPoolManager
{
+ /** The logger */
private static final Log log = LogFactory.getLog( ThreadPoolManager.class );
- // DEFAULT SETTINGS, these are not final since they can be set
- // via the Propeties file or object
+ /**
+ * DEFAULT SETTINGS, these are not final since they can be set via the properties file or object
+ */
private static boolean useBoundary_DEFAULT = true;
+ /** Default queue size limit */
private static int boundarySize_DEFAULT = 2000;
+ /** Default max size */
private static int maximumPoolSize_DEFAULT = 150;
+ /** Default min */
private static int minimumPoolSize_DEFAULT = 4;
+ /** Default keep alive */
private static int keepAliveTime_DEFAULT = 1000 * 60 * 5;
+ /** Default when blocked */
private static String whenBlockedPolicy_DEFAULT = IPoolConfiguration.POLICY_RUN;
+ /** Default startup size */
private static int startUpSize_DEFAULT = 4;
+ /** The deafult config, created using propety defaults if present, else those above. */
private static PoolConfiguration defaultConfig;
- // This is the default value. Setting this after
- // inialization will have no effect
+ /**
+ * This is the default value. Setting this after inialization will have no effect.
+ */
private static String propsFileName = "cache.ccf";
- // the root property name
+ /** the root property name */
private static String PROP_NAME_ROOT = "thread_pool";
+ /** default property file name */
private static String DEFAULT_PROP_NAME_ROOT = "thread_pool.default";
- // You can specify the properties to be used to configure
- // the thread pool. Setting this post initialization will have
- // no effect.
+ /**
+ * You can specify the properties to be used to configure the thread pool. Setting this post
+ * initialization will have no effect.
+ */
private static Properties props = null;
+ /** Map of names to pools. */
private static HashMap pools = new HashMap();
- // singleton instance
+ /** singleton instance */
private static ThreadPoolManager INSTANCE = null;
/**
@@ -187,9 +195,8 @@
}
/**
- * Returns a configured instance of the ThreadPoolManger To specify a
- * configuation file or Properties object to use call the appropriate setter
- * prior to calling getInstance.
+ * Returns a configured instance of the ThreadPoolManger To specify a configuation file or
+ * Properties object to use call the appropriate setter prior to calling getInstance.
* <p>
* @return The single instance of the ThreadPoolManager
*/
@@ -203,9 +210,8 @@
}
/**
- * Returns a pool by name. If a pool by this name does not exist in the
- * configuration file or properties, one will be created using the default
- * values.
+ * Returns a pool by name. If a pool by this name does not exist in the configuration file or
+ * properties, one will be created using the default values.
* <p>
* Pools are lazily created.
* <p>
@@ -266,8 +272,7 @@
/**
* Setting this post initialization will have no effect.
* <p>
- * @param propsFileName
- * The propsFileName to set.
+ * @param propsFileName The propsFileName to set.
*/
public static void setPropsFileName( String propsFileName )
{
@@ -275,9 +280,8 @@
}
/**
- * Returns the name of the properties file that we used to initialize the
- * pools. If the value was set post-initialization, then it may not be the
- * file used.
+ * Returns the name of the properties file that we used to initialize the pools. If the value
+ * was set post-initialization, then it may not be the file used.
* <p>
* @return Returns the propsFileName.
*/
@@ -287,11 +291,10 @@
}
/**
- * This will be used if it is not null on initialzation. Setting this post
- * initialization will have no effect.
+ * This will be used if it is not null on initialzation. Setting this post initialization will
+ * have no effect.
* <p>
- * @param props
- * The props to set.
+ * @param props The props to set.
*/
public static void setProps( Properties props )
{
@@ -307,8 +310,7 @@
}
/**
- * Intialize the ThreadPoolManager and create all the pools defined in the
- * configuration.
+ * Intialize the ThreadPoolManager and create all the pools defined in the configuration.
*/
protected void configure()
{
@@ -468,7 +470,7 @@
{
Thread t = new Thread( runner );
String oldName = t.getName();
- t.setName( "JCS-ThreadPoolManager-" + oldName );
+ t.setName( "JCS-ThreadPoolManager-" + oldName );
t.setDaemon( true );
return t;
}
Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactoryUnitTest.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactoryUnitTest.java?rev=699369&r1=699368&r2=699369&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactoryUnitTest.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactoryUnitTest.java Fri Sep 26 08:37:01 2008
@@ -145,4 +145,24 @@
assertNotNull( "Should have a custom socket factory.", result );
assertEquals( "Wrong testValue", testValue, ((MockRMISocketFactory)result).getTestStringProperty() );
}
+
+ /** verify that we get the timeout value */
+ public void testConfigureObjectSpecificCustomFactory_withProperty_TimeoutConfigurableRMIScoketFactory()
+ {
+ // SETUP
+ int readTimeout = 1234;
+ int openTimeout = 1234;
+ Properties props = new Properties();
+ props.put( IRemoteCacheConstants.CUSTOM_RMI_SOCKET_FACTORY_PROPERTY_PREFIX, TimeoutConfigurableRMIScoketFactory.class.getName() );
+ props.put( IRemoteCacheConstants.CUSTOM_RMI_SOCKET_FACTORY_PROPERTY_PREFIX + ".readTimeout", String.valueOf( readTimeout ) );
+ props.put( IRemoteCacheConstants.CUSTOM_RMI_SOCKET_FACTORY_PROPERTY_PREFIX + ".openTimeout", String.valueOf( openTimeout ) );
+
+ // DO WORK
+ RMISocketFactory result = RemoteCacheServerFactory.configureObjectSpecificCustomFactory( props );
+
+ // VERIFY
+ assertNotNull( "Should have a custom socket factory.", result );
+ assertEquals( "Wrong readTimeout", readTimeout, ((TimeoutConfigurableRMIScoketFactory)result).getReadTimeout() );
+ assertEquals( "Wrong readTimeout", openTimeout, ((TimeoutConfigurableRMIScoketFactory)result).getOpenTimeout() );
+ }
}
Added: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/TimeoutConfigurableRMIScoketFactoryUnitTest.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/TimeoutConfigurableRMIScoketFactoryUnitTest.java?rev=699369&view=auto
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/TimeoutConfigurableRMIScoketFactoryUnitTest.java (added)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/TimeoutConfigurableRMIScoketFactoryUnitTest.java Fri Sep 26 08:37:01 2008
@@ -0,0 +1,34 @@
+package org.apache.jcs.auxiliary.remote.server;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.Socket;
+
+import junit.framework.TestCase;
+
+/** Unit tests for the custom factory */
+public class TimeoutConfigurableRMIScoketFactoryUnitTest
+ extends TestCase
+{
+ /**
+ * Simple test to see that we can create a server socket and connect.
+ * <p>
+ * @throws IOException
+ */
+ public void testCreateAndConnect() throws IOException
+ {
+ // SETUP
+ int port = 3455;
+ String host = "localhost";
+ TimeoutConfigurableRMIScoketFactory factory = new TimeoutConfigurableRMIScoketFactory();
+
+ // DO WORK
+ ServerSocket serverSocket = factory.createServerSocket( port );
+ Socket socket = factory.createSocket( host, port );
+ socket.close();
+ serverSocket.close();
+
+ // VERIFY
+ // passive, no errors
+ }
+}
Modified: jakarta/jcs/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/xdocs/changes.xml?rev=699369&r1=699368&r2=699369&view=diff
==============================================================================
--- jakarta/jcs/trunk/xdocs/changes.xml (original)
+++ jakarta/jcs/trunk/xdocs/changes.xml Fri Sep 26 08:37:01 2008
@@ -21,6 +21,11 @@
<body>
<release version="1.4-dev" date="in SVN">
</release>
+ <release version="1.3.2.3" date="2008-09-26" description="tempbuild">
+ <action dev="asmuts" type="update">Added the ability to inject a
+ custom RMI socket factory to be used by the remote cache server.
+ </action>
+ </release>
<release version="1.3.2.2" date="2008-09-17" description="tempbuild">
<action dev="asmuts" type="update">Added a registry keep alive and
restore option for the remote cache server.</action>
---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-dev-help@jakarta.apache.org