public synchronized Set<Job> getAllJobsForTag(String tag) { Set<Job> result = new HashSet<>(); for (int i = 0; i < mJobs.size(); i++) { Job job = mJobs.valueAt(i); if (tag == null || tag.equals(job.getParams().getTag())) { result.add(job); } } Map<Integer, WeakReference<Job>> snapshot = mFinishedJobsCache.snapshot(); for (WeakReference<Job> reference : snapshot.values()) { Job job = reference.get(); if (job == null) { continue; } if (tag == null || tag.equals(job.getParams().getTag())) { result.add(job); } } return result; }
@Override public String toString() { return "job{" + "id=" + mParams.getId() + ", finished=" + isFinished() + ", result=" + mResult + ", canceled=" + mCanceled + ", periodic=" + mParams.isPeriodic() + ", class=" + getClass().getSimpleName() + ", tag=" + mParams.getTag() + '}'; }
public synchronized Set<Job> getAllJobsForTag(String tag) { Set<Job> result = new HashSet<>(); for (int i = 0; i < mJobs.size(); i++) { Job job = mJobs.valueAt(i); if (tag == null || tag.equals(job.getParams().getTag())) { result.add(job); } } Map<Integer, WeakReference<Job>> snapshot = mFinishedJobsCache.snapshot(); for (WeakReference<Job> reference : snapshot.values()) { Job job = reference.get(); if (job == null) { continue; } if (tag == null || tag.equals(job.getParams().getTag())) { result.add(job); } } return result; }
@Override public String toString() { return "job{" + "id=" + mParams.getId() + ", finished=" + isFinished() + ", result=" + mResult + ", canceled=" + mCanceled + ", periodic=" + mParams.isPeriodic() + ", class=" + getClass().getSimpleName() + ", tag=" + mParams.getTag() + '}'; }