code: private void passivateSession(BackedSession sess) {
          synchronized (sess) { // Keep PropertyWriter thread from sneaking in..
  
              if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                  LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[PASSIVATE_SESSION], "check for Passivation Listener for session");
              }
  
              // note that sessionCacheDiscard was called by LRUHashMap.put when he had to eject the oldest
              getStoreCallback().sessionWillPassivate(sess);
  
              if (_smc.getEnableTimeBasedWrite() || _smc.getPersistSessionAfterPassivation()) {
                  // Since removing from the cache... Need to write the session to the database
                  //  Don't bother checking if this session is in the service method
                  //  as it is the oldest entry in the cache.
                  // Need to also write the session if passivate updated any attributes.
                  if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                      if (_smc.getEnableTimeBasedWrite()) {
                          LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[PASSIVATE_SESSION],
                                                              "Removing oldest entry from cache with TimeBasedWrits. Write it! " + sess.getId() + " " + getAppName());
                      } else {
                          LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[PASSIVATE_SESSION],
                                                              "Persisting the session after it was passivated. " + sess.getId() + " " + getAppName());
                      }
                  }
                  sess.removingSessionFromCache = true;
                  sess.sync();
                  sess.removingSessionFromCache = false;
              }
          }
      }
docs: /*
  passivateSession - writes session to persistent store and does
  sessionWillPassivate callback