code: public void checkInactiveSession(Session session) {
          if (session == null) {
              return;
          }
          if (log.isDebugEnabled()) {
              log.debug("Checking for idle " +  session.getId());
          }
          try (Lock ignored = session.lock()) {
              if (getEvictionPolicy() > 0 && session.isIdleLongerThan(getEvictionPolicy()) &&
                      session.isValid() && session.isResident() && session.getRequests() <= 0) {
                  // Be careful with saveOnInactiveEviction - you may be able to re-animate a session that was
                  // being managed on another node and has expired.
                  try {
                      if (log.isDebugEnabled()) {
                          log.debug("Evicting idle session " + session.getId());
                      }
  
                      // save before evicting
                      if (isSaveOnInactiveEviction() && sessionDataStore != null) {
                          if (sessionDataStore.isPassivating()) {
                              sessionHandler.willPassivate(session);
                          }
                          sessionDataStore.store(session.getId(), session.getSessionData());
                      }
  
                      doDelete(session.getId()); // detach from this cache
                      session.setResident(false);
                  } catch (Exception e) {
                      log.warn("Passivation of idle session" + session.getId() + " failed", e);
                      session.updateInactivityTimer();
                  }
              }
          }
      }
docs: Check a session for being inactive and
  thus being able to be evicted, if eviction
  is enabled.
  
  @param session session to check