ARTEMIS-1389 Add non-null check to ServerSessionImpl.doClose()

An Openwire connection creates an internal session used to track
transaction status, it doesn't have a session callback. When
the connection is closed, the core session should check if
callback is null to avoid NPE.
This commit is contained in:
Howard Gao 2017-09-04 18:56:57 +08:00 committed by Clebert Suconic
parent 3497ae81f2
commit cd551bfba0
1 changed files with 3 additions and 1 deletions

View File

@ -348,7 +348,9 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
}
protected void doClose(final boolean failed) throws Exception {
callback.close(failed);
if (callback != null) {
callback.close(failed);
}
synchronized (this) {
if (!closed) {
server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.beforeCloseSession(this, failed) : null);