You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2022/04/25 08:07:41 UTC

[GitHub] [cloudstack] Pearl1594 commented on a diff in pull request #6313: remove superfluent counter and fix log message

Pearl1594 commented on code in PR #6313:
URL: https://github.com/apache/cloudstack/pull/6313#discussion_r857360827


##########
server/src/main/java/com/cloud/api/ApiSessionListener.java:
##########
@@ -57,17 +52,15 @@ public void sessionCreated(HttpSessionEvent event) {
         synchronized (this) {
             HttpSession session = event.getSession();
             sessions.put(session, event.getSource());
-            sessionCount++;
         }
-        LOGGER.debug("Sessions count: " + sessions);
+        LOGGER.debug("Sessions count: " + sessions.size());

Review Comment:
   can we not use getSessionCount() instead?
   ```suggestion
           LOGGER.debug("Sessions count: " + getSessionCount());
   ```



##########
server/src/main/java/com/cloud/api/ApiSessionListener.java:
##########
@@ -57,17 +52,15 @@ public void sessionCreated(HttpSessionEvent event) {
         synchronized (this) {
             HttpSession session = event.getSession();
             sessions.put(session, event.getSource());
-            sessionCount++;
         }
-        LOGGER.debug("Sessions count: " + sessions);
+        LOGGER.debug("Sessions count: " + sessions.size());
     }
     public void sessionDestroyed(HttpSessionEvent event) {
         LOGGER.debug("Session destroyed by Id : " + event.getSession().getId() + " , session: " + event.getSession().toString() + " , source: " + event.getSource().toString() + " , event: " + event.toString());
         synchronized (this) {
-            sessionCount--;
             sessions.remove(event.getSession());
         }
-        LOGGER.debug("Sessions count: " + sessions);
+        LOGGER.debug("Sessions count: " + sessions.size());

Review Comment:
   can we not use getSessionCount() instead?
   ```suggestion
           LOGGER.debug("Sessions count: " + getSessionCount());
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org