diff options
| author | Martin Ritchie <ritchiem@apache.org> | 2007-05-03 13:41:35 +0000 |
|---|---|---|
| committer | Martin Ritchie <ritchiem@apache.org> | 2007-05-03 13:41:35 +0000 |
| commit | 49c6109ef7370409c93bc35b6a9ddf58e6fca465 (patch) | |
| tree | 4e3c1d0a7ef8dcb518de078244f946230bfbc88b /java/management/eclipse-plugin/src | |
| parent | b2d3708cb018e4746a1aed79d5089eea5afbb43f (diff) | |
| download | qpid-python-49c6109ef7370409c93bc35b6a9ddf58e6fca465.tar.gz | |
Merged revisions 533704-533720,533722-533763,533766-533818,533820-533839,533841-533859,533862-534112,534114-534117 via svnmerge from
https://svn.apache.org/repos/asf/incubator/qpid/branches/M2
........
r533704 | bhupendrab | 2007-04-30 12:37:59 +0100 (Mon, 30 Apr 2007) | 1 line
Added time-out for secure server connection.
........
r534036 | ritchiem | 2007-05-01 13:28:03 +0100 (Tue, 01 May 2007) | 1 line
QPID-461 Update to CommitRollbackTest. Ensuring messages received have the correct redelivered value, regardless of order. Different test case also was problematic.
........
r534117 | ritchiem | 2007-05-01 16:22:17 +0100 (Tue, 01 May 2007) | 4 lines
Comments and Test changes
VirtualHost Added comments
HeapExhaustion - Updated to send transient messages.
QpidClientConnection - Allowed specification of type of message to send.
........
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@534856 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/management/eclipse-plugin/src')
2 files changed, 30 insertions, 14 deletions
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java index 0693a4fc93..f6eace3101 100644 --- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java +++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java @@ -44,6 +44,7 @@ public abstract class ApplicationRegistry 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 { diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java index 4d4b3e87e7..f97568e275 100644 --- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java +++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java @@ -59,6 +59,7 @@ import org.apache.qpid.management.ui.sasl.UsernameHashedPasswordCallbackHandler; 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 @@ public class JMXServerRegistry extends ServerRegistry 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 @@ public class JMXServerRegistry extends ServerRegistry 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 |
