@Override public synchronized JobMetadata findJob(UUID jobId) { if (jobId == null) throw new IllegalArgumentException( "Unable to find background operations with a specific id without the id specified."); for (JobMetadata job : jobs) { if (jobId.equals(job.getId())) return job; } return null; }
/** Helpfull method to display the state of the job queue */ public synchronized String toString() { StringBuilder string = new StringBuilder(); for (JobMetadata job : jobs) { string.append(job.getId()); string.append(": "); string.append(job.getStatus().name()); string.append(", "); string.append(job.getProgress().toString()); if (job.getOwnerId() != null) { string.append(" ("); string.append(job.getOwnerId()); string.append(")"); } string.append("\n"); } return string.toString(); }