@Test public void testCollectTomcatInformations() throws JMException { final MBeanServer mBeanServer = MBeans.getPlatformMBeanServer(); final List<ObjectName> mBeans = new ArrayList<ObjectName>(); try { mBeans.add(mBeanServer .registerMBean(new ThreadPool(), new ObjectName("Catalina:type=ThreadPool,name=jk-8009")) .getObjectName()); mBeans.add( mBeanServer .registerMBean(new GlobalRequestProcessor(), new ObjectName( "Catalina:type=GlobalRequestProcessor,name=jk-8009")) .getObjectName()); TomcatInformations.initMBeans(); final Collector collector = new Collector(TEST, Arrays.asList(new Counter("http", null))); collector.collectWithoutErrors( Collections.singletonList(new JavaInformations(null, true))); collector.collectWithoutErrors( Collections.singletonList(new JavaInformations(null, true))); } finally { for (final ObjectName registeredMBean : mBeans) { mBeanServer.unregisterMBean(registeredMBean); } TomcatInformations.initMBeans(); } }
private void collectTomcatInformations(List<JavaInformations> javaInformationsList) throws IOException { int tomcatBusyThreads = 0; long bytesReceived = 0; long bytesSent = 0; boolean tomcatUsed = false; for (final JavaInformations javaInformations : javaInformationsList) { for (final TomcatInformations tomcatInformations : javaInformations .getTomcatInformationsList()) { tomcatBusyThreads = add(tomcatInformations.getCurrentThreadsBusy(), tomcatBusyThreads); bytesReceived = add(tomcatInformations.getBytesReceived(), bytesReceived); bytesSent = add(tomcatInformations.getBytesSent(), bytesSent); tomcatUsed = true; } } if (tomcatUsed) { collectTomcatValues(tomcatBusyThreads, bytesReceived, bytesSent); } }
Collector { private void collectTomcatInformations(List<JavaInformations> javaInformationsList) throws IOException { int tomcatBusyThreads = 0; long bytesReceived = 0; long bytesSent = 0; boolean tomcatUsed = false; for (final JavaInformations javaInformations : javaInformationsList) { for (final TomcatInformations tomcatInformations : javaInformations .getTomcatInformationsList()) { tomcatBusyThreads = add(tomcatInformations.getCurrentThreadsBusy(), tomcatBusyThreads); bytesReceived = add(tomcatInformations.getBytesReceived(), bytesReceived); bytesSent = add(tomcatInformations.getBytesSent(), bytesSent); tomcatUsed = true; } } if (tomcatUsed) { collectTomcatValues(tomcatBusyThreads, bytesReceived, bytesSent); } } }
Collector { private void collectTomcatInformations(List<JavaInformations> javaInformationsList) throws IOException { int tomcatBusyThreads = 0; long bytesReceived = 0; long bytesSent = 0; boolean tomcatUsed = false; for (final JavaInformations javaInformations : javaInformationsList) { for (final TomcatInformations tomcatInformations : javaInformations .getTomcatInformationsList()) { tomcatBusyThreads = add(tomcatInformations.getCurrentThreadsBusy(), tomcatBusyThreads); bytesReceived = add(tomcatInformations.getBytesReceived(), bytesReceived); bytesSent = add(tomcatInformations.getBytesSent(), bytesSent); tomcatUsed = true; } } if (tomcatUsed) { collectTomcatValues(tomcatBusyThreads, bytesReceived, bytesSent); } } Collector(String application, List<Counter> counters);  Collector(String application, List<Counter> counters,
			SamplingProfiler samplingProfiler); }
Collector { private void collectTomcatInformations(List<JavaInformations> javaInformationsList) throws IOException { int tomcatBusyThreads = 0; long bytesReceived = 0; long bytesSent = 0; boolean tomcatUsed = false; for (final JavaInformations javaInformations : javaInformationsList) { for (final TomcatInformations tomcatInformations : javaInformations .getTomcatInformationsList()) { tomcatBusyThreads = add(tomcatInformations.getCurrentThreadsBusy(), tomcatBusyThreads); bytesReceived = add(tomcatInformations.getBytesReceived(), bytesReceived); bytesSent = add(tomcatInformations.getBytesSent(), bytesSent); tomcatUsed = true; } } if (tomcatUsed) { collectTomcatValues(tomcatBusyThreads, bytesReceived, bytesSent); } } Collector(String application, List<Counter> counters);  Collector(String application, List<Counter> counters,
			SamplingProfiler samplingProfiler); String getApplication(); SamplingProfiler getSamplingProfiler(); List<SampledMethod> getHotspots(); Map<String, Date> getDatesByWebappVersions(); List<Counter> getCounters(); Counter getCounterByName(String counterName); Counter getCounterByRequestId(CounterRequest request); List<CounterRequestContext> getRootCurrentContexts(List<Counter> newParentCounters); long getLastCollectDuration(); Throwable getLastCollectorException(); long getEstimatedMemorySize(); long getDiskUsage(); List<Counter> getRangeCounters(Range range); List<Counter> getRangeCountersToBeDisplayed(Range range); Counter getRangeCounter(Range range, String counterName); void collectLocalContextWithoutErrors(); void collectWithoutErrors(List<JavaInformations> javaInformationsList); JRobin getJRobin(String graphName); Collection<JRobin> getCounterJRobins(); Collection<JRobin> getDisplayedCounterJRobins(); Collection<JRobin> getDisplayedOtherJRobins(); boolean isStorageUsedByMultipleInstances(); void stop(); boolean isStopped(); static void stopJRobin(); static void detachVirtualMachine(); @Override String toString(); }
Collector { private void collectTomcatInformations(List<JavaInformations> javaInformationsList) throws IOException { int tomcatBusyThreads = 0; long bytesReceived = 0; long bytesSent = 0; boolean tomcatUsed = false; for (final JavaInformations javaInformations : javaInformationsList) { for (final TomcatInformations tomcatInformations : javaInformations .getTomcatInformationsList()) { tomcatBusyThreads = add(tomcatInformations.getCurrentThreadsBusy(), tomcatBusyThreads); bytesReceived = add(tomcatInformations.getBytesReceived(), bytesReceived); bytesSent = add(tomcatInformations.getBytesSent(), bytesSent); tomcatUsed = true; } } if (tomcatUsed) { collectTomcatValues(tomcatBusyThreads, bytesReceived, bytesSent); } } Collector(String application, List<Counter> counters);  Collector(String application, List<Counter> counters,
			SamplingProfiler samplingProfiler); String getApplication(); SamplingProfiler getSamplingProfiler(); List<SampledMethod> getHotspots(); Map<String, Date> getDatesByWebappVersions(); List<Counter> getCounters(); Counter getCounterByName(String counterName); Counter getCounterByRequestId(CounterRequest request); List<CounterRequestContext> getRootCurrentContexts(List<Counter> newParentCounters); long getLastCollectDuration(); Throwable getLastCollectorException(); long getEstimatedMemorySize(); long getDiskUsage(); List<Counter> getRangeCounters(Range range); List<Counter> getRangeCountersToBeDisplayed(Range range); Counter getRangeCounter(Range range, String counterName); void collectLocalContextWithoutErrors(); void collectWithoutErrors(List<JavaInformations> javaInformationsList); JRobin getJRobin(String graphName); Collection<JRobin> getCounterJRobins(); Collection<JRobin> getDisplayedCounterJRobins(); Collection<JRobin> getDisplayedOtherJRobins(); boolean isStorageUsedByMultipleInstances(); void stop(); boolean isStopped(); static void stopJRobin(); static void detachVirtualMachine(); @Override String toString();  }