public long getGlobalTimeSpentFor(CounterCategory category) { long timeStart = -1; long timeEnd = Long.MAX_VALUE; for (CounterEntity entity : mongoService.listPerformanceCounters()) { MyLogger.appendLog("getGlobalTimeSpentFor counter: {0}", entity); if (entity.getCategory().equals(category)) { switch (entity.getCounterType().name()) { case "START": { timeStart = entity.getValue() > timeStart ? entity.getValue() : timeStart; break; } case "END": { timeEnd = entity.getValue() < timeEnd ? entity.getValue() : timeEnd; break; } } } } if (timeStart != -1 && timeEnd != Long.MAX_VALUE) { return timeEnd - timeStart; } return -1; }
public void addNewCounterEntry(CounterEntity entity) { MyLogger.appendLog( "addNewCounterEntry: Queue[{0}], Counter[{1}]", QUEUE_NAME, entity.toString()); rabbitService.queueMessage(QUEUE_NAME, entity); }