@Test public void testClearCounter() { final Counter counter = createCounter(); final Collector collector = new Collector("test collector", Collections.singletonList(counter)); counter.addRequest("test clear", 0, 0, 0, false, 1000); collector.clearCounter(counter.getName()); if (counter.getRequestsCount() != 0) { fail("counter vide"); } collector.clearCounter("nothing"); }
void clearCounter(String counterName) { final Counter counter = getCounterByName(counterName); if (counter != null) { final List<CounterRequest> requests = counter.getRequests(); counter.clear(); globalRequestsByCounter.remove(counter); for (final CounterRequest request : requests) { requestsById.remove(request.getId()); requestJRobinsById.remove(request.getId()); } } }
Collector { void clearCounter(String counterName) { final Counter counter = getCounterByName(counterName); if (counter != null) { final List<CounterRequest> requests = counter.getRequests(); counter.clear(); globalRequestsByCounter.remove(counter); for (final CounterRequest request : requests) { requestsById.remove(request.getId()); requestJRobinsById.remove(request.getId()); } } } }
Collector { void clearCounter(String counterName) { final Counter counter = getCounterByName(counterName); if (counter != null) { final List<CounterRequest> requests = counter.getRequests(); counter.clear(); globalRequestsByCounter.remove(counter); for (final CounterRequest request : requests) { requestsById.remove(request.getId()); requestJRobinsById.remove(request.getId()); } } } Collector(String application, List<Counter> counters);  Collector(String application, List<Counter> counters,
			SamplingProfiler samplingProfiler); }
Collector { void clearCounter(String counterName) { final Counter counter = getCounterByName(counterName); if (counter != null) { final List<CounterRequest> requests = counter.getRequests(); counter.clear(); globalRequestsByCounter.remove(counter); for (final CounterRequest request : requests) { requestsById.remove(request.getId()); requestJRobinsById.remove(request.getId()); } } } 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 { void clearCounter(String counterName) { final Counter counter = getCounterByName(counterName); if (counter != null) { final List<CounterRequest> requests = counter.getRequests(); counter.clear(); globalRequestsByCounter.remove(counter); for (final CounterRequest request : requests) { requestsById.remove(request.getId()); requestJRobinsById.remove(request.getId()); } } } 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();  }