User: andreas
Date: 00/10/10 23:00:48
Modified: src/main/org/jboss/jmx/server RMIConnectorService.java
Log:
The JMX Connector over RMI bind itself at the JNDI server
with the following pattern:
jmx:<Host Name>:<Protocol Name>
Therefore it is possible for a client to lookup different JMX
Connectors bind at the same JNDI server.
Revision Changes Path
1.2 +9 -4 jboss/src/main/org/jboss/jmx/server/RMIConnectorService.java
Index: RMIConnectorService.java
===================================================================
RCS file:
/products/cvs/ejboss/jboss/src/main/org/jboss/jmx/server/RMIConnectorService.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- RMIConnectorService.java 2000/08/31 17:46:17 1.1
+++ RMIConnectorService.java 2000/10/11 06:00:47 1.2
@@ -8,6 +8,7 @@
package org.jboss.jmx.server;
import java.io.File;
+import java.net.InetAddress;
import java.net.URL;
import java.rmi.server.UnicastRemoteObject;
import java.rmi.RemoteException;
@@ -44,10 +45,13 @@
//AS I am not quite sure if this works but somehow the protocol should become
//AS part of the JNDI name because there could be more than one protcol
public static String JNDI_NAME = "jmx:rmi";
+ public static String JMX_NAME = "jmx";
+ public static String PROTOCOL_NAME = "rmi";
// Attributes ----------------------------------------------------
- MBeanServer server;
- RMIConnectorImpl adaptor;
+ private MBeanServer server;
+ private RMIConnectorImpl adaptor;
+ private String mHost;
// Static --------------------------------------------------------
@@ -68,16 +72,17 @@
// Protected -----------------------------------------------------
protected void initService() throws Exception {
+ mHost = InetAddress.getLocalHost().getHostName();
adaptor = new RMIConnectorImpl( server );
}
protected void startService() throws Exception {
- new InitialContext().bind( JNDI_NAME, adaptor );
+ new InitialContext().bind( JMX_NAME + ":" + mHost + ":" +
PROTOCOL_NAME, adaptor );
}
protected void stopService() {
try {
- new InitialContext().unbind(JNDI_NAME);
+ new InitialContext().unbind( JMX_NAME + ":" + mHost + ":" +
PROTOCOL_NAME );
}
catch( Exception e ) {
log.exception( e );