[infrastructure] add external null-annotations (#8848)
Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
This commit is contained in:
@@ -59,6 +59,7 @@ public class SatelEventLogActions implements ThingActions {
|
||||
logger.debug("satel.readEvent called with input: index={}", index);
|
||||
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
SatelEventLogHandler handler = this.handler;
|
||||
if (handler != null) {
|
||||
handler.readEvent(index == null ? -1 : index.intValue()).ifPresent(event -> {
|
||||
result.put("index", event.getIndex());
|
||||
|
||||
@@ -58,8 +58,8 @@ public abstract class SatelThingHandler extends BaseThingHandler implements Sate
|
||||
if (bridge != null) {
|
||||
final ThingHandler handler = bridge.getHandler();
|
||||
if (handler != null && handler instanceof SatelBridgeHandler) {
|
||||
((SatelBridgeHandler) handler).addEventListener(this);
|
||||
this.bridgeHandler = (SatelBridgeHandler) handler;
|
||||
this.bridgeHandler.addEventListener(this);
|
||||
}
|
||||
if (bridge.getStatus() == ThingStatus.ONLINE) {
|
||||
updateStatus(ThingStatus.ONLINE);
|
||||
|
||||
@@ -351,8 +351,8 @@ public abstract class SatelModule extends EventDispatcher implements SatelEventL
|
||||
private synchronized void disconnect(@Nullable String reason) {
|
||||
// remove all pending commands from the queue
|
||||
// notifying about send failure
|
||||
while (!this.sendQueue.isEmpty()) {
|
||||
SatelCommand cmd = this.sendQueue.poll();
|
||||
SatelCommand cmd;
|
||||
while ((cmd = this.sendQueue.poll()) != null) {
|
||||
cmd.setState(State.FAILED);
|
||||
}
|
||||
final CommunicationChannel channel = this.channel;
|
||||
@@ -503,13 +503,13 @@ public abstract class SatelModule extends EventDispatcher implements SatelEventL
|
||||
}
|
||||
|
||||
private void startCommunication() {
|
||||
final Thread thread = this.thread;
|
||||
Thread thread = this.thread;
|
||||
if (thread != null && thread.isAlive()) {
|
||||
logger.error("Start communication canceled: communication thread is still alive");
|
||||
return;
|
||||
}
|
||||
// start new thread
|
||||
this.thread = new Thread(new Runnable() {
|
||||
thread = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
logger.debug("Communication thread started");
|
||||
@@ -517,7 +517,8 @@ public abstract class SatelModule extends EventDispatcher implements SatelEventL
|
||||
logger.debug("Communication thread stopped");
|
||||
}
|
||||
});
|
||||
this.thread.start();
|
||||
thread.start();
|
||||
this.thread = thread;
|
||||
// if module is not initialized yet, send version command
|
||||
if (!SatelModule.this.isInitialized()) {
|
||||
SatelModule.this.sendCommand(new IntegraVersionCommand());
|
||||
|
||||
Reference in New Issue
Block a user