qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhupend...@apache.org
Subject svn commit: r533704 - in /incubator/qpid/branches/M2/java/management/eclipse-plugin: bin/qpidmc.bat bin/qpidmc.sh src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java
Date Mon, 30 Apr 2007 11:38:00 GMT
Author: bhupendrab
Date: Mon Apr 30 04:37:59 2007
New Revision: 533704

URL: http://svn.apache.org/viewvc?view=rev&rev=533704
Log:
Added time-out for secure server connection.

Modified:
    incubator/qpid/branches/M2/java/management/eclipse-plugin/bin/qpidmc.bat
    incubator/qpid/branches/M2/java/management/eclipse-plugin/bin/qpidmc.sh
    incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java
    incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java

Modified: incubator/qpid/branches/M2/java/management/eclipse-plugin/bin/qpidmc.bat
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/management/eclipse-plugin/bin/qpidmc.bat?view=diff&rev=533704&r1=533703&r2=533704
==============================================================================
--- incubator/qpid/branches/M2/java/management/eclipse-plugin/bin/qpidmc.bat (original)
+++ incubator/qpid/branches/M2/java/management/eclipse-plugin/bin/qpidmc.bat Mon Apr 30 04:37:59
2007
@@ -52,4 +52,4 @@
 rem Slurp the command line arguments. This loop allows for an unlimited number
 rem of agruments (up to the command line limit, anyway).
 
-"%JAVA_HOME%\bin\java" -Xms40m -Xmx256m -Declipse.consoleLog=false -Dsecurity=PLAIN -jar
%QPIDMC_HOME%\eclipse\startup.jar org.eclipse.core.launcher.Main -launcher %QPIDMC_HOME%\eclipse\eclipse
-name "Qpid Management Console" -showsplash 600 -configuration "file:%QPIDMC_HOME%\configuration"
-os win32 -ws win32 -arch x86
+"%JAVA_HOME%\bin\java" -Xms40m -Xmx256m -Declipse.consoleLog=false -jar %QPIDMC_HOME%\eclipse\startup.jar
org.eclipse.core.launcher.Main -launcher %QPIDMC_HOME%\eclipse\eclipse -name "Qpid Management
Console" -showsplash 600 -configuration "file:%QPIDMC_HOME%\configuration" -os win32 -ws win32
-arch x86

Modified: incubator/qpid/branches/M2/java/management/eclipse-plugin/bin/qpidmc.sh
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/management/eclipse-plugin/bin/qpidmc.sh?view=diff&rev=533704&r1=533703&r2=533704
==============================================================================
--- incubator/qpid/branches/M2/java/management/eclipse-plugin/bin/qpidmc.sh (original)
+++ incubator/qpid/branches/M2/java/management/eclipse-plugin/bin/qpidmc.sh Mon Apr 30 04:37:59
2007
@@ -61,4 +61,4 @@
     os="linux"
 fi
 
-"$JAVA_HOME/bin/java" -Xms40m -Xmx256m -Declipse.consoleLog=false -Dsecurity=PLAIN -jar $QPIDMC_HOME/eclipse/startup.jar
org.eclipse.core.launcher.Main -launcher $QPIDMC_HOME/eclipse/eclipse -name "Qpid Management
Console" -showsplash 600 -configuration "file:$QPIDMC_HOME/configuration" -os $os -ws $ws
-arch $arch
+"$JAVA_HOME/bin/java" -Xms40m -Xmx256m -Declipse.consoleLog=false -jar $QPIDMC_HOME/eclipse/startup.jar
org.eclipse.core.launcher.Main -launcher $QPIDMC_HOME/eclipse/eclipse -name "Qpid Management
Console" -showsplash 600 -configuration "file:$QPIDMC_HOME/configuration" -os $os -ws $ws
-arch $arch

Modified: incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java?view=diff&rev=533704&r1=533703&r2=533704
==============================================================================
--- incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java
(original)
+++ incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java
Mon Apr 30 04:37:59 2007
@@ -44,6 +44,7 @@
     public static final boolean debug = Boolean.getBoolean("eclipse.consoleLog");
     public static final String securityMechanism = System.getProperty("security", null);
     public static final String connectorClass =  System.getProperty("jmxconnector");
+    public static final long timeout = Long.parseLong(System.getProperty("timeout", "5000"));
     
     static
     {

Modified: incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java?view=diff&rev=533704&r1=533703&r2=533704
==============================================================================
--- incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java
(original)
+++ incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java
Mon Apr 30 04:37:59 2007
@@ -59,6 +59,7 @@
 
 public class JMXServerRegistry extends ServerRegistry
 {
+    private boolean _connected = false;
     private ObjectName _serverObjectName = null;
     private Map<String, Object> _env = null;
     private JMXServiceURL _jmxUrl = null;
@@ -98,23 +99,12 @@
         super(server);
         String securityMechanism = ApplicationRegistry.getSecurityMechanism();
         String connectorClassName = ApplicationRegistry.getJMXConnectorClass();
-        
-        boolean saslPluginAvailable = false;
        
         if ((securityMechanism != null) && (connectorClassName != null))
         { 
-            try
-            {
-                createSASLConnector(securityMechanism, connectorClassName);
-                saslPluginAvailable = true;
-            }
-            catch (Exception ex)
-            {
-                MBeanUtility.printStackTrace(ex);
-            }
+            createSASLConnector(securityMechanism, connectorClassName);
         }
-        
-        if (!saslPluginAvailable)
+        else
         {
             _jmxUrl = new JMXServiceURL(server.getUrl());
             _jmxc = JMXConnectorFactory.connect(_jmxUrl, null);
@@ -179,9 +169,34 @@
         Object theObject = cons.newInstance(args);
 
         _jmxc = (JMXConnector)theObject;
-        _jmxc.connect();
+        
+        Thread connectorThread = new Thread(new ConnectorThread());
+        connectorThread.start();
+        long timeNow = System.currentTimeMillis();
+        connectorThread.join(ApplicationRegistry.timeout);
+        
+        if (!_connected && (System.currentTimeMillis() - timeNow >= ApplicationRegistry.timeout))
+        {
+            throw new Exception("Qpid server connection timed out");
+        }
     }
     
+    private class ConnectorThread implements Runnable
+    {
+        public void run()
+        {
+            try
+            {
+                _connected = false;
+                _jmxc.connect();
+                _connected = true;
+            }
+            catch (Exception ex)
+            {
+                MBeanUtility.printStackTrace(ex);
+            }
+        }
+    }
     /**
      * removes all listeners from the mbean server. This is required when user
      * disconnects the Qpid server connection



Mime
View raw message