|
|
package com.monitor.javaserver.common;
|
|
|
|
|
|
import com.monitor.common.util.DateFormatUtil;
|
|
|
import com.monitor.model.response.JavaApiStaticsRep;
|
|
|
import com.monitor.model.response.JavaApiStatusRep;
|
|
|
import org.apache.commons.collections.map.MultiKeyMap;
|
...
|
...
|
@@ -28,24 +29,33 @@ public class JavaApiStatus { |
|
|
|
|
|
private ConcurrentHashMap<String, Long> mapUpdateTime = new ConcurrentHashMap<String, Long>();
|
|
|
|
|
|
public void addError(int apiType, int cloud) {
|
|
|
public void addError(JavaApiStatics javaApiStatics) {
|
|
|
int apiType = javaApiStatics.getJavaApiInfo().getServiceType();
|
|
|
int cloud = javaApiStatics.getMObjectDetails().getCloudType();
|
|
|
String key = cloud + "_" + apiType;
|
|
|
mapStaticsErr.putIfAbsent(key, new AtomicInteger(0));
|
|
|
mapStaticsErr.get(key).getAndIncrement();
|
|
|
|
|
|
mapUpdateTime.putIfAbsent(key, javaApiStatics.getEndTime());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
public void addSuccess(int apiType, int cloud) {
|
|
|
public void addSuccess(JavaApiStatics javaApiStatics) {
|
|
|
int apiType = javaApiStatics.getJavaApiInfo().getServiceType();
|
|
|
int cloud = javaApiStatics.getMObjectDetails().getCloudType();
|
|
|
String key = cloud + "_" + apiType;
|
|
|
mapStaticsOk.putIfAbsent(key, new AtomicInteger(0));
|
|
|
mapStaticsOk.get(key).getAndIncrement();
|
|
|
|
|
|
mapUpdateTime.putIfAbsent(key, javaApiStatics.getEndTime());
|
|
|
}
|
|
|
|
|
|
|
|
|
public void clear() {
|
|
|
mapStaticsErr.clear();
|
|
|
mapStaticsOk.clear();
|
|
|
mapUpdateTime.clear();
|
|
|
}
|
|
|
|
|
|
|
...
|
...
|
@@ -87,6 +97,12 @@ public class JavaApiStatus { |
|
|
rel.add(statics);
|
|
|
}
|
|
|
|
|
|
long time;
|
|
|
for (JavaApiStaticsRep javaApiStaticsRep : rel) {
|
|
|
time = mapUpdateTime.get(javaApiStaticsRep.getCloudType() + "_" + javaApiStaticsRep.getServiceType());
|
|
|
javaApiStaticsRep.setUpdateTime(DateFormatUtil.parseLongToTimeStr(time));
|
|
|
}
|
|
|
|
|
|
return rel;
|
|
|
}
|
|
|
|
...
|
...
|
|