From b36c7b3a7ebfdee69547f19cb2a5f4a2746ff3ca Mon Sep 17 00:00:00 2001 From: Aaron Date: Wed, 4 Nov 2020 15:50:39 -0800 Subject: [PATCH] 0.24.1 Fix history watch subscriptions not updating when a standalone link loses connection to broker. --- build.gradle | 2 +- .../iot/historian/database/WatchGroup.java | 28 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/build.gradle b/build.gradle index ececbbe1..07e2473e 100755 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ subprojects { apply plugin: 'java-library' apply plugin: 'maven' - version = '0.24.0' + version = '0.24.1' sourceCompatibility = 1.7 targetCompatibility = 1.7 diff --git a/sdk/historian/src/main/java/org/dsa/iot/historian/database/WatchGroup.java b/sdk/historian/src/main/java/org/dsa/iot/historian/database/WatchGroup.java index 21726413..9f1553a8 100644 --- a/sdk/historian/src/main/java/org/dsa/iot/historian/database/WatchGroup.java +++ b/sdk/historian/src/main/java/org/dsa/iot/historian/database/WatchGroup.java @@ -169,38 +169,38 @@ private long findInitialDelayOfLogging(long now) { */ public void subscribe() { Map children = node.getChildren(); + Watch watch; for (Node n : children.values()) { if (n.getAction() == null) { Value useNewEncodingMethod = n.getConfig(Watch.USE_NEW_ENCODING_METHOD_CONFIG_NAME); if (useNewEncodingMethod == null || !useNewEncodingMethod.getBool()) { String path = n.getName().replaceAll("%2F", "/").replaceAll("%2E", "."); - // JTH: This was added to prevent watches to be re-added - // disconnection/reconnection. - if (containsWatch(path)) { - continue; + watch = getWatch(path); + if (watch == null) { + initWatch(path, false); + } else { + db.getProvider().getPool().subscribe(path, watch); } - - initWatch(path, false); } else { String path = StringUtils.decodeName(n.getName()); - if (containsWatch(path)) { - continue; + watch = getWatch(path); + if (watch == null) { + initWatch(path, true); + } else { + db.getProvider().getPool().subscribe(path, watch); } - - initWatch(path, true); } } } } - private boolean containsWatch(String path) { + private Watch getWatch(String path) { for (Watch watch : watches) { if (watch.getPath().equals(path)) { - return true; + return watch; } } - - return false; + return null; } /**