Skip to content

Commit 97614ee

Browse files
committed
some fixes
1 parent 8e011b2 commit 97614ee

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

dslink-v2/src/main/java/com/acuity/iot/dsa/dslink/sys/backup/SysBackupService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import org.iot.dsa.DSRuntime;
1414
import org.iot.dsa.DSRuntime.Timer;
1515
import org.iot.dsa.dslink.DSLink;
16-
import org.iot.dsa.dslink.DSLinkConfig;
1716
import org.iot.dsa.io.NodeEncoder;
1817
import org.iot.dsa.io.json.JsonWriter;
1918
import org.iot.dsa.node.DSIValue;
@@ -42,13 +41,14 @@ public class SysBackupService extends DSNode implements Runnable {
4241
@Override
4342
protected void declareDefaults() {
4443
declareDefault(SAVE, DSAction.DEFAULT);
45-
declareDefault(INTERVAL, DSLong.valueOf(((DSLink) getAncestor(DSLink.class)).getConfig().getConfig(DSLinkConfig.CFG_SAVE_INTERVAL, 60)));
44+
declareDefault(INTERVAL, DSLong.valueOf(60));
4645
declareDefault(MAXIMUM, DSLong.valueOf(3));
4746
}
4847

4948
@Override
5049
protected void onStable() {
51-
run();
50+
DSRuntime.run(this);
51+
// run();
5252
}
5353

5454
private DSLink getLink() {

dslink-v2/src/main/java/org/iot/dsa/dslink/DSLink.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -247,19 +247,19 @@ public void run() {
247247
// long saveInterval = config.getConfig(DSLinkConfig.CFG_SAVE_INTERVAL, 60);
248248
// saveInterval *= 60000;
249249
// long nextSave = System.currentTimeMillis() + saveInterval;
250-
// while (isRunning()) {
251-
// synchronized (this) {
252-
// try {
253-
// wait(10000);
254-
// } catch (InterruptedException x) {
255-
// warn(getPath(), x);
256-
// }
250+
while (isRunning()) {
251+
synchronized (this) {
252+
try {
253+
wait(10000);
254+
} catch (InterruptedException x) {
255+
warn(getPath(), x);
256+
}
257257
// if (System.currentTimeMillis() > nextSave) {
258258
// save();
259259
// nextSave = System.currentTimeMillis() + saveInterval;
260260
// }
261-
// }
262-
// }
261+
}
262+
}
263263
} catch (Exception x) {
264264
error(getLinkName(), x);
265265
stop();

dslink-v2/src/main/java/org/iot/dsa/node/DSNode.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,7 @@ public DSNode getAncestor(Class<?> clazz) {
461461
if (clazz.isAssignableFrom(node.getClass())) {
462462
return node;
463463
}
464+
node = node.getParent();
464465
}
465466
return node;
466467
}

0 commit comments

Comments
 (0)