Skip to content

Commit 407d1fc

Browse files
authored
0.72.0
* Fix node encoding * More typing fixes * Complete genericizing DSInfo * Fix action groups not working * Refactor InboundListRequest * Fix duplicate subscription * Misc cleanup based on Intellij code analysis * Syncing sys.logging with internal usage
2 parents 4d4ea05 + 16c8693 commit 407d1fc

File tree

120 files changed

+683
-790
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+683
-790
lines changed

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ subprojects {
55
apply plugin: 'maven'
66

77
group 'org.iot-dsa'
8-
version '0.71.0'
9-
8+
version '0.72.0'
9+
1010
targetCompatibility = JavaVersion.VERSION_1_8
1111
sourceCompatibility = JavaVersion.VERSION_1_8
1212

@@ -21,7 +21,7 @@ subprojects {
2121
jar {
2222
manifest {
2323
attributes(
24-
'Automatic-Module-Name' : 'org.iot.dsa.' + project.name.replaceAll('-','.')
24+
'Automatic-Module-Name': 'org.iot.dsa.' + project.name.replaceAll('-', '.')
2525
)
2626
}
2727
}

dslink-v2-api/src/main/java/org/iot/dsa/DSRuntime.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ public static Timer runDelayed(Runnable arg, long delayMillis) {
127127
*/
128128
private static void executeTimers() {
129129
long now = System.nanoTime();
130-
long nextCycleTmp = now + 60000000000l;
131-
Timer current = null;
132-
Timer next = null;
130+
long nextCycleTmp = now + 60000000000L;
131+
Timer current;
132+
Timer next;
133133
Timer keepHead = null;
134134
Timer keepTail = null;
135135
long tmp;
@@ -250,10 +250,10 @@ public static class Timer implements Runnable {
250250
private long count = 0;
251251
boolean done = false;
252252
boolean hasRun = false;
253-
private long interval = 0;
253+
private long interval;
254254
private long lastRun = 0;
255255
private Timer next; //linked list
256-
private long nextRun = 0;
256+
private long nextRun;
257257
private Runnable runnable;
258258
private boolean running = false;
259259
private boolean skipMissed = true;

dslink-v2-api/src/main/java/org/iot/dsa/DSThreadPool.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ class DSThreadPool {
2222

2323
private boolean alive = true;
2424
private int idleThreads = 0;
25-
private int max = -1;
26-
private int min = 1;
25+
private int max;
26+
private int min;
2727
private int numThreads = 0;
2828
private LinkedList queue = new LinkedList();
2929
private String threadName;
@@ -183,7 +183,7 @@ public DSThread(String name) {
183183
}
184184

185185
public void run() {
186-
long start = 0;
186+
long start;
187187
Runnable r = null;
188188
try {
189189
while (alive) {

dslink-v2-api/src/main/java/org/iot/dsa/conn/DSBaseConnection.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ public abstract class DSBaseConnection extends DSEnabledNode implements DSIStatu
3838

3939
protected boolean down = getDefaultStatus().isDown();
4040
protected boolean fault = false;
41-
protected DSInfo lastFail = getInfo(LAST_FAIL);
42-
protected DSInfo lastOk = getInfo(LAST_OK);
41+
protected DSInfo<?> lastFail = getInfo(LAST_FAIL);
42+
protected DSInfo<?> lastOk = getInfo(LAST_OK);
4343
protected long lastOkMillis;
4444

4545
///////////////////////////////////////////////////////////////////////////

dslink-v2-api/src/main/java/org/iot/dsa/conn/DSConnection.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ public abstract class DSConnection extends DSBaseConnection {
6666
private long lastConnectAttempt = 0;
6767
private long lastPing;
6868
private long retryConnectMs = 0;
69-
protected DSInfo state = getInfo(STATE);
70-
protected DSInfo stateTime = getInfo(STATE_TIME);
69+
protected DSInfo<?> state = getInfo(STATE);
70+
protected DSInfo<?> stateTime = getInfo(STATE_TIME);
7171
private DSRuntime.Timer updateTimer;
7272
private boolean updating = false;
7373

@@ -330,7 +330,7 @@ protected void onStable() {
330330
protected void startUpdateTimer() {
331331
if (updateTimer == null) {
332332
updateTimer = DSRuntime
333-
.run(() -> updateState(), System.currentTimeMillis(), getUpdateInterval());
333+
.run(this::updateState, System.currentTimeMillis(), getUpdateInterval());
334334
}
335335
}
336336

@@ -399,7 +399,7 @@ protected void updateState() {
399399
* DSIConnectionDescendant and DSConnection.
400400
*/
401401
private void notifyConnectedDescendants(DSNode node, DSConnection conn) {
402-
DSInfo info = node.getFirstInfo();
402+
DSInfo<?> info = node.getFirstInfo();
403403
while (info != null) {
404404
if (info.is(DSIConnectionDescendant.class)) {
405405
try {

dslink-v2-api/src/main/java/org/iot/dsa/conn/DSConnectionState.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public enum DSConnectionState implements DSIEnum, DSIValue {
2626
// Constructors
2727
///////////////////////////////////////////////////////////////////////////
2828

29-
private DSConnectionState(String display) {
29+
DSConnectionState(String display) {
3030
this.element = DSString.valueOf(display);
3131
}
3232

dslink-v2-api/src/main/java/org/iot/dsa/dslink/Action.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public default ResultsType getResultsType() {
4747
}
4848

4949
/**
50-
* Whether or not the action the action requires write permission. Returns false by default.
50+
* Whether or not the action requires write permission. Returns false by default.
5151
*/
5252
public default boolean isReadOnly() {
5353
return false;

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

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public String getPathInBroker(DSNode node) {
115115
* @param config Configuration options
116116
*/
117117
public static DSLink load(DSLinkOptions config) {
118-
DSLink ret = null;
118+
DSLink ret;
119119
File nodes = config.getNodesFile();
120120
if (nodes.exists()) {
121121
long time = System.currentTimeMillis();
@@ -172,13 +172,9 @@ public void run() {
172172
} catch (Throwable t) {
173173
debug(null, t);
174174
}
175-
Runtime.getRuntime().addShutdownHook(new Thread() {
176-
public void run() {
177-
shutdown();
178-
}
179-
});
175+
Runtime.getRuntime().addShutdownHook(new Thread(() -> shutdown()));
180176
start();
181-
long stableDelay = options.getConfig(DSLinkOptions.CFG_STABLE_DELAY, 2000l);
177+
long stableDelay = options.getConfig(DSLinkOptions.CFG_STABLE_DELAY, 2000L);
182178
try {
183179
Thread.sleep(stableDelay);
184180
} catch (Exception x) {
@@ -202,8 +198,7 @@ public void run() {
202198
DSException.throwRuntime(x);
203199
}
204200
LogManager.getLogManager().reset();
205-
Logger logger = Logger.getLogger("");
206-
for (Handler h : logger.getLogger("").getHandlers()) {
201+
for (Handler h : Logger.getLogger("").getHandlers()) {
207202
h.close();
208203
}
209204
} finally {

dslink-v2-api/src/main/java/org/iot/dsa/dslink/DSLinkConnection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ protected void doDisconnect() {
103103
@Override
104104
protected void onDisconnected() {
105105
super.onDisconnected();
106-
DSInfo info = getInfo(TRANSPORT);
106+
DSInfo<?> info = getInfo(TRANSPORT);
107107
if (info != null) {
108108
remove(info.setLocked(false));
109109
}

dslink-v2-api/src/main/java/org/iot/dsa/dslink/DSLinkOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public String getDslinkJson() {
182182
*/
183183
public DSMap getDslinkMap() {
184184
if (dslinkMap == null) {
185-
File file = null;
185+
File file;
186186
if (home != null) { //home cannot be in dslink.json
187187
file = makeFile(getHome(), getDslinkJson());
188188
} else {

0 commit comments

Comments
 (0)