Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.mortbay.jetty.jmx.ws.util;
 
 
 
public class JMXServiceURLUtils
    private static MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
    private static ObjectName name;
    private static JMXServiceURL rmiServiceURL;
    public static JMXServiceURL getLocalJMXServiceURL()
    {
        if ( == null)
        {
            try
            {
                 = new ObjectName("org.eclipse.jetty:name=rmiconnectorserver");
                 = (JMXServiceURL).getAttribute(,"Address");
            }
            catch (Exception e)
            {
                throw new IllegalStateException(e);
            }
        }
        return ;
    }
    
    public static JMXServiceURL getJMXServiceURL(Address address){
        return getJMXServiceURL("service:jmx:rmi:///jndi/rmi://" + address.getHost()+ ":" + address.getPort()+ "/jettyjmx");
    }
    public static JMXServiceURL getJMXServiceURL(String jmxServiceURLString)
    {
        try
        {
            return new JMXServiceURL(jmxServiceURLString);
        }
        catch (MalformedURLException e)
        {
            throw new IllegalStateException(e);
        }
    }
New to GrepCode? Check out our FAQ X