docs: BackedSession getSession(String id, int versionId, boolean isSessionAccess, boolean retrieval) {
          //create local variable - JIT performance improvement
          final boolean isTraceOn = com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled();
          //id coming in does NOT have the Cache ID at the front.
          if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINER)) {
              StringBuffer sb = new StringBuffer("{").append(id).append(",").append(versionId).append("}");
              LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[GET_SESSION], sb.toString());
          }
  
          BackedSession sess = null;
  
          //incase of ssl, sessionid can go upto ???. So do this check only for
          //non-ssl id's. For ssl id session tracking, even when request is not
          //over ssl, this if is skipped which will result in database read
          //for non-websphere-session id's.
          if (!_smc.useSSLId() && id.length() != SessionManagerConfig.getSessionIDLength()) {
              return null;
          }
  
          //Check if session is in cache...
          //accessObject will return the session from cache and also
          //updates LRU cache
          sess = (BackedSession) accessObject(id);
          if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
              if (sess == null) {
                  LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[GET_SESSION], "session not found in cache " + id);
              } else {
                  LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[GET_SESSION],
                                                      "requested version: " + versionId + "; object's version: " + sess.getVersion());
              }
          }
  
          //used to determine if we need to update the version id when version already out of sync
          //if the lastAccessedTimeOnLocalCopy equals the lastAccessedTimeOnTheBackendCopy, we know another webapp updated the version
          //and therefore, we won't have to increment the version again, but we will bring the current session version in sync with the latest version
          long lastAccessTimeOnLocalCopy = 0;
  
          if (sess != null) {
  
              long nowTime = System.currentTimeMillis();
  
              boolean isValid = isValidCopy(sess, nowTime, versionId);
  
              if (isValid) {
                  if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                      LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[GET_SESSION], "valid cache copy " + id);
                  }
                  //
                  // Possibly update last access now.
                  // we do it now before returning to make sure a inval thread
                  // does not time us out before we do anything with this session
  
                  //  Cases are:
                  //    Write at EOS Mode - always update lastaccess now
                  //                        (updated for scheduled invalidation now since we need to update
                  //                         the db since another JVM checks the db for non-expired sessions
                  //                         in order to determine if the sessionid should be reused)
                  //
                  //    Manual Update - never write lastaccess now since it will always get written when
                  //                    the invalidation thread runs.  Note that the lastaccess times
                  //                    still get written at invalidation time when scheduled Invalidation
                  //                    is configured.
                  //
                  //    Time Based  - never write lastaccess now
                  //                  since it will always get written when the periodic write occurs.
                  //                   Note that the asyncUpd flag is "on" for TimeBasedWrite.
                  //
                  //
                  if (isSessionAccess) {
                      if (_smc.getEnableEOSWrite() && !_smc.getScheduledInvalidation()) {
                          int rowsRet = overQualLastAccessTimeUpdate(sess, nowTime);
                          // if rowsRet is 0, means an inval thread beat us to it,
                          // need to return null in this case
  
                          if (rowsRet == 0 && !sess.needToInsert) {
                              if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                                  LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[GET_SESSION], "session may be invalid in cache " + id);
                              }
  
                              synchronized (sess) {
                                  BackedSession sess1 = (BackedSession) accessObject(id);
                                  if (sess == sess1) {
                                      superRemove(id);
                                  }
                              }
                              // Don't want to pasivate as session has already been invalidated
                              sess = null;
                          }
                      } else {
                          synchronized (sess) {
                              sess.updateLastAccessTime(nowTime);
                          }
                      }
                  }
  
                  // don't need to update the browser token (i.e. cookie)
                  if (sess != null) {
                      if (retrieval) { //retrieval is set if we NEED to search the backend
                          //Cache copy might not be current, remove it from the cache and
                          //read it from external store
                          synchronized (sess) {
                              BackedSession sess1 = (BackedSession) accessObject(sess.getId());
                              if (sess == sess1) {
                                  superRemove(sess.getId());
                              }
                          }
                      } else {
                          return sess;
                      }
                  }
  
              } else {
                  if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                      LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[GET_SESSION], "Cache copy is out of date or invalid " + id);
                  }
  
                  //Cache copy is invalid,  remove it from the cache and
                  //read it from external store
                  synchronized (sess) {
                      BackedSession sess1 = (BackedSession) accessObject(sess.getId());
                      if (sess == sess1) {
                          superRemove(sess.getId());
                      }
                      //lastAccessTimeOnLocalCopy = sess.getCurrentAccessTime();
                  }
              }
          }
  
          //sess = retrieveSession(id, versionId, lastAccessTimeOnLocalCopy);
          sess = retrieveSession(id, versionId, sess);
  
          return sess;
      }