|
@@ -59,6 +59,8 @@ public class PredictPidContainer {
|
|
|
OSS client;
|
|
|
|
|
|
private static ConcurrentHashMap<String,Double> lambdaCache=new ConcurrentHashMap<>();
|
|
|
+
|
|
|
+ private static ConcurrentHashMap<String,Double> latestThresholdCache=new ConcurrentHashMap<>();
|
|
|
private Date cacheDate;
|
|
|
|
|
|
@PostConstruct
|
|
@@ -103,6 +105,7 @@ public class PredictPidContainer {
|
|
|
Double lambdaNew=lambdaCache.getOrDefault(group,0d)+
|
|
|
kp*Double.parseDouble(cols[1])+ki*Double.parseDouble(cols[2])+kd*Double.parseDouble(cols[3]);
|
|
|
lambdaCache.put(group,lambdaNew);
|
|
|
+ latestThresholdCache.put(group,Double.parseDouble(cols[4].trim()));
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -132,7 +135,6 @@ public class PredictPidContainer {
|
|
|
OSSObject object=client.getObject(bucketName,lambdaFileName);
|
|
|
if(object==null) return;
|
|
|
if(cacheDate!=null&& !cacheDate.before(object.getObjectMetadata().getLastModified())) return;
|
|
|
-// if(cacheDate!=null&& cacheDate.after(object.getObjectMetadata().getLastModified())) return;
|
|
|
StringBuilder builder=new StringBuilder();
|
|
|
InputStream is=object.getObjectContent();
|
|
|
InputStreamReader isr=new InputStreamReader(is);
|
|
@@ -152,4 +154,8 @@ public class PredictPidContainer {
|
|
|
public static Double getPidLambda(String group){
|
|
|
return lambdaCache.getOrDefault(group,0d);
|
|
|
}
|
|
|
+
|
|
|
+ public static Double getLatestThreshold(String group){
|
|
|
+ return latestThresholdCache.getOrDefault(group,0d);
|
|
|
+ }
|
|
|
}
|