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 2005/08/03 05:53:21 UTC
svn commit: r227155 - in /jakarta/jcs/trunk/src:
java/org/apache/jcs/auxiliary/lateral/
java/org/apache/jcs/auxiliary/lateral/socket/tcp/
java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/
java/org/apache/jcs/engine/control/ test/org/apache/jc...
Author: asmuts
Date: Tue Aug 2 20:53:04 2005
New Revision: 227155
URL: http://svn.apache.org/viewcvs?rev=227155&view=rev
Log:
Added more logging.
Prevented manager from initializing with a null props file.
Added better error when config file can't be found.
Trying to figure out a way to kill the UDP recevier thread.
It is a daemon, but it seems to be blocking on a wait for message call.
Made tester class exit with the vm, to help manually detect these
kinds of issues.
Modified:
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheFactory.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/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/engine/control/CompositeCacheManager.java
jakarta/jcs/trunk/src/test/org/apache/jcs/access/TestCacheAccess.java
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheFactory.java?rev=227155&r1=227154&r2=227155&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheFactory.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheFactory.java Tue Aug 2 20:53:04 2005
@@ -16,7 +16,6 @@
* limitations under the License.
*/
-import java.io.IOException;
import java.util.ArrayList;
import java.util.StringTokenizer;
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java?rev=227155&r1=227154&r2=227155&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 Tue Aug 2 20:53:04 2005
@@ -259,9 +259,9 @@
public void handleDispose( String cacheName )
throws IOException
{
- if ( log.isDebugEnabled() )
+ if ( log.isInfoEnabled() )
{
- log.debug( "handleDispose> cacheName=" + cacheName );
+ log.info( "handleDispose > cacheName=" + cacheName );
}
CompositeCacheManager cm = cacheMgr;
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryReceiver.java
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryReceiver.java?rev=227155&r1=227154&r2=227155&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 Tue Aug 2 20:53:04 2005
@@ -35,6 +35,7 @@
import EDU.oswego.cs.dl.util.concurrent.BoundedBuffer;
import EDU.oswego.cs.dl.util.concurrent.PooledExecutor;
+import EDU.oswego.cs.dl.util.concurrent.ThreadFactory;
/**
* Receives UDP Discovery messages.
@@ -88,6 +89,7 @@
pooledExecutor = new PooledExecutor( new BoundedBuffer( 100 ), maxPoolSize );
pooledExecutor.discardOldestWhenBlocked();
//pooledExecutor.setMinimumPoolSize(1);
+ pooledExecutor.setThreadFactory( new MyThreadFactory() );
log.debug( "constructing listener, " + this.multicastAddressString + ":" + this.multicastPort );
@@ -206,7 +208,7 @@
}
catch ( Exception e )
{
- // nopt
+ log.error( "Unexpected exception in UDP receiver.", e );
}
}
@@ -347,5 +349,29 @@
}
}
+ /**
+ * Allows us to set the daemon status on the executor threads
+ *
+ * @author aaronsm
+ *
+ */
+ class MyThreadFactory
+ implements ThreadFactory
+ {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see EDU.oswego.cs.dl.util.concurrent.ThreadFactory#newThread(java.lang.Runnable)
+ */
+ public Thread newThread( Runnable runner )
+ {
+ Thread t = new Thread( runner );
+ t.setDaemon( true );
+ t.setPriority( Thread.MIN_PRIORITY );
+ return t;
+ }
+
+ }
}
// end class
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryService.java
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryService.java?rev=227155&r1=227154&r2=227155&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 Tue Aug 2 20:53:04 2005
@@ -85,6 +85,7 @@
receiver = new UDPDiscoveryReceiver( this, lca.getUdpDiscoveryAddr(), lca.getUdpDiscoveryPort() );
Thread t = new Thread(receiver);
t.setDaemon(true);
+ //t.setName( t.getName() + "--UDPReceiver" );
t.start();
}
catch ( Exception e )
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheManager.java
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheManager.java?rev=227155&r1=227154&r2=227155&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheManager.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheManager.java Tue Aug 2 20:53:04 2005
@@ -157,36 +157,45 @@
*/
public void configure( String propFile )
{
- log.debug( "Creating cache manager from config file: " + propFile );
+ log.info( "Creating cache manager from config file: " + propFile );
Properties props = new Properties();
InputStream is = getClass().getResourceAsStream( propFile );
- try
+ if ( is != null )
{
- props.load( is );
-
- if ( log.isDebugEnabled() )
+ try
{
- log.debug( "File contained " + props.size() + " properties" );
+ props.load( is );
+
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "File [" + propFile + "] contained " + props.size() + " properties" );
+ }
}
- }
- catch ( IOException ex )
- {
- log.error( "Failed to load properties", ex );
- throw new IllegalStateException( ex.getMessage() );
- }
- finally
- {
- try
+ catch ( IOException ex )
{
- is.close();
+ log.error( "Failed to load properties for name [" + propFile + "]", ex );
+ throw new IllegalStateException( ex.getMessage() );
}
- catch ( Exception ignore )
+ finally
{
- // Ignored
+ try
+ {
+ is.close();
+ }
+ catch ( Exception ignore )
+ {
+ // Ignored
+ }
}
+
+ }
+ else
+ {
+ log.error( "Failed to load properties for name [" + propFile + "]" );
+ throw new IllegalStateException( "Failed to load properties for name [" + propFile + "]" );
}
configure( props );
@@ -199,16 +208,23 @@
*/
public void configure( Properties props )
{
- // set the props value and then configure the ThreadPoolManager
- ThreadPoolManager.setProps( props );
- ThreadPoolManager poolMgr = ThreadPoolManager.getInstance();
+ if ( props != null )
+ {
+ // set the props value and then configure the ThreadPoolManager
+ ThreadPoolManager.setProps( props );
+ ThreadPoolManager poolMgr = ThreadPoolManager.getInstance();
- // configure the cache
- CompositeCacheConfigurator configurator = new CompositeCacheConfigurator( this );
+ // configure the cache
+ CompositeCacheConfigurator configurator = new CompositeCacheConfigurator( this );
- configurator.doConfigure( props );
+ configurator.doConfigure( props );
- this.props = props;
+ this.props = props;
+ }
+ else
+ {
+ log.error( "No properties found. Please configure the cache correctly." );
+ }
}
/**
@@ -282,6 +298,7 @@
/**
* If the cache is created the CacheAttributes and the element Attributes
* will be ignored. Currently there is no overiding once it is set up.
+ * <p>
* Overriding hte default elemental atributes will require cahnging the way
* the atributes are assigned to elements. Get cache creates a cache with
* defaults if none are specified. We might want to create separate method
Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/access/TestCacheAccess.java
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/test/org/apache/jcs/access/TestCacheAccess.java?rev=227155&r1=227154&r2=227155&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/access/TestCacheAccess.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/access/TestCacheAccess.java Tue Aug 2 20:53:04 2005
@@ -66,7 +66,7 @@
}
catch ( Exception e )
{
- log.error( e );
+ log.error( "Problem getting cache instance", e );
p( e.toString() );
}
}
@@ -129,7 +129,8 @@
CompositeCacheManager.getInstance().shutDown();
//cache_control.dispose();
notDone = false;
- System.exit( -1 );
+ //System.exit( -1 );
+ return;
}
else
---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-dev-help@jakarta.apache.org