svn commit: r695608 - in /jakarta/jcs/trunk/src/java/org/apache/jcs: auxiliary/disk/block/ auxiliary/disk/jdbc/ auxiliary/lateral/socket/tcp/discovery/ auxiliary/remote/server/ engine/memory/ utils/threadpool/

[email protected] Mon, 15 Sep 2008 20:26:51 -0000
Newsgroups gmane.comp.jakarta.turbine.jcs.devel
Message-ID <[email protected]>
Author: asmuts
Date: Mon Sep 15 13:26:51 2008
New Revision: 695608

URL: http://svn.apache.org/viewvc?rev=695608&view=rev
Log:
adding a descriptive name to all threads.

Modified:
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskKeyStore.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManagerAbstractTemplate.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/server/RemoteCacheServerFactory.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheStartupServlet.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/engine/memory/AbstractMemoryCache.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/ThreadPoolManager.java

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskKeyStore.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskKeyStore.java?rev=695608&r1=695607&r2=695608&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskKeyStore.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/block/BlockDiskKeyStore.java Mon Sep 15 13:26:51 2008
@@ -439,6 +439,8 @@
         public Thread newThread( Runnable runner )
         {
             Thread t = new Thread( runner );
+            String oldName = t.getName();
+            t.setName( "JCS-BlockDiskKeyStore-" + oldName );
             t.setDaemon( true );
             t.setPriority( Thread.MIN_PRIORITY );
             return t;

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManagerAbstractTemplate.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManagerAbstractTemplate.java?rev=695608&r1=695607&r2=695608&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManagerAbstractTemplate.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManagerAbstractTemplate.java Mon Sep 15 13:26:51 2008
@@ -230,6 +230,8 @@
         public Thread newThread( Runnable runner )
         {
             Thread t = new Thread( runner );
+            String oldName = t.getName();
+            t.setName( "JCS-JDBCDiskCacheManager-" + oldName );            
             t.setDaemon( true );
             t.setPriority( Thread.MIN_PRIORITY );
             return t;

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=695608&r1=695607&r2=695608&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 Mon Sep 15 13:26:51 2008
@@ -396,6 +396,8 @@
         public Thread newThread( Runnable runner )
         {
             Thread t = new Thread( runner );
+            String oldName = t.getName();
+            t.setName( "JCS-UDPDiscoveryReceiver-" + oldName );            
             t.setDaemon( true );
             t.setPriority( Thread.MIN_PRIORITY );
             return t;

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=695608&r1=695607&r2=695608&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 Mon Sep 15 13:26:51 2008
@@ -274,19 +274,23 @@
 
     /**
      * Allows us to set the daemon status on the clockdaemon
+     * <p>
      * @author aaronsm
      */
     class MyThreadFactory
         implements ThreadFactory
     {
-        /*
-         * (non-Javadoc)
-         *
-         * @see EDU.oswego.cs.dl.util.concurrent.ThreadFactory#newThread(java.lang.Runnable)
+        /**
+         * Sets the thread to daemon.
+         * <p>
+         * @param runner
+         * @return a daemon thread
          */
         public Thread newThread( Runnable runner )
         {
             Thread t = new Thread( runner );
+            String oldName = t.getName();
+            t.setName( "JCS-UDPDiscoveryService-" + oldName );            
             t.setDaemon( true );
             t.setPriority( Thread.MIN_PRIORITY );
             return t;

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java?rev=695608&r1=695607&r2=695608&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java Mon Sep 15 13:26:51 2008
@@ -23,6 +23,7 @@
 import java.net.MalformedURLException;
 import java.rmi.Naming;
 import java.rmi.NotBoundException;
+import java.rmi.RemoteException;
 import java.rmi.registry.Registry;
 import java.util.Properties;
 
@@ -124,19 +125,33 @@
             remoteCacheServer = new RemoteCacheServer( rcsa );
             remoteCacheServer.setCacheEventLogger( cacheEventLogger );
 
-            if ( log.isInfoEnabled() )
-            {
-                log.info( "Binding server to " + host + ":" + port + " with the name " + serviceName );
-            }
-            try
-            {
-                Naming.rebind( "//" + host + ":" + port + "/" + serviceName, remoteCacheServer );
-            }
-            catch ( MalformedURLException ex )
-            {
-                // impossible case.
-                throw new IllegalArgumentException( ex.getMessage() + "; host=" + host + ", port=" + port );
-            }
+            registerServer( host, port );
+        }
+    }
+
+    /**
+     * Registers the server with the registry. I broke this off because we might want to have code
+     * that will restart a dead registry. It will need to rebind the server.
+     * <p>
+     * @param host
+     * @param port
+     * @throws RemoteException
+     */
+    protected static void registerServer( String host, int port )
+        throws RemoteException
+    {
+        if ( log.isInfoEnabled() )
+        {
+            log.info( "Binding server to " + host + ":" + port + " with the name " + serviceName );
+        }
+        try
+        {
+            Naming.rebind( "//" + host + ":" + port + "/" + serviceName, remoteCacheServer );
+        }
+        catch ( MalformedURLException ex )
+        {
+            // impossible case.
+            throw new IllegalArgumentException( ex.getMessage() + "; host=" + host + ", port=" + port );
         }
     }
 

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheStartupServlet.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheStartupServlet.java?rev=695608&r1=695607&r2=695608&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheStartupServlet.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheStartupServlet.java Mon Sep 15 13:26:51 2008
@@ -176,7 +176,6 @@
     protected void service( HttpServletRequest request, HttpServletResponse response )
         throws ServletException, IOException
     {
-
         String stats = CompositeCacheManager.getInstance().getStats();
         if ( log.isInfoEnabled() )
         {

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/memory/AbstractMemoryCache.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/memory/AbstractMemoryCache.java?rev=695608&r1=695607&r2=695608&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/memory/AbstractMemoryCache.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/memory/AbstractMemoryCache.java Mon Sep 15 13:26:51 2008
@@ -374,6 +374,8 @@
         public Thread newThread( Runnable runner )
         {
             Thread t = new Thread( runner );
+            String oldName = t.getName();
+            t.setName( "JCS-AbstractMemoryCache-" + oldName );              
             t.setDaemon( true );
             t.setPriority( Thread.MIN_PRIORITY );
             return t;

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=695608&r1=695607&r2=695608&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 Mon Sep 15 13:26:51 2008
@@ -458,14 +458,17 @@
     class MyThreadFactory
         implements ThreadFactory
     {
-        /*
-         * (non-Javadoc)
-         *
-         * @see EDU.oswego.cs.dl.util.concurrent.ThreadFactory#newThread(java.lang.Runnable)
+        /**
+         * Sets the thread to daemon.
+         * <p>
+         * @param runner
+         * @return a daemon thread
          */
         public Thread newThread( Runnable runner )
         {
             Thread t = new Thread( runner );
+            String oldName = t.getName();
+            t.setName( "JCS-ThreadPoolManager-" + oldName );                
             t.setDaemon( true );
             return t;
         }