public final String getKey(AgentHealthException agentHealthException) { String name = getClass().getName(); if (agentHealthException != null) { return agentHealthException.getExceptionClass() + agentHealthException.getStackTrace()[0].toString(); } return name; }
public JsonObject asJsonObject() { JsonObject jsonObject = new JsonObject(); JsonElement jsonArray = new JsonArray(); for (AgentHealthException asJsonArray : this.agentHealthExceptions.values()) { jsonArray.add(asJsonArray.asJsonArray()); } jsonObject.add("Type", new JsonPrimitive("AgentErrors")); jsonObject.add("Keys", keyArray); jsonObject.add("Data", jsonArray); return jsonObject; }
public void add(AgentHealthException agentHealthException) { String key = getKey(agentHealthException); synchronized (this.agentHealthExceptions) { AgentHealthException agentHealthException2 = (AgentHealthException) this.agentHealthExceptions.get(key); if (agentHealthException2 == null) { this.agentHealthExceptions.put(key, agentHealthException); } else { agentHealthException2.increment(); } } }