/** * Handy method which runs the JmxProcess */ public void executeStandalone(JmxProcess process) throws Exception { this.masterServersList = process.getServers(); this.serverScheduler.start(); this.processServersIntoJobs(); // Sleep for 10 seconds to wait for jobs to complete. // There should be a better way, but it seems that way isn't working // right now. Thread.sleep(MILLISECONDS.convert(10, SECONDS)); }
public ImmutableList parseServers(Iterable<File> processConfigFiles, boolean continueOnJsonError) throws LifecycleException { ServerListBuilder serverListBuilder = new ServerListBuilder(); for (File processConfigFile : processConfigFiles) { try { JmxProcess process = processConfigUtils.parseProcess(processConfigFile); log.debug("Loaded file: {}", processConfigFile.getAbsolutePath()); serverListBuilder.add(process.getServers()); } catch (Exception ex) { String message = "Error parsing json: " + processConfigFile; // error parsing one file should not prevent the startup of JMXTrans if (continueOnJsonError) log.error(message, ex); else throw new LifecycleException(message, ex); } } return serverListBuilder.build(); }
/** * Handy method which runs the JmxProcess */ public void executeStandalone(JmxProcess process) throws Exception { this.masterServersList = process.getServers(); this.serverScheduler.start(); this.processServersIntoJobs(); // Sleep for 10 seconds to wait for jobs to complete. // There should be a better way, but it seems that way isn't working // right now. Thread.sleep(MILLISECONDS.convert(10, SECONDS)); }
/** * Handy method which runs the JmxProcess */ public void executeStandalone(JmxProcess process) throws Exception { if (isRunning) { throw new LifecycleException("Process already started"); } this.masterServersList = process.getServers(); this.serverScheduler.start(); this.processServersIntoJobs(); // Ensure resources are free Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { try { JmxTransformerDynamic.this.stopServices(); } catch (LifecycleException e) { e.printStackTrace(); } } }); isRunning = true; // Sleep for 10 seconds to wait for jobs to complete. // There should be a better way, but it seems that way isn't working // right now. Thread.sleep(MILLISECONDS.convert(10, SECONDS)); }
public ImmutableList parseServers(Iterable<File> processConfigFiles, boolean continueOnJsonError) throws LifecycleException { ServerListBuilder serverListBuilder = new ServerListBuilder(); for (File processConfigFile : processConfigFiles) { try { JmxProcess process = processConfigUtils.parseProcess(processConfigFile); log.debug("Loaded file: {}", processConfigFile.getAbsolutePath()); serverListBuilder.add(process.getServers()); } catch (Exception ex) { String message = "Error parsing json: " + processConfigFile; // error parsing one file should not prevent the startup of JMXTrans if (continueOnJsonError) log.error(message, ex); else throw new LifecycleException(message, ex); } } return serverListBuilder.build(); }
try { service = Executors.newFixedThreadPool(process.getNumMultiThreadedServers()); for (Server server : process.getServers()) { if (server.getLocalMBeanServer() != null) { service.execute(new ProcessServerThread(server, null)); for (Server server : process.getServers()) { if (server.getLocalMBeanServer() != null) { processServer(server, null);
protected void loadProfile(Container container, Profile profile) throws IOException, LifecycleException { Map<String, byte[]> fileConfigurations = profile.getFileConfigurations(); byte[] bytes = fileConfigurations.get(GRAPH_JSON); if (bytes != null && bytes.length > 0) { JmxProcess process = getJmxProcess(GRAPH_JSON, new ByteArrayInputStream(bytes)); if (process != null) { List<Server> servers = process.getServers(); for (Server server : servers) { configureProfileServer(server, container, profile); } JmxUtils.mergeServerLists(this.masterServersList, servers); } } for (Profile p : profile.getParents()) { loadProfile(container, p); } }