Skip to content

Commit

Permalink
Apply skuruppu@'s recommendations
Browse files Browse the repository at this point in the history
  • Loading branch information
mayurkale22 committed Feb 21, 2020
1 parent 79fc6dc commit d6c99a3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
Expand Up @@ -799,7 +799,6 @@ public ApiFuture<Empty> asyncClose() {
@Override
public void close() {
synchronized (lock) {
numSessionsReleased++;
numSessionsInUse--;
}
leakedException = null;
Expand Down Expand Up @@ -1030,7 +1029,6 @@ private void closeIdleSessions(Instant currTime) {
}
numSessionsToClose -= sessionsToClose.size();
}
numSessionsReleased += sessionsToClose.size();
}
for (PooledSession sess : sessionsToClose) {
logger.log(Level.FINE, "Closing session {0}", sess.getName());
Expand Down Expand Up @@ -1525,6 +1523,7 @@ private void releaseSession(PooledSession session, Position position) {
if (closureFuture != null) {
return;
}
numSessionsReleased++;
if (readWaiters.size() == 0 && numSessionsBeingPrepared >= readWriteWaiters.size()) {
// No pending waiters
if (shouldPrepareSession()) {
Expand Down
Expand Up @@ -1628,7 +1628,7 @@ public Void call() {
assertThat(record.getMetrics())
.containsEntry(MetricRegistryConstants.NUM_ACQUIRED_SESSIONS, 0L);
assertThat(record.getMetrics())
.containsEntry(MetricRegistryConstants.NUM_RELEASED_SESSIONS, 3L);
.containsEntry(MetricRegistryConstants.NUM_RELEASED_SESSIONS, 5L);
assertThat(record.getMetrics()).containsEntry(MetricRegistryConstants.IN_USE_SESSIONS, 0L);
assertThat(record.getMetrics()).containsEntry(MetricRegistryConstants.MAX_IN_USE_SESSIONS, 2L);
}
Expand Down

0 comments on commit d6c99a3

Please sign in to comment.