[infrastructure] add external null-annotations (#8848)

Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
This commit is contained in:
J-N-K
2020-10-31 00:29:03 +01:00
committed by GitHub
parent 47d05055db
commit bd664ff0c8
162 changed files with 933 additions and 575 deletions

View File

@@ -126,8 +126,9 @@ public class PJLinkDevice {
Instant now = Instant.now();
Socket socket = this.socket;
boolean connectionTooOld = false;
if (this.socketCreatedOn != null) {
long millisecondsSinceLastConnect = Duration.between(this.socketCreatedOn, now).toMillis();
Instant socketCreatedOn = this.socketCreatedOn;
if (socketCreatedOn != null) {
long millisecondsSinceLastConnect = Duration.between(socketCreatedOn, now).toMillis();
// according to the PJLink specification, the device closes the connection after 30s idle (without notice),
// so to be on the safe side we do not reuse sockets older than 20s
connectionTooOld = millisecondsSinceLastConnect > 20 * 1000;