示例#1
0
  public static void checkJobStatus(int jobId) {
    Authentication.requireAdmin();

    // Check the status of the currently running job
    if (runningJob == null) {
      renderText("No job is currently running.");
    } else if (runningJob.isDone()) {
      try {
        // Return the message
        String message = runningJob.get().message;
        runningJob = null;
        renderText(message);
      } catch (InterruptedException e) {
        renderText("The job that was running has been halted.");
      } catch (ExecutionException e) {
        renderText("The job that was running has failed with an exception.");
      }
    } else {
      ok();
    }
  }