Skip to content

Commit

Permalink
chore: check that the session has a lastUseTime (#3363)
Browse files Browse the repository at this point in the history
  • Loading branch information
olavloite authored Oct 2, 2024
1 parent 38dc14a commit 84943da
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2083,7 +2083,8 @@ private void removeIdleSessions(Instant currTime) {
Iterator<PooledSession> iterator = sessions.descendingIterator();
while (iterator.hasNext()) {
PooledSession session = iterator.next();
if (session.delegate.getLastUseTime().isBefore(minLastUseTime)) {
if (session.delegate.getLastUseTime() != null
&& session.delegate.getLastUseTime().isBefore(minLastUseTime)) {
if (session.state != SessionState.CLOSING) {
boolean isRemoved = removeFromPool(session);
if (isRemoved) {
Expand Down Expand Up @@ -2676,7 +2677,8 @@ private Tuple<PooledSession, Integer> findSessionToKeepAlive(
&& (numChecked + numAlreadyChecked)
< (options.getMinSessions() + options.getMaxIdleSessions() - numSessionsInUse)) {
PooledSession session = iterator.next();
if (session.delegate.getLastUseTime().isBefore(keepAliveThreshold)) {
if (session.delegate.getLastUseTime() != null
&& session.delegate.getLastUseTime().isBefore(keepAliveThreshold)) {
iterator.remove();
return Tuple.of(session, numChecked);
}
Expand Down

0 comments on commit 84943da

Please sign in to comment.