Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save logentries-gists/b29a335040e635bbe9062a252e4e5530 to your computer and use it in GitHub Desktop.

Select an option

Save logentries-gists/b29a335040e635bbe9062a252e4e5530 to your computer and use it in GitHub Desktop.
/**
* lists all jobs that are currently in progress.
*/
public List<Batch> getJobsInProgress() {
Jedis instance = null;
List<String> res;
try {
instance = this.jedisPool.getResource();
LOGGER.debug("Trying to read all elements in {} queue", workQueue);
res = instance.lrange(workQueue, 0, -1);
List<Batch> jobs = new ArrayList<>(res.size());
for (String json : res) {
Batch job = jsonToBatch(json);
jobs.add(job);
}
return jobs;
} catch (Exception e) {
LOGGER.warn("Problem listing job list, queue:{}", workQueue, e);
return null;
} finally {
instance.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment