jakarta-jcs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asm...@apache.org
Subject svn commit: r386417 - in /jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server: RemoteCacheServer.java RemoteCacheServerFactory.java
Date Thu, 16 Mar 2006 19:04:09 GMT
Author: asmuts
Date: Thu Mar 16 11:03:39 2006
New Revision: 386417

URL: http://svn.apache.org/viewcvs?rev=386417&view=rev
Log:
added unit test for jdbc disk cache using an hsql db backend.
i will replae the hsql disk cache with something that extends the basic jdbc version.
added new test config file for jdbc.
fixed bug in remote cache server that causes an error message when an item is put while the
same listener is being disposed.

Modified:
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServer.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServer.java
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServer.java?rev=386417&r1=386416&r2=386417&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServer.java
(original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServer.java
Thu Mar 16 11:03:39 2006
@@ -310,7 +310,7 @@
             }
 
             boolean fromCluster = false;
-            if ( remoteTypeL.intValue() == IRemoteCacheAttributes.CLUSTER )
+            if ( remoteTypeL != null && remoteTypeL.intValue() == IRemoteCacheAttributes.CLUSTER
)
             {
                 fromCluster = true;
             }
@@ -339,7 +339,7 @@
                     {
                         if ( log.isDebugEnabled() )
                         {
-                            log.debug( "Put FROM cluster, NOT updating other auxiliaries
for region." );
+                            log.debug( "Put FROM cluster, NOT updating other auxiliaries
for region. requesterId [" + requesterId + "]" );
                         }
 
                         c.localUpdate( item );
@@ -348,7 +348,7 @@
                     {
                         if ( log.isDebugEnabled() )
                         {
-                            log.debug( "Put NOT from cluster, updating other auxiliaries
for region." );
+                            log.debug( "Put NOT from cluster, updating other auxiliaries
for region. requesterId [" + requesterId + "]" );
                         }
 
                         c.update( item );
@@ -359,7 +359,7 @@
                     // swallow
                     if ( log.isInfoEnabled() )
                     {
-                        log.info( "Exception caught updating item. " + ce.getMessage() );
+                        log.info( "Exception caught updating item. requesterId [" + requesterId
+ "] " + ce.getMessage() );
                     }
                 }
 
@@ -398,7 +398,7 @@
         }
         catch ( Exception e )
         {
-            log.error( "Trouble in Update", e );
+            log.error( "Trouble in Update. requesterId [" + requesterId + "]", e );
         }
 
         // TODO use JAMON for timing
@@ -1008,7 +1008,7 @@
 
         if ( log.isInfoEnabled() )
         {
-            log.info( "Removing listener for cache region = [" + cacheName + "] and listenerId
= " + listenerId );
+            log.info( "Removing listener for cache region = [" + cacheName + "] and listenerId
[" + listenerId + "]" );
         }
 
         try
@@ -1022,7 +1022,7 @@
             {
                 if ( log.isDebugEnabled() )
                 {
-                    log.debug( "Found queue for cache region = [" + cacheName + "] and listenerId
= " + listenerId );
+                    log.debug( "Found queue for cache region = [" + cacheName + "] and listenerId
 [" + listenerId + "]" );
                 }
                 q.destroy();
                 cleanupEventQMap( eventQMap );
@@ -1031,15 +1031,15 @@
             {
                 if ( log.isDebugEnabled() )
                 {
-                    log.debug( "Did not find queue for cache region = [" + cacheName + "]
and listenerId = "
-                        + listenerId );
+                    log.debug( "Did not find queue for cache region = [" + cacheName + "]
and listenerId ["
+                        + listenerId + "]" );
                 }
             }
 
             if ( log.isInfoEnabled() )
             {
-                log.info( "After removing listener " + listenerId + " cache region " + cacheName
-                    + "'s listener size = " + cacheDesc.eventQMap.size() );
+                log.info( "After removing listener [" + listenerId + "] cache region " +
cacheName
+                    + "'s listener size [" + cacheDesc.eventQMap.size() + "]");
             }
         }
         catch ( NotBoundException ex )
@@ -1066,7 +1066,7 @@
 
             if ( log.isDebugEnabled() )
             {
-                log.debug( "removing listener for cache " + cacheName );
+                log.debug( "Removing listener for cache " + cacheName );
             }
         }
         return;

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java?rev=386417&r1=386416&r2=386417&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
Thu Mar 16 11:03:39 2006
@@ -31,7 +31,7 @@
 
 /**
  * Provides remote cache services.
- *  
+ * 
  */
 public class RemoteCacheServerFactory
     implements IRemoteCacheConstants
@@ -39,7 +39,7 @@
     private final static Log log = LogFactory.getLog( RemoteCacheServerFactory.class );
 
     /** The single instance of the RemoteCacheServer object. */
-    private static RemoteCacheServer instance;
+    private static RemoteCacheServer remoteCacheServer;
 
     private static String serviceName;
 
@@ -49,7 +49,18 @@
         super();
     }
 
-    /////////////////////// Statup/shutdown methods. //////////////////
+    /**
+     * This will allow you to get stats from the server, etc. Perhaps we should
+     * provide methods on the factory to do this instead.
+     * 
+     * @return Returns the remoteCacheServer.
+     */
+    public static RemoteCacheServer getRemoteCacheServer()
+    {
+        return remoteCacheServer;
+    }
+
+    // ///////////////////// Statup/shutdown methods. //////////////////
     /**
      * Starts up the remote cache server on this JVM, and binds it to the
      * registry on the given host and port.
@@ -63,13 +74,14 @@
     public static void startup( String host, int port, String propFile )
         throws IOException, NotBoundException
     {
-        if ( instance != null )
+        if ( remoteCacheServer != null )
         {
             throw new IllegalArgumentException( "Server already started." );
         }
+
         synchronized ( RemoteCacheServer.class )
         {
-            if ( instance != null )
+            if ( remoteCacheServer != null )
             {
                 return;
             }
@@ -84,7 +96,7 @@
             rcsa.setConfigFileName( propFile );
 
             Properties prop = RemoteUtils.loadProps( propFile );
-            //Properties prop = PropertyLoader.loadProperties( propFile );
+            // Properties prop = PropertyLoader.loadProperties( propFile );
 
             String servicePortStr = prop.getProperty( REMOTE_CACHE_SERVICE_PORT );
             int servicePort = -1;
@@ -118,7 +130,7 @@
             rcsa.setAllowClusterGet( acg );
 
             // CREATE SERVER
-            instance = new RemoteCacheServer( rcsa );
+            remoteCacheServer = new RemoteCacheServer( rcsa );
 
             if ( host == null )
             {
@@ -126,10 +138,14 @@
             }
             // Register the RemoteCacheServer remote object in the registry.
             serviceName = prop.getProperty( REMOTE_CACHE_SERVICE_NAME, REMOTE_CACHE_SERVICE_VAL
).trim();
-            log.debug( "main> binding server to " + host + ":" + port + " with the name
" + serviceName );
+
+            if ( log.isInfoEnabled() )
+            {
+                log.info( "Binding server to " + host + ":" + port + " with the name " +
serviceName );
+            }
             try
             {
-                Naming.rebind( "//" + host + ":" + port + "/" + serviceName, instance );
+                Naming.rebind( "//" + host + ":" + port + "/" + serviceName, remoteCacheServer
);
             }
             catch ( MalformedURLException ex )
             {
@@ -149,13 +165,13 @@
     static void shutdownImpl( String host, int port )
         throws IOException
     {
-        if ( instance == null )
+        if ( remoteCacheServer == null )
         {
             return;
         }
         synchronized ( RemoteCacheServer.class )
         {
-            if ( instance == null )
+            if ( remoteCacheServer == null )
             {
                 return;
             }
@@ -172,10 +188,10 @@
             }
             catch ( NotBoundException ex )
             {
-                //ignore.
+                // ignore.
             }
-            instance.release();
-            instance = null;
+            remoteCacheServer.release();
+            remoteCacheServer = null;
             // TODO: safer exit ?
             try
             {



---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-dev-help@jakarta.apache.org


Mime
View raw message