dcsimg
Detect & re-register in Rmi Server
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   pawan_modi
Posted On:   Thursday, March 26, 2009 07:14 AM

Hi, I am running rmi registry in separate console. My application is registering an URL in RMI server. Now I am stopping rmi registry & restarting it again. Now rmi registry is a new process & all previous registration entries are gone. So my application has to re-register. How my application can detect that rmi server is stopped & restarted so that I can re-register it again? Any help? Here is my code where I am registering public void initializeExternalManagementInterface(String serviceURL) { mbeanServer = MBeanServerFactory.createMBeanServer(); String domain = m_mbeanServer.getDefaultDomain(); String mbeanObjectNameStr = domain + ":ty   More>>

Hi,
I am running rmi registry in separate console. My application is registering an URL in RMI server. Now I am stopping rmi registry & restarting it again.
Now rmi registry is a new process & all previous registration entries are gone. So my application has to re-register.

How my application can detect that rmi server is stopped & restarted so that I can re-register it again?
Any help?
Here is my code where I am registering

			
public void initializeExternalManagementInterface(String serviceURL)
{
mbeanServer = MBeanServerFactory.createMBeanServer();

String domain = m_mbeanServer.getDefaultDomain();

String mbeanObjectNameStr = domain + ":type=" + EXTERNAL_MBEAN_CLASS_NAME + ",index=1";

objectName = ObjectName.getInstance(mbeanObjectNameStr);

Attribute serviceURLAttribute = new Attribute("ServiceURL", serviceURL);

m_mbeanServer.setAttribute(m_mbeanObjectName, serviceURLAttribute);
}

public void startManagementInterface(String jmxServiceURL, String mbeanClassName)
{

env.put(RMIConnectorServer.JNDI_REBIND_ATTRIBUTE,"true");

JMXServiceURL p_jmxServiceURL = new JMXServiceURL(jmxServiceURL);

LoggerManager.getLogger().info("Starting JMX Server: " + p_jmxServiceURL);

m_mbeanServerConnector = JMXConnectorServerFactory.newJMXConnectorServer(p_jmxServiceURL, env, m_mbeanServer);

m_mbeanServerConnector.start();

LoggerManager.getLogger().info("THE MANAGEMENT INTERFACE STARTED FOR SERVICE URL :" + jmxServiceURL);

m_jmxConnector = JMXConnectorFactory.connect(p_jmxServiceURL, null);

m_mbeanConnection = m_jmxConnector.getMBeanServerConnection();

String domain = m_mbeanConnection.getDefaultDomain();

m_mbeanObjectName = new ObjectName(domain + ":type=" + mbeanClassName + ",index=1");

}
   <<Less
About | Sitemap | Contact