[Minor] Fixed shutdown NPEs
This commit is contained in:
parent
cacd917e5c
commit
a3a67278e5
|
@ -150,6 +150,7 @@ public class DefaultPlcHandler extends StrolchComponent implements PlcHandler, P
|
|||
getContainer().getPrivilegeHandler().invalidate(this.ctx.getCertificate());
|
||||
|
||||
this.run = false;
|
||||
if (this.messageSenderTask != null)
|
||||
this.messageSenderTask.cancel(true);
|
||||
|
||||
super.stop();
|
||||
|
@ -275,8 +276,8 @@ public class DefaultPlcHandler extends StrolchComponent implements PlcHandler, P
|
|||
return;
|
||||
}
|
||||
|
||||
try (StrolchTransaction tx = openTx(validateCtx().getCertificate(), getCallerMethod(), false)
|
||||
.silentThreshold(SILENT_THRESHOLD, MILLISECONDS)) {
|
||||
try (StrolchTransaction tx = openTx(validateCtx().getCertificate(), getCallerMethod(), false).silentThreshold(
|
||||
SILENT_THRESHOLD, MILLISECONDS)) {
|
||||
tx.lock(Resource.locatorFor(TYPE_PLC_ADDRESS, addressId));
|
||||
Resource addressRes = tx.getResourceBy(TYPE_PLC_ADDRESS, addressId, true);
|
||||
|
||||
|
@ -305,8 +306,8 @@ public class DefaultPlcHandler extends StrolchComponent implements PlcHandler, P
|
|||
if (this.verbose)
|
||||
s = nanoTime();
|
||||
|
||||
try (StrolchTransaction tx = openTx(validateCtx().getCertificate(), getCallerMethod(), false)
|
||||
.silentThreshold(SILENT_THRESHOLD, MILLISECONDS)) {
|
||||
try (StrolchTransaction tx = openTx(validateCtx().getCertificate(), getCallerMethod(), false).silentThreshold(
|
||||
SILENT_THRESHOLD, MILLISECONDS)) {
|
||||
tx.lock(Resource.locatorFor(TYPE_PLC_CONNECTION, plcConnection.getId()));
|
||||
Resource connection = tx.getResourceBy(TYPE_PLC_CONNECTION, plcConnection.getId());
|
||||
updateConnectionState(tx, connection, plcConnection);
|
||||
|
|
|
@ -120,6 +120,7 @@ public class PlcGwClientHandler extends StrolchComponent implements GlobalPlcLis
|
|||
|
||||
this.run = false;
|
||||
this.authenticated = false;
|
||||
if (this.messageSenderTask != null)
|
||||
this.messageSenderTask.cancel(false);
|
||||
|
||||
notifyPlcConnectionState(ConnectionState.Disconnected);
|
||||
|
@ -212,8 +213,8 @@ public class PlcGwClientHandler extends StrolchComponent implements GlobalPlcLis
|
|||
// schedule the heart beat timer
|
||||
if (this.serverConnectFuture != null)
|
||||
this.serverConnectFuture.cancel(true);
|
||||
this.serverConnectFuture = getScheduledExecutor("Server")
|
||||
.scheduleWithFixedDelay(this::pingServer, PING_DELAY, PING_DELAY, TimeUnit.SECONDS);
|
||||
this.serverConnectFuture = getScheduledExecutor("Server").scheduleWithFixedDelay(this::pingServer, PING_DELAY,
|
||||
PING_DELAY, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
private void closeBrokenGwSessionUpdateState(String closeReason, String connectionStateMsg) {
|
||||
|
|
Loading…
Reference in New Issue