jobId = (String)i.next();
status = session.wait(jobId, Session.TIMEOUT_WAIT_FOREVER);
/* report how job finished */
if (status.wasAborted()) {
System.out.println("job \"" + jobId + "\" never ran");
} else if (status.hasExited()) {
System.out.println("job \"" + jobId + "\" finished regularly with exit status " + status.getExitStatus());
} else if (status.hasSignaled()) {
System.out.println("job \"" + jobId + "\" finished due to signal " + status.getTerminatingSignal());