Author: asmuts
Date: Mon Apr 10 09:58:01 2006
New Revision: 392988

URL: http://svn.apache.org/viewcvs?rev=392988&view=rev
Log:
do not setup a custom rmi factory if the timeout specified is <= 0

Modified:
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java

Modified: 
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java
URL: 
http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java?rev=392988&r1=392987&r2=392988&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java 
(original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java 
Mon Apr 10 09:58:01 2006
@@ -128,25 +128,29 @@
 
         try
         {
-            // TODO make configurable.
-            // use this socket factory to add a timeout.
-            RMISocketFactory.setSocketFactory( new RMISocketFactory()
+            // Don't set a socket factory if the setting is -1
+            if ( irca.getRmiSocketFactoryTimeoutMillis() > 0 )
             {
-                public Socket createSocket( String host, int port )
-                    throws IOException
+                // TODO make configurable.
+                // use this socket factory to add a timeout.
+                RMISocketFactory.setSocketFactory( new RMISocketFactory()
                 {
-                    Socket socket = new Socket( host, port );
-                    socket.setSoTimeout( 
irca.getRmiSocketFactoryTimeoutMillis() );
-                    socket.setSoLinger( false, 0 );
-                    return socket;
-                }
+                    public Socket createSocket( String host, int port )
+                        throws IOException
+                    {
+                        Socket socket = new Socket( host, port );
+                        socket.setSoTimeout( 
irca.getRmiSocketFactoryTimeoutMillis() );
+                        socket.setSoLinger( false, 0 );
+                        return socket;
+                    }
 
-                public ServerSocket createServerSocket( int port )
-                    throws IOException
-                {
-                    return new ServerSocket( port );
-                }
-            } );
+                    public ServerSocket createServerSocket( int port )
+                        throws IOException
+                    {
+                        return new ServerSocket( port );
+                    }
+                } );
+            }
         }
         catch ( Exception e )
         {



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to