private void verifyTargetSessionIsLocalOrStateless(SessionRequest req,SessionID sid) throws SessionException, SessionRequestException, ForwardSessionRequestException {
  if (statelessSessionManager.containsJwt(sid)) {
    return;
  }
  String hostServerID=foreignSessionHandler.getCurrentHostServer(sid);
  if (!serverConfig.isLocalServer(hostServerID)) {
    try {
      throw new ForwardSessionRequestException(forward(SESSION_SERVICE_URL_SERVICE.getSessionServiceURL(hostServerID),req));
    }
 catch (    SessionException se) {
      if (!sessionService.checkServerUp(hostServerID)) {
        String retryHostServerID=foreignSessionHandler.getCurrentHostServer(sid);
        if (retryHostServerID.equals(hostServerID)) {
          throw se;
        }
 else {
          if (!serverConfig.isLocalServer(retryHostServerID)) {
            throw new ForwardSessionRequestException(forward(SESSION_SERVICE_URL_SERVICE.getSessionServiceURL(hostServerID),req));
          }
        }
      }
 else {
        throw se;
      }
    }
  }
  if (!sessionService.checkSessionLocal(sid)) {
    throw new SessionRequestException(sid,SessionBundle.getString("sessionNotObtained"));
  }
}

private void verifyTargetSessionIsLocalOrStateless ( SessionRequest req , SessionID sid ) throws SessionException , SessionRequestException , ForwardSessionRequestException { if ( statelessSessionManager . containsJwt ( sid ) ) { return ; } String hostServerID = foreignSessionHandler . getCurrentHostServer ( sid ) ; if ( ! serverConfig . isLocalServer ( hostServerID ) ) { try { throw new ForwardSessionRequestException ( forward ( SESSION_SERVICE_URL_SERVICE . getSessionServiceURL ( hostServerID ) , req ) ) ; } catch ( SessionException se ) { if ( ! sessionService . checkServerUp ( hostServerID ) ) { String retryHostServerID = foreignSessionHandler . getCurrentHostServer ( sid ) ; if ( retryHostServerID . equals ( hostServerID ) ) { throw se ; } else { if ( ! serverConfig . isLocalServer ( retryHostServerID ) ) { throw new ForwardSessionRequestException ( forward ( SESSION_SERVICE_URL_SERVICE . getSessionServiceURL ( hostServerID ) , req ) ) ; } } } else { throw se ; } } } if ( ! sessionService . checkSessionLocal ( sid ) ) { throw new SessionRequestException ( sid , SessionBundle . getString ( "sessionNotObtained" ) ) ; } }
verify that this server is the correct host for the session and the session can be found ( or recovered ) locally . this function will become much simpler with removal of home servers , or possibly no longer be required .
