You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tv...@apache.org on 2018/08/22 11:34:53 UTC

svn commit: r1838629 - /commons/proper/jcs/branches/commons-jcs-2.2.x/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RegistryKeepAliveRunner.java

Author: tv
Date: Wed Aug 22 11:34:53 2018
New Revision: 1838629

URL: http://svn.apache.org/viewvc?rev=1838629&view=rev
Log:
Fix test failure

Modified:
    commons/proper/jcs/branches/commons-jcs-2.2.x/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RegistryKeepAliveRunner.java

Modified: commons/proper/jcs/branches/commons-jcs-2.2.x/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RegistryKeepAliveRunner.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/commons-jcs-2.2.x/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RegistryKeepAliveRunner.java?rev=1838629&r1=1838628&r2=1838629&view=diff
==============================================================================
--- commons/proper/jcs/branches/commons-jcs-2.2.x/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RegistryKeepAliveRunner.java (original)
+++ commons/proper/jcs/branches/commons-jcs-2.2.x/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/server/RegistryKeepAliveRunner.java Wed Aug 22 11:34:53 2018
@@ -20,6 +20,7 @@ package org.apache.commons.jcs.auxiliary
  */
 
 import java.rmi.Naming;
+import java.rmi.Remote;
 import java.rmi.RemoteException;
 import java.rmi.registry.Registry;
 
@@ -161,7 +162,14 @@ public class RegistryKeepAliveRunner
         try
         {
             // try to rebind anyway
-            this.registry.rebind( serviceName, RemoteCacheServerFactory.getRemoteCacheServer() );
+            Remote server = RemoteCacheServerFactory.getRemoteCacheServer();
+
+            if ( server == null )
+            {
+                throw new RemoteException( "Cannot register the server until it is created." );
+            }
+
+            this.registry.rebind( serviceName, server );
             String message = "Successfully rebound server to registry [" + serviceName + "].";
             if ( cacheEventLogger != null )
             {