/** * Stop the {@code JMXConnectorServer} managed by an instance of this class. * Automatically called on {@code ApplicationContext} shutdown. * @throws IOException if there is an error stopping the connector server */ @Override public void destroy() throws IOException { try { if (this.connectorServer != null) { if (logger.isInfoEnabled()) { logger.info("Stopping JMX connector server: " + this.connectorServer); } this.connectorServer.stop(); } } finally { unregisterBeans(); } }
public void stop() throws IOException { if (connector != null) { try { connector.stop(); } finally { connector = null; } } if (rmiRegistry != null) { try { UnicastRemoteObject.unexportObject(rmiRegistry, true); } catch (NoSuchObjectException e) { throw new IOException("Could not un-export our RMI registry", e); } finally { rmiRegistry = null; } } } }
public void stopConnectorServer() throws IOException { synchronized (JMXListener.class) { if (JMX_CS != null) { JMX_CS.stop(); LOG.info("ConnectorServer stopped!"); JMX_CS = null; } // deregister the RMI registry if (rmiRegistry != null) { UnicastRemoteObject.unexportObject(rmiRegistry, true); } } }
/** * Stop the {@code JMXConnectorServer} managed by an instance of this class. * Automatically called on {@code ApplicationContext} shutdown. * @throws IOException if there is an error stopping the connector server */ @Override public void destroy() throws IOException { try { if (this.connectorServer != null) { if (logger.isInfoEnabled()) { logger.info("Stopping JMX connector server: " + this.connectorServer); } this.connectorServer.stop(); } } finally { unregisterBeans(); } }
public void stop() throws Exception { cs.stop(); unloadMBeans(); if (jsonAuthFile != null) mbs.unregisterMBean(new ObjectName(ResourceConstants.OBJECT_NAME_ACCESSCONTROL)); }
public synchronized void stopAgent() { if (!this.running) { return; } if (logger.isDebugEnabled()) { logger.debug("Stopping jmx manager agent"); } try { jmxConnectorServer.stop(); UnicastRemoteObject.unexportObject(registry, true); } catch (Exception e) { throw new ManagementException(e); } this.running = false; }
public static void tearDown() { try { if (cc != null) { cc.close(); } } catch (IOException e) { LOG.warn("Unexpected, ignoring", e); } cc = null; try { if (cs != null) { cs.stop(); } } catch (IOException e) { LOG.warn("Unexpected, ignoring", e); } cs = null; }
@After @Override public void tearDown() throws Exception { if (this.connector != null) { this.connector.close(); } if (this.connectorServer != null) { this.connectorServer.stop(); } if (runTests) { super.tearDown(); } }
if (connectorStarted.await(10, TimeUnit.SECONDS)) { LOG.debug("Stopping jmx connector"); server.stop();
this.rmiConnector.stop(); } catch (Exception e) { logger.warn(e.getMessage(), e);
protected void assertJmxEquals(String attributeName, Object attributeValue) throws Exception { JMXConnectorServer cs = JMXConnectorServerFactory.newJMXConnectorServer(new JMXServiceURL("service:jmx:rmi://"), null, ManagementFactory.getPlatformMBeanServer()); cs.start(); JMXConnector cc = null; try { cc = JMXConnectorFactory.connect(cs.getAddress()); MBeanServerConnection mbsc = cc.getMBeanServerConnection(); ObjectName objectName = JmxUtils.createObjectName(JmxUtils.getPackageName(failureDetector.getClass()), failureDetector.getClass() .getSimpleName()); Object availableNodes = mbsc.getAttribute(objectName, attributeName); assertEquals(attributeValue, availableNodes); } finally { if(cc != null) cc.close(); cs.stop(); } }
public final void shutdown() { try { if (connectorServer != null && connectorServer.isActive()) { connectorServer.stop(); log.warn("JMXConnector stop"); if (!isHutdownHookCalled) { Runtime.getRuntime().removeShutdownHook(shutdownHookThread); } } } catch (IOException e) { log.error("Shutdown Xmemcached MBean server error", e); } }
@Override public void run() { try { isHutdownHookCalled = true; if (connectorServer.isActive()) { connectorServer.stop(); log.warn("JMXConnector stop"); } } catch (IOException e) { log.error("Shutdown Xmemcached MBean server error", e); } } };
@Test public void testTestValidConnection() throws Exception { Assume.group(TestGroup.JMXMP); JMXConnectorServer connectorServer = getConnectorServer(); connectorServer.start(); try { MBeanServerConnectionFactoryBean bean = new MBeanServerConnectionFactoryBean(); bean.setServiceUrl(serviceUrl); bean.afterPropertiesSet(); try { MBeanServerConnection connection = bean.getObject(); assertNotNull("Connection should not be null", connection); // perform simple MBean count test assertEquals("MBean count should be the same", getServer().getMBeanCount(), connection.getMBeanCount()); } finally { bean.destroy(); } } finally { connectorServer.stop(); } }
@Test public void testTestWithLazyConnection() throws Exception { Assume.group(TestGroup.JMXMP); MBeanServerConnectionFactoryBean bean = new MBeanServerConnectionFactoryBean(); bean.setServiceUrl(serviceUrl); bean.setConnectOnStartup(false); bean.afterPropertiesSet(); MBeanServerConnection connection = bean.getObject(); assertTrue(AopUtils.isAopProxy(connection)); JMXConnectorServer connector = null; try { connector = getConnectorServer(); connector.start(); assertEquals("Incorrect MBean count", getServer().getMBeanCount(), connection.getMBeanCount()); } finally { bean.destroy(); if (connector != null) { connector.stop(); } } }
/** * Stop monitoring. */ public void stop() { LOG.info("Stop monitor."); if (!isRunning) { LOG.info("Monitor was not started!"); return; } isRunning = false; try { jmxServer.stop(); DataCollectManager.getInstance().stop(); UnicastRemoteObject.unexportObject(rmiRegistry, true); } catch (IOException e) { LOG.error(e.getMessage(), e); } } }
public void destroy() throws IOException { connectorServer.stop(); if (LOG.isLoggable(Level.INFO)) { LOG.info("JMX connector server stopped: " + connectorServer); } }
public void stop() throws Exception { this.connectorServer.stop(); UnicastRemoteObject.unexportObject(this.rmiRegistry, true); this.server.unregisterMBean(new ObjectName(connectorServerOname)); }
@AfterClass public static void afterCleanLogDirs() throws Exception { if (cs != null) { cs.stop(); } }