synchronized getAutosensData
This commit is contained in:
parent
2f8ca8bb04
commit
bbc68b2266
1 changed files with 16 additions and 14 deletions
|
@ -522,20 +522,22 @@ public class IobCobCalculatorPlugin implements PluginBase {
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static AutosensData getAutosensData(long time) {
|
public static AutosensData getAutosensData(long time) {
|
||||||
long now = System.currentTimeMillis();
|
synchronized (dataLock) {
|
||||||
if (time > now)
|
long now = System.currentTimeMillis();
|
||||||
return null;
|
if (time > now)
|
||||||
Long previous = findPreviousTimeFromBucketedData(time);
|
return null;
|
||||||
if (previous == null)
|
Long previous = findPreviousTimeFromBucketedData(time);
|
||||||
return null;
|
if (previous == null)
|
||||||
time = roundUpTime(previous);
|
return null;
|
||||||
AutosensData data = autosensDataTable.get(time);
|
time = roundUpTime(previous);
|
||||||
if (data != null) {
|
AutosensData data = autosensDataTable.get(time);
|
||||||
//log.debug(">>> getAutosensData Cache hit " + data.log(time));
|
if (data != null) {
|
||||||
return data;
|
//log.debug(">>> getAutosensData Cache hit " + data.log(time));
|
||||||
} else {
|
return data;
|
||||||
//log.debug(">>> getAutosensData Cache miss " + new Date(time).toLocaleString());
|
} else {
|
||||||
return null;
|
//log.debug(">>> getAutosensData Cache miss " + new Date(time).toLocaleString());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue