mirror of https://github.com/apache/activemq.git
Fixes AMQ-3651 : If the broker binds RMI registry port when it starts up, the broker should release RMI registry port when it shuts down
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1227186 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1753a699e0
commit
71d5fef019
|
@ -64,6 +64,7 @@ public class ManagementContext implements Service {
|
||||||
private JMXConnectorServer connectorServer;
|
private JMXConnectorServer connectorServer;
|
||||||
private ObjectName namingServiceObjectName;
|
private ObjectName namingServiceObjectName;
|
||||||
private Registry registry;
|
private Registry registry;
|
||||||
|
private ServerSocket registrySocket;
|
||||||
private final List<ObjectName> registeredMBeanNames = new CopyOnWriteArrayList<ObjectName>();
|
private final List<ObjectName> registeredMBeanNames = new CopyOnWriteArrayList<ObjectName>();
|
||||||
private boolean allowRemoteAddressInMBeanNames = true;
|
private boolean allowRemoteAddressInMBeanNames = true;
|
||||||
|
|
||||||
|
@ -146,6 +147,13 @@ public class ManagementContext implements Service {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
beanServer = null;
|
beanServer = null;
|
||||||
|
if(registrySocket!=null) {
|
||||||
|
try {
|
||||||
|
registrySocket.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
|
registrySocket = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,12 +427,13 @@ public class ManagementContext implements Service {
|
||||||
registry = LocateRegistry.createRegistry(connectorPort, null, new RMIServerSocketFactory() {
|
registry = LocateRegistry.createRegistry(connectorPort, null, new RMIServerSocketFactory() {
|
||||||
public ServerSocket createServerSocket(int port)
|
public ServerSocket createServerSocket(int port)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
ServerSocket result = new ServerSocket(port);
|
registrySocket = new ServerSocket(port);
|
||||||
result.setReuseAddress(true);
|
registrySocket.setReuseAddress(true);
|
||||||
return result;
|
return registrySocket;
|
||||||
}});
|
}});
|
||||||
}
|
}
|
||||||
namingServiceObjectName = ObjectName.getInstance("naming:type=rmiregistry");
|
namingServiceObjectName = ObjectName.getInstance("naming:type=rmiregistry");
|
||||||
|
|
||||||
// Do not use the createMBean as the mx4j jar may not be in the
|
// Do not use the createMBean as the mx4j jar may not be in the
|
||||||
// same class loader than the server
|
// same class loader than the server
|
||||||
Class cl = Class.forName("mx4j.tools.naming.NamingService");
|
Class cl = Class.forName("mx4j.tools.naming.NamingService");
|
||||||
|
|
Loading…
Reference in New Issue