Author: tv
Date: Mon Apr 28 11:31:32 2014
New Revision: 1590608

URL: http://svn.apache.org/r1590608
Log:
Remove duplicate code

Added:
    
commons/proper/jcs/trunk/src/test/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServerStartupUtil.java
      - copied, changed from r1587508, 
commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServerStartupUtil.java

Copied: 
commons/proper/jcs/trunk/src/test/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServerStartupUtil.java
 (from r1587508, 
commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServerStartupUtil.java)
URL: 
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServerStartupUtil.java?p2=commons/proper/jcs/trunk/src/test/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServerStartupUtil.java&p1=commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServerStartupUtil.java&r1=1587508&r2=1590608&rev=1590608&view=diff
==============================================================================
--- 
commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServerStartupUtil.java
 (original)
+++ 
commons/proper/jcs/trunk/src/test/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServerStartupUtil.java
 Mon Apr 28 11:31:32 2014
@@ -22,8 +22,6 @@ package org.apache.commons.jcs.auxiliary
 import java.io.IOException;
 import java.io.Serializable;
 import java.net.UnknownHostException;
-import java.rmi.RemoteException;
-import java.rmi.registry.LocateRegistry;
 import java.util.Properties;
 
 import org.apache.commons.jcs.utils.net.HostNameUtil;
@@ -56,37 +54,25 @@ public class RemoteCacheServerStartupUti
         // all three
         int registryPort = DEFAULT_REGISTRY_PORT;
 
-        try
+        Properties props = PropertyLoader.loadProperties( propsFileName );
+        if ( props != null )
         {
-            Properties props = PropertyLoader.loadProperties( propsFileName );
-            if ( props != null )
-            {
-                String portS = props.getProperty( "registry.port", 
String.valueOf( DEFAULT_REGISTRY_PORT ) );
+            String portS = props.getProperty( "registry.port", String.valueOf( 
DEFAULT_REGISTRY_PORT ) );
 
-                try
-                {
-                    registryPort = Integer.parseInt( portS );
-                }
-                catch ( NumberFormatException e )
-                {
-                    log.error( "Problem converting port to an int.", e );
-                }
+            try
+            {
+                registryPort = Integer.parseInt( portS );
+            }
+            catch ( NumberFormatException e )
+            {
+                log.error( "Problem converting port to an int.", e );
             }
-        }
-        catch ( Exception e )
-        {
-            log.error( "Problem loading props.", e );
-        }
-        catch ( Throwable t )
-        {
-            log.error( "Problem loading props.", t );
         }
 
         // we will always use the local machine for the registry
-        String registryHost;
         try
         {
-            registryHost = HostNameUtil.getLocalHostAddress();
+            String registryHost = HostNameUtil.getLocalHostAddress();
 
             if ( log.isDebugEnabled() )
             {
@@ -101,29 +87,12 @@ public class RemoteCacheServerStartupUti
 
             try
             {
-                LocateRegistry.createRegistry( registryPort );
-            }
-            catch ( RemoteException e )
-            {
-                log.error( "Problem creating registry.  It may already be 
started. " + e.getMessage() );
-            }
-            catch ( Throwable t )
-            {
-                log.error( "Problem creating registry.", t );
-            }
-
-            try
-            {
                 RemoteCacheServerFactory.startup( registryHost, registryPort, 
"/" + propsFileName );
             }
             catch ( IOException e )
             {
                 log.error( "Problem starting remote cache server.", e );
             }
-            catch ( Throwable t )
-            {
-                log.error( "Problem starting remote cache server.", t );
-            }
         }
         catch ( UnknownHostException e )
         {


Reply via email to