Ejemplo n.º 1
0
  public TestSession findSessionByExternalKey(ExternalSessionKey externalkey) {
    if (externalkey == null) {
      return null;
    }

    for (TestSession session : activeTestSessions) {
      if (externalkey.equals(session.getExternalKey())) {
        return session;
      }
    }
    return null;
  }
Ejemplo n.º 2
0
 public TestSession getExistingSession(ExternalSessionKey externalkey) {
   TestSession sessionByExternalKey = findSessionByExternalKey(externalkey);
   if (sessionByExternalKey == null) {
     SessionTerminationReason sessionTerminationReason =
         externalkey != null ? reasons.get(externalkey) : null;
     String keyId = externalkey != null ? externalkey.getKey() : "(null externalkey)";
     if (sessionTerminationReason != null) {
       String msg = "Session [" + keyId + "] was terminated due to " + sessionTerminationReason;
       log.fine(msg);
       throw new GridException(msg);
     } else {
       String msg =
           "Session ["
               + keyId
               + "] not available and is not among the last 1000 terminated sessions.\n"
               + "Active sessions are"
               + this.unmodifiableSet();
       log.fine(msg);
       throw new GridException(msg);
     }
   }
   return sessionByExternalKey;
 }