@Test public void testGetOrderedRootCurrentContexts() { counter.unbindContext(); final String requestName = "root context"; final int nbRootContexts = 100; bindRootContexts(requestName, counter, nbRootContexts); counter.addRequest(requestName, 100, 100, 100, false, 1000); final List<CounterRequestContext> rootContexts = counter.getOrderedRootCurrentContexts(); assertEquals("contexts size", nbRootContexts + 1, rootContexts.size()); assertEquals("context name", requestName, rootContexts.get(0).getRequestName()); final String string = rootContexts.get(0).toString(); assertNotNull("toString not null", string); assertFalse("toString not empty", string.isEmpty()); }
List<CounterRequestContext> getOrderedRootCurrentContexts() { final List<CounterRequestContext> contextList = new ArrayList<CounterRequestContext>( rootCurrentContextsByThreadId.size()); for (final CounterRequestContext rootCurrentContext : rootCurrentContextsByThreadId .values()) { contextList.add(rootCurrentContext.clone()); } if (contextList.size() > 1) { Collections.sort(contextList, Collections .reverseOrder(new CounterRequestContextComparator(System.currentTimeMillis()))); } return contextList; }
Counter implements Cloneable, Serializable { List<CounterRequestContext> getOrderedRootCurrentContexts() { final List<CounterRequestContext> contextList = new ArrayList<CounterRequestContext>( rootCurrentContextsByThreadId.size()); for (final CounterRequestContext rootCurrentContext : rootCurrentContextsByThreadId .values()) { contextList.add(rootCurrentContext.clone()); } if (contextList.size() > 1) { Collections.sort(contextList, Collections .reverseOrder(new CounterRequestContextComparator(System.currentTimeMillis()))); } return contextList; } }
Counter implements Cloneable, Serializable { List<CounterRequestContext> getOrderedRootCurrentContexts() { final List<CounterRequestContext> contextList = new ArrayList<CounterRequestContext>( rootCurrentContextsByThreadId.size()); for (final CounterRequestContext rootCurrentContext : rootCurrentContextsByThreadId .values()) { contextList.add(rootCurrentContext.clone()); } if (contextList.size() > 1) { Collections.sort(contextList, Collections .reverseOrder(new CounterRequestContextComparator(System.currentTimeMillis()))); } return contextList; } Counter(String name, String iconName);  Counter(String name, String storageName, String iconName, String childCounterName);  Counter(String name, String iconName, Counter childCounter); private  Counter(String name, String storageName, String iconName, String childCounterName,
			ThreadLocal<CounterRequestContext> contextThreadLocal); }
Counter implements Cloneable, Serializable { List<CounterRequestContext> getOrderedRootCurrentContexts() { final List<CounterRequestContext> contextList = new ArrayList<CounterRequestContext>( rootCurrentContextsByThreadId.size()); for (final CounterRequestContext rootCurrentContext : rootCurrentContextsByThreadId .values()) { contextList.add(rootCurrentContext.clone()); } if (contextList.size() > 1) { Collections.sort(contextList, Collections .reverseOrder(new CounterRequestContextComparator(System.currentTimeMillis()))); } return contextList; } Counter(String name, String iconName);  Counter(String name, String storageName, String iconName, String childCounterName);  Counter(String name, String iconName, Counter childCounter); private  Counter(String name, String storageName, String iconName, String childCounterName,
			ThreadLocal<CounterRequestContext> contextThreadLocal); String getName(); String getStorageName(); String getIconName(); String getChildCounterName(); Date getStartDate(); boolean isDisplayed(); void setDisplayed(boolean displayed); boolean isUsed(); void setUsed(boolean used); void setRequestTransformPattern(Pattern requestTransformPattern); void setMaxRequestsCount(int maxRequestsCount); void bindContextIncludingCpu(String requestName); void bindContext(String requestName, String completeRequestName,
			HttpServletRequest httpRequest, long startCpuTime, long startAllocatedBytes); void unbindContext(); void addRequestForCurrentContext(boolean systemError); void addRequestForCurrentContext(String systemErrorStackTrace); void addRequest(String requestName, long duration, int cpuTime, int allocatedKBytes,
			boolean systemError, long responseSize); void addRequestForSystemError(String requestName, long duration, int cpuTime,
			int allocatedKBytes, String stackTrace); void addRumHit(String requestName, long networkTime, long domProcessing,
			long pageRendering); boolean isErrorCounter(); boolean isJobCounter(); boolean isJspOrStrutsCounter(); boolean isBusinessFacadeCounter(); boolean isRequestIdFromThisCounter(String requestId); void addErrors(List<CounterError> counterErrorList); CounterRequest getCounterRequest(CounterRequestContext context); CounterRequest getCounterRequestByName(String requestName, boolean saveRequestIfAbsent); CounterRequest getCounterRequestById(String requestId); int getRequestsCount(); List<CounterRequest> getRequests(); List<CounterRequest> getOrderedRequests(); List<CounterError> getErrors(); int getErrorsCount(); void clear(); @Override //CHECKSTYLE:OFF Counter clone(); @Override String toString(); }
Counter implements Cloneable, Serializable { List<CounterRequestContext> getOrderedRootCurrentContexts() { final List<CounterRequestContext> contextList = new ArrayList<CounterRequestContext>( rootCurrentContextsByThreadId.size()); for (final CounterRequestContext rootCurrentContext : rootCurrentContextsByThreadId .values()) { contextList.add(rootCurrentContext.clone()); } if (contextList.size() > 1) { Collections.sort(contextList, Collections .reverseOrder(new CounterRequestContextComparator(System.currentTimeMillis()))); } return contextList; } Counter(String name, String iconName);  Counter(String name, String storageName, String iconName, String childCounterName);  Counter(String name, String iconName, Counter childCounter); private  Counter(String name, String storageName, String iconName, String childCounterName,
			ThreadLocal<CounterRequestContext> contextThreadLocal); String getName(); String getStorageName(); String getIconName(); String getChildCounterName(); Date getStartDate(); boolean isDisplayed(); void setDisplayed(boolean displayed); boolean isUsed(); void setUsed(boolean used); void setRequestTransformPattern(Pattern requestTransformPattern); void setMaxRequestsCount(int maxRequestsCount); void bindContextIncludingCpu(String requestName); void bindContext(String requestName, String completeRequestName,
			HttpServletRequest httpRequest, long startCpuTime, long startAllocatedBytes); void unbindContext(); void addRequestForCurrentContext(boolean systemError); void addRequestForCurrentContext(String systemErrorStackTrace); void addRequest(String requestName, long duration, int cpuTime, int allocatedKBytes,
			boolean systemError, long responseSize); void addRequestForSystemError(String requestName, long duration, int cpuTime,
			int allocatedKBytes, String stackTrace); void addRumHit(String requestName, long networkTime, long domProcessing,
			long pageRendering); boolean isErrorCounter(); boolean isJobCounter(); boolean isJspOrStrutsCounter(); boolean isBusinessFacadeCounter(); boolean isRequestIdFromThisCounter(String requestId); void addErrors(List<CounterError> counterErrorList); CounterRequest getCounterRequest(CounterRequestContext context); CounterRequest getCounterRequestByName(String requestName, boolean saveRequestIfAbsent); CounterRequest getCounterRequestById(String requestId); int getRequestsCount(); List<CounterRequest> getRequests(); List<CounterRequest> getOrderedRequests(); List<CounterError> getErrors(); int getErrorsCount(); void clear(); @Override //CHECKSTYLE:OFF Counter clone(); @Override String toString(); static final String HTTP_COUNTER_NAME; static final String ERROR_COUNTER_NAME; static final String LOG_COUNTER_NAME; static final String JSP_COUNTER_NAME; static final String STRUTS_COUNTER_NAME; static final String JSF_COUNTER_NAME; static final String SQL_COUNTER_NAME; static final String JOB_COUNTER_NAME; static final String BUILDS_COUNTER_NAME; static final int MAX_ERRORS_COUNT; }