The previous implementation, using Quartz Scheduler, was a bit of a hack as it was, as quartz is more for scheduling rather than queueing.
Additionally, the quartz API doesn't expose things such as number of jobs in the queue, making upcoming work more difficult, if not impossible.
BlockingQueues are thread-safe, so this implementation should be (i.e. to be called within the context of a grails service). I had a bit of trouble unit testing this - I wouldn't mind coming back to this if and when I have time.
The previous implementation, using Quartz Scheduler, was a bit of a hack as it was, as quartz is more for scheduling rather than queueing. Additionally, the quartz API doesn't expose things such as number of jobs in the queue, making upcoming work more difficult, if not impossible.
BlockingQueues
are thread-safe, so this implementation should be (i.e. to be called within the context of a grails service). I had a bit of trouble unit testing this - I wouldn't mind coming back to this if and when I have time.