@Override public Object run() { if (JMXConnectionNotification.OPENED.equals(type)) { getEventLogger().message(ManagementConsoleMessages.OPEN(username)); } else if (JMXConnectionNotification.CLOSED.equals(type) || JMXConnectionNotification.FAILED.equals(type)) { getEventLogger().message(ManagementConsoleMessages.CLOSE(username)); } return null; } });
@Override public void start() throws IOException { getEventLogger().message(ManagementConsoleMessages.STARTUP(OPERATIONAL_LOGGING_NAME)); //check if system properties are set to use the JVM's out-of-the-box JMXAgent if (areOutOfTheBoxJMXOptionsSet()) { getEventLogger().message(ManagementConsoleMessages.READY(OPERATIONAL_LOGGING_NAME)); } else { startRegistryAndConnector(); } }
@Override public void close() { _log.debug("close() called"); closeConnectorAndRegistryServers(); unregisterAllMbeans(); getEventLogger().message(ManagementConsoleMessages.STOPPED(OPERATIONAL_LOGGING_NAME)); }
private void closeRegistryServer() { if (_rmiRegistry != null) { // Stopping the RMI registry getEventLogger().message(ManagementConsoleMessages.SHUTTING_DOWN("RMI Registry", _registryPort.getPort())); try { boolean success = UnicastRemoteObject.unexportObject(_rmiRegistry, false); if (!success) { _log.warn("Failed to unexport object " + _rmiRegistry); } } catch (NoSuchObjectException e) { _log.error("Exception while closing the RMI Registry: ", e); } finally { _rmiRegistry = null; } } }
private Registry createRmiRegistry(int jmxPortRegistryServer, boolean useCustomRmiRegistry) throws RemoteException { final RMIServerSocketFactory ssf = getRmiServerSocketFactory(useCustomRmiRegistry, new Action<Integer>() { @Override public void performAction(final Integer port) { _allocatedRmiPort = port; } }); Registry rmiRegistry = LocateRegistry.createRegistry(jmxPortRegistryServer, null, ssf); getEventLogger().message(ManagementConsoleMessages.LISTENING("RMI Registry", Transport.TCP.name(), _allocatedRmiPort)); return rmiRegistry; }
@Override public Void run() { getEventLogger().message(ManagementConsoleMessages.CLOSE(_principal.getName())); return null; } });
@Override public Void run() { getEventLogger().message(ManagementConsoleMessages.OPEN(_principal.getName())); return null; } });
private void logOperationalShutdownMessage(final int localPort) { getBroker().getEventLogger().message(ManagementConsoleMessages.SHUTTING_DOWN(Protocol.HTTP.name(), localPort)); }
private void logOperationalListenMessages(final HttpPort<?> port, final int localPort) { Set<Transport> transports = port.getTransports(); for (Transport transport: transports) { getBroker().getEventLogger().message(ManagementConsoleMessages.LISTENING(Protocol.HTTP.name(), transport.name(), localPort)); } }
private void closeConnectorServer() { if (_cs != null) { // Stopping the JMX ConnectorServer try { getEventLogger().message(ManagementConsoleMessages.SHUTTING_DOWN("JMX RMIConnectorServer", _cs.getAddress().getPort())); _cs.stop(); } catch (IOException e) { _log.error("Exception while closing the JMX ConnectorServer: ", e); } finally { _cs = null; } } }
@Override protected ListenableFuture<Void> onClose() { getBroker().removeChangeListener(_brokerChangeListener); if (_server != null) { try { logOperationalShutdownMessage(); _server.stop(); } catch (Exception e) { throw new ServerScopedRuntimeException("Failed to stop HTTP management", e); } } if (_jettyServerExecutor != null) { _jettyServerExecutor.shutdown(); } getBroker().getEventLogger().message(ManagementConsoleMessages.STOPPED(OPERATIONAL_LOGGING_NAME)); return Futures.immediateFuture(null); }