Created
May 4, 2016 13:42
-
-
Save logentries-gists/b29a335040e635bbe9062a252e4e5530 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 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