예제 #1
0
 private static void logEndTime(CommandLine command, long startTime) {
   log.info(
       "Completed "
           + command.getExecutable()
           + " in "
           + (System.currentTimeMillis() - startTime)
           + "ms");
 }
예제 #2
0
  /**
   * Stopping a pumper thread. The implementation actually waits longer than specified in 'timeout'
   * to detect if the timeout was indeed exceeded. If the timeout was exceeded an IOException is
   * created to be thrown to the caller.
   *
   * @param thread the thread to be stopped
   * @param timeout the time in ms to wait to join
   */
  protected void stopThread(final Thread thread, final long timeout) {

    if (thread != null) {
      try {
        if (timeout == 0) {
          thread.join();
        } else {
          final long timeToWait = timeout + STOP_TIMEOUT_ADDITION;
          final long startTime = System.currentTimeMillis();
          thread.join(timeToWait);
          if (!(System.currentTimeMillis() < startTime + timeToWait)) {
            final String msg = "The stop timeout of " + timeout + " ms was exceeded";
            caught = new ExecuteException(msg, Executor.INVALID_EXITVALUE);
          }
        }
      } catch (final InterruptedException e) {
        thread.interrupt();
      }
    }
  }
예제 #3
0
 public static long logStartInfo(CommandLine command, File projectRoot) {
   log.info(
       "Starting " + dirPath(projectRoot) + "> " + StringUtils.join(command.toStrings(), " "));
   return System.currentTimeMillis();
 }