Skip to content

Commit

Permalink
sessionKey null check for command line (#489)
Browse files Browse the repository at this point in the history
* sessionKey null check for command line

* checkstyle adjusted
  • Loading branch information
devesh-b1 committed Sep 7, 2023
1 parent a38c8a2 commit 8772c69
Showing 1 changed file with 21 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1142,24 +1142,27 @@ private void replySession(
final long sessionId = sessionInfo.sessionId();
final CompositeKey sessionKey = sessionInfo.sessionKey();

final int lastReceivedSequenceNumber = receivedSequenceNumberIndex.lastKnownSequenceNumber(sessionId);
final int lastSentSequenceNumber = sentSequenceNumberIndex.lastKnownSequenceNumber(sessionId);

sessionsEncoder.next()
.sessionId(sessionId)
.connectionId(connectionId)
.lastReceivedSequenceNumber(lastReceivedSequenceNumber)
.lastSentSequenceNumber(lastSentSequenceNumber)
.lastLogonTime(lastLogonTime)
.sequenceIndex(sessionInfo.sequenceIndex())
.slowStatus(isSlowConsumer ? SlowStatus.SLOW : SlowStatus.NOT_SLOW)
.address(address)
.localCompId(sessionKey.localCompId())
.localSubId(sessionKey.localSubId())
.localLocationId(sessionKey.localLocationId())
.remoteCompId(sessionKey.remoteCompId())
.remoteSubId(sessionKey.remoteSubId())
.remoteLocationId(sessionKey.remoteLocationId());
if (sessionKey != null)
{
final int lastReceivedSequenceNumber = receivedSequenceNumberIndex.lastKnownSequenceNumber(sessionId);
final int lastSentSequenceNumber = sentSequenceNumberIndex.lastKnownSequenceNumber(sessionId);

sessionsEncoder.next()
.sessionId(sessionId)
.connectionId(connectionId)
.lastReceivedSequenceNumber(lastReceivedSequenceNumber)
.lastSentSequenceNumber(lastSentSequenceNumber)
.lastLogonTime(lastLogonTime)
.sequenceIndex(sessionInfo.sequenceIndex())
.slowStatus(isSlowConsumer ? SlowStatus.SLOW : SlowStatus.NOT_SLOW)
.address(address)
.localCompId(sessionKey.localCompId())
.localSubId(sessionKey.localSubId())
.localLocationId(sessionKey.localLocationId())
.remoteCompId(sessionKey.remoteCompId())
.remoteSubId(sessionKey.remoteSubId())
.remoteLocationId(sessionKey.remoteLocationId());
}
}

public void onAdminResetSequenceNumbersRequest(final long correlationId, final long sessionId)
Expand Down

0 comments on commit 8772c69

Please sign in to comment.