|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2009 the original author or authors. |
|
|
|
* Copyright 2002-2011 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -27,6 +27,7 @@ import javax.management.ObjectName; |
|
|
|
import javax.management.remote.JMXConnectorServer; |
|
|
|
import javax.management.remote.JMXConnectorServer; |
|
|
|
import javax.management.remote.JMXConnectorServerFactory; |
|
|
|
import javax.management.remote.JMXConnectorServerFactory; |
|
|
|
import javax.management.remote.JMXServiceURL; |
|
|
|
import javax.management.remote.JMXServiceURL; |
|
|
|
|
|
|
|
import javax.management.remote.MBeanServerForwarder; |
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.DisposableBean; |
|
|
|
import org.springframework.beans.factory.DisposableBean; |
|
|
|
import org.springframework.beans.factory.FactoryBean; |
|
|
|
import org.springframework.beans.factory.FactoryBean; |
|
|
|
@ -63,6 +64,8 @@ public class ConnectorServerFactoryBean extends MBeanRegistrationSupport |
|
|
|
|
|
|
|
|
|
|
|
private Map<String, Object> environment = new HashMap<String, Object>(); |
|
|
|
private Map<String, Object> environment = new HashMap<String, Object>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private MBeanServerForwarder forwarder; |
|
|
|
|
|
|
|
|
|
|
|
private ObjectName objectName; |
|
|
|
private ObjectName objectName; |
|
|
|
|
|
|
|
|
|
|
|
private boolean threaded = false; |
|
|
|
private boolean threaded = false; |
|
|
|
@ -97,6 +100,13 @@ public class ConnectorServerFactoryBean extends MBeanRegistrationSupport |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Set an MBeanServerForwarder to be applied to the <code>JMXConnectorServer</code>. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public void setForwarder(MBeanServerForwarder forwarder) { |
|
|
|
|
|
|
|
this.forwarder = forwarder; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Set the <code>ObjectName</code> used to register the <code>JMXConnectorServer</code> |
|
|
|
* Set the <code>ObjectName</code> used to register the <code>JMXConnectorServer</code> |
|
|
|
* itself with the <code>MBeanServer</code>, as <code>ObjectName</code> instance |
|
|
|
* itself with the <code>MBeanServer</code>, as <code>ObjectName</code> instance |
|
|
|
@ -143,6 +153,11 @@ public class ConnectorServerFactoryBean extends MBeanRegistrationSupport |
|
|
|
// Create the connector server now.
|
|
|
|
// Create the connector server now.
|
|
|
|
this.connectorServer = JMXConnectorServerFactory.newJMXConnectorServer(url, this.environment, this.server); |
|
|
|
this.connectorServer = JMXConnectorServerFactory.newJMXConnectorServer(url, this.environment, this.server); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set the given MBeanServerForwarder, if any.
|
|
|
|
|
|
|
|
if (this.forwarder != null) { |
|
|
|
|
|
|
|
this.connectorServer.setMBeanServerForwarder(this.forwarder); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Do we want to register the connector with the MBean server?
|
|
|
|
// Do we want to register the connector with the MBean server?
|
|
|
|
if (this.objectName != null) { |
|
|
|
if (this.objectName != null) { |
|
|
|
doRegister(this.connectorServer, this.objectName); |
|
|
|
doRegister(this.connectorServer, this.objectName); |
|
|
|
|