Beispiel #1
0
 /**
  * Stops the given AUT.
  *
  * @param autId The ID of the Running AUT to stop.
  * @param timeout indicates whether the AUT should be forced to quit (timeout == 0) or whether the
  *     AUT should terminate by itself (timeout > 0)
  */
 public void stopAut(AutIdentifier autId, int timeout) {
   boolean force = timeout == 0;
   if (!force) {
     long startTime = System.currentTimeMillis();
     boolean timedOut = false;
     while (m_auts.containsKey(autId) && !timedOut) {
       timedOut = (startTime + timeout) < System.currentTimeMillis();
       TimeUtil.delay(250);
     }
     if (!timedOut) {
       // The AUT has just unregistered itself - which must not be exactly
       // the same as terminated - therefore we wait for another moment
       // of time
       TimeUtil.delayDefaultOrExternalTime(
           AUT_POST_DEREGISTRATION_DELAY_DEFAULT, AUT_POST_DEREGISTRATION_DELAY_VAR);
     } else {
       force = true;
     }
   }
   synchronized (m_auts) {
     Communicator autCommunicator = m_auts.get(autId);
     if (autCommunicator != null) {
       if (force) {
         removeAut(autId);
       }
     }
   }
 }