/** * Set the service URL of the remote {@code MBeanServer}. */ public void setServiceUrl(String url) throws MalformedURLException { this.serviceUrl = new JMXServiceURL(url); }
/** * Connects to the remote {@code MBeanServer} using the configured service URL and * environment properties. */ private void connect() throws IOException { Assert.state(this.serviceUrl != null, "No JMXServiceURL set"); this.connector = JMXConnectorFactory.connect(this.serviceUrl, this.environment); this.connection = this.connector.getMBeanServerConnection(); }
@Override protected Object createObject() throws Exception { Assert.state(serviceUrl != null, "No JMXServiceURL set"); return JMXConnectorFactory.connect(serviceUrl, environment); }
public static JmxDump connectTo( String jmxAddress ) throws IOException { JMXServiceURL url = new JMXServiceURL( jmxAddress ); JMXConnector connect = JMXConnectorFactory.connect( url ); return new JmxDump( connect.getMBeanServerConnection() ); }
public static void setUp() throws IOException { MBeanServer mbs = MBeanRegistry.getInstance().getPlatformMBeanServer(); JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://127.0.0.1"); cs = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs); cs.start(); JMXServiceURL addr = cs.getAddress(); cc = JMXConnectorFactory.connect(addr); }
@Override protected Object createObject() throws Exception { Assert.state(connector != null, "JMXConnector not initialized"); return connector.getMBeanServerConnection(); }
/** * Closes any {@code JMXConnector} that may be managed by this interceptor. */ public void close() { if (this.connector != null) { try { this.connector.close(); } catch (IOException ex) { logger.debug("Could not close JMX connector", ex); } } }
@Override public void run() { try { serverToStart.start(); } catch (IOException ex) { throw new JmxException("Could not start JMX connector server after delay", ex); } } };
private JMXConnectorServer getConnectorServer() throws Exception { return JMXConnectorServerFactory.newJMXConnectorServer(getJMXServiceUrl(), null, getServer()); }
private void checkServerConnection(MBeanServer hostedServer) throws IOException, MalformedURLException { // Try to connect using client. JMXServiceURL serviceURL = new JMXServiceURL(ConnectorServerFactoryBean.DEFAULT_SERVICE_URL); JMXConnector connector = JMXConnectorFactory.connect(serviceURL); assertNotNull("Client Connector should not be null", connector); // Get the MBean server connection. MBeanServerConnection connection = connector.getMBeanServerConnection(); assertNotNull("MBeanServerConnection should not be null", connection); // Test for MBean server equality. assertEquals("Registered MBean count should be the same", hostedServer.getMBeanCount(), connection.getMBeanCount()); }
/** * Set the service URL of the remote {@code MBeanServer}. */ public void setServiceUrl(String url) throws MalformedURLException { this.serviceUrl = new JMXServiceURL(url); }
@Override protected MBeanServerConnection getServerConnection() throws Exception { this.connector = JMXConnectorFactory.connect(getServiceUrl()); return this.connector.getMBeanServerConnection(); }
/** * Closes the underlying {@code JMXConnector}. */ @Override public void destroy() throws IOException { if (this.connector != null && (this.connectorTargetSource == null || this.connectorTargetSource.isInitialized())) { this.connector.close(); } }
/** * Set the service URL of the remote {@code MBeanServer}. */ public void setServiceUrl(String url) throws MalformedURLException { this.serviceUrl = new JMXServiceURL(url); }
/** * Set the service URL of the remote {@code MBeanServer}. */ public void setServiceUrl(String url) throws MalformedURLException { this.serviceUrl = new JMXServiceURL(url); }
/** * Set the service URL of the remote {@code MBeanServer}. */ public void setServiceUrl(String url) throws MalformedURLException { this.serviceUrl = new JMXServiceURL(url); }
/** * Set the service URL of the remote {@code MBeanServer}. */ public void setServiceUrl(String url) throws MalformedURLException { this.serviceUrl = new JMXServiceURL(url); }
private JMXServiceURL getServiceUrl() throws MalformedURLException { return new JMXServiceURL(SERVICE_URL); }
private JMXServiceURL getJMXServiceUrl() throws MalformedURLException { return new JMXServiceURL(serviceUrl); }