geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r726768 - in /geronimo/server/trunk/framework/modules: geronimo-jmx-remoting/src/main/java/org/apache/geronimo/jmxremoting/ geronimo-kernel/src/main/java/org/apache/geronimo/kernel/rmi/
Date Mon, 15 Dec 2008 18:58:07 GMT
Author: gawor
Date: Mon Dec 15 10:58:07 2008
New Revision: 726768

URL: http://svn.apache.org/viewvc?rev=726768&view=rev
Log:
RMI client socket factories that set socket timeouts - should prevent automatic builds from
getting stuck

Added:
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/rmi/GeronimoRMIClientSocketFactory.java
  (with props)
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/rmi/GeronimoSslRMIClientSocketFactory.java
  (with props)
Modified:
    geronimo/server/trunk/framework/modules/geronimo-jmx-remoting/src/main/java/org/apache/geronimo/jmxremoting/JMXConnector.java
    geronimo/server/trunk/framework/modules/geronimo-jmx-remoting/src/main/java/org/apache/geronimo/jmxremoting/JMXSecureConnector.java

Modified: geronimo/server/trunk/framework/modules/geronimo-jmx-remoting/src/main/java/org/apache/geronimo/jmxremoting/JMXConnector.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-jmx-remoting/src/main/java/org/apache/geronimo/jmxremoting/JMXConnector.java?rev=726768&r1=726767&r2=726768&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-jmx-remoting/src/main/java/org/apache/geronimo/jmxremoting/JMXConnector.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-jmx-remoting/src/main/java/org/apache/geronimo/jmxremoting/JMXConnector.java
Mon Dec 15 10:58:07 2008
@@ -18,6 +18,7 @@
 
 import java.io.IOException;
 import java.net.InetSocketAddress;
+import java.rmi.server.RMIClientSocketFactory;
 import java.rmi.server.RMIServerSocketFactory;
 import java.util.HashMap;
 import java.util.Map;
@@ -33,6 +34,7 @@
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.kernel.rmi.GeronimoRMIClientSocketFactory;
 import org.apache.geronimo.kernel.rmi.GeronimoRMIServerSocketFactory;
 import org.apache.geronimo.system.jmx.MBeanServerReference;
 import org.slf4j.Logger;
@@ -185,7 +187,9 @@
             env.put(JMXConnectorServer.AUTHENTICATOR, authenticator);
         } else {
             log.warn("Starting unauthenticating JMXConnector for " + jmxServiceURL);
-        }
+        }  
+        RMIClientSocketFactory socketFactory = new GeronimoRMIClientSocketFactory(2 * 60
* 1000,  5 * 60 * 1000);
+        env.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, socketFactory);
         RMIServerSocketFactory serverSocketFactory = new GeronimoRMIServerSocketFactory(host);
         env.put(RMIConnectorServer.RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE, serverSocketFactory);
         server = JMXConnectorServerFactory.newJMXConnectorServer(jmxServiceURL, env, mbeanServer);

Modified: geronimo/server/trunk/framework/modules/geronimo-jmx-remoting/src/main/java/org/apache/geronimo/jmxremoting/JMXSecureConnector.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-jmx-remoting/src/main/java/org/apache/geronimo/jmxremoting/JMXSecureConnector.java?rev=726768&r1=726767&r2=726768&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-jmx-remoting/src/main/java/org/apache/geronimo/jmxremoting/JMXSecureConnector.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-jmx-remoting/src/main/java/org/apache/geronimo/jmxremoting/JMXSecureConnector.java
Mon Dec 15 10:58:07 2008
@@ -35,10 +35,10 @@
 import javax.net.ssl.KeyManagerFactory;
 import javax.net.ssl.SSLServerSocket;
 import javax.net.ssl.SSLServerSocketFactory;
-import javax.rmi.ssl.SslRMIClientSocketFactory;
 
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.kernel.rmi.GeronimoSslRMIClientSocketFactory;
 import org.apache.geronimo.management.geronimo.KeystoreManager;
 import org.apache.geronimo.system.jmx.MBeanServerReference;
 
@@ -144,7 +144,7 @@
         
         SSLServerSocketFactory sssf = keystoreManager.createSSLServerFactory(null, secureProtocol,
algorithm, keyStore, keyAlias, trustStore, classLoader);
         RMIServerSocketFactory rssf = new GeronimoSslRMIServerSocketFactory(sssf, host, clientAuth);
-        RMIClientSocketFactory rcsf = new SslRMIClientSocketFactory();
+        RMIClientSocketFactory rcsf = new GeronimoSslRMIClientSocketFactory(5 * 60 * 1000);
         env.put(RMIConnectorServer.RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE, rssf);
         env.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, rcsf);
         

Added: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/rmi/GeronimoRMIClientSocketFactory.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/rmi/GeronimoRMIClientSocketFactory.java?rev=726768&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/rmi/GeronimoRMIClientSocketFactory.java
(added)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/rmi/GeronimoRMIClientSocketFactory.java
Mon Dec 15 10:58:07 2008
@@ -0,0 +1,50 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.geronimo.kernel.rmi;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.rmi.server.RMIClientSocketFactory;
+
+public class GeronimoRMIClientSocketFactory implements RMIClientSocketFactory, Serializable
{
+
+    private static final long serialVersionUID = 8238444722121747980L;
+    
+    private int connectionTimeout = -1;
+    private int readTimeout = -1;
+
+    public GeronimoRMIClientSocketFactory(int connectionTimeout, int readTimeout) {
+        this.connectionTimeout = connectionTimeout;
+        this.readTimeout = readTimeout;
+    }
+    
+    public Socket createSocket(String host, int port) throws IOException {
+        Socket socket = new Socket();
+        socket.bind(null);        
+        socket.connect(new InetSocketAddress(host, port), (this.connectionTimeout > 0)
? this.connectionTimeout : 0);        
+        if (this.readTimeout >= 0) {
+            socket.setSoTimeout(this.readTimeout);
+        }
+        return socket;
+    }
+    
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/rmi/GeronimoRMIClientSocketFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/rmi/GeronimoRMIClientSocketFactory.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/rmi/GeronimoRMIClientSocketFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/rmi/GeronimoSslRMIClientSocketFactory.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/rmi/GeronimoSslRMIClientSocketFactory.java?rev=726768&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/rmi/GeronimoSslRMIClientSocketFactory.java
(added)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/rmi/GeronimoSslRMIClientSocketFactory.java
Mon Dec 15 10:58:07 2008
@@ -0,0 +1,45 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.geronimo.kernel.rmi;
+
+import java.io.IOException;
+import java.net.Socket;
+
+import javax.rmi.ssl.SslRMIClientSocketFactory;
+
+public class GeronimoSslRMIClientSocketFactory extends SslRMIClientSocketFactory {
+
+    private static final long serialVersionUID = -7864354227405488644L;
+    
+    private int readTimeout;
+
+    public GeronimoSslRMIClientSocketFactory(int readTimeout) {
+        this.readTimeout = readTimeout;
+    }
+    
+    @Override
+    public Socket createSocket(String host, int port) throws IOException {
+        Socket socket = super.createSocket(host, port);
+        if (this.readTimeout >= 0) {
+            socket.setSoTimeout(this.readTimeout);
+        }
+        return socket;
+    }
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/rmi/GeronimoSslRMIClientSocketFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/rmi/GeronimoSslRMIClientSocketFactory.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/rmi/GeronimoSslRMIClientSocketFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message