code: public void updateInactivityTimer () {
          try (Lock ignored = locker.lockIfNotHeld()) {
              if (log.isDebugEnabled()) {
                  log.debug("updateInactivityTimer");
              }
  
              long maxInactive =  sessionData.getMaxInactiveInterval();
              int evictionPolicy = sessionHandler.getSessionCache().getEvictionPolicy();
  
              if (maxInactive <= 0) {
                  //sessions are immortal, they never expire
                  if (evictionPolicy < SessionCache.EVICT_ON_INACTIVITY) {
                      //we do not want to evict inactive sessions
                      setInactivityTimer(-1L);
                      if (log.isDebugEnabled()) {
                          log.debug("Session is immortal && no inactivity eviction: timer cancelled");
                      }
                  } else {
                      //sessions are immortal but we want to evict after inactivity
                      setInactivityTimer(TimeUnit.SECONDS.toMillis(evictionPolicy));
                      if (log.isDebugEnabled()) {
                          log.debug("Session is immortal; evict after " + evictionPolicy + " sec inactivity");
                      }
                  }
              } else {
                  //sessions are not immortal
                  if (evictionPolicy < SessionCache.EVICT_ON_INACTIVITY) {
                      //don't want to evict inactive sessions, set the timer for the session's maxInactive setting
                      setInactivityTimer(sessionData.getMaxInactiveInterval());
                      if (log.isDebugEnabled()) {
                          log.debug("No inactive session eviction");
                      }
                  } else {
                      //set the time to the lesser of the session's maxInactive and eviction timeout
                      setInactivityTimer(Math.min(maxInactive, TimeUnit.SECONDS.toMillis(evictionPolicy)));
                      if (log.isDebugEnabled()) {
                          log.debug("Inactivity timer set to lesser of maxInactive=" + maxInactive +
                                  " and inactivityEvict=" + evictionPolicy);
                      }
                  }
              }
          }
      }
docs: Set the inactivity timer to the smaller of the session maxInactivity
  (ie session-timeout from web.xml), or the inactive eviction time.