Exemplo n.º 1
0
 /**
  * @param auditTimeoutThread
  * @param act
  * @return
  */
 private Audit submitAuditAndLaunch(AuditTimeoutThread auditTimeoutThread, Act act) {
   synchronized (auditTimeoutThread) {
     Future submitedThread = threadPoolTaskExecutor.submit(auditTimeoutThread);
     while (submitedThread != null && !submitedThread.isDone()) {
       try {
         Thread.sleep(500);
       } catch (InterruptedException ex) {
         LOGGER.error("", ex);
       }
       if (auditTimeoutThread.isDurationExceedsDelay()) {
         LOGGER.debug(
             "Audit Duration ExceedsDelay. The audit result "
                 + "is now managed in an asynchronous way.");
         break;
       }
     }
     if (null != auditTimeoutThread.getException()) {
       LOGGER.error("new KrashAuditException()");
       throw new KrashAuditException(auditTimeoutThread.getException());
     }
     return auditTimeoutThread.getAudit();
   }
 }