@Override
      public Integer getValue() {
        Iterable<HiveSession> filtered = Iterables.filter(getSessions(), new Predicate<HiveSession>() {
          @Override
          public boolean apply(HiveSession hiveSession) {
            return hiveSession.getNoOperationTime() == 0L;
          }
        });
        return Iterables.size(filtered);
      }
The lock that synchronizes the allowSessions flag and handleToSession map.
      Active-passive HA first disables the connections, then closes existing one, making sure
      there are no races between these two processes.
service/src/java/org/apache/hive/service/cli/session/SessionManager.java