Resource aware queue

For the TLDRs: This blog post presents the reasoning behing a project called ResourcePriorityBlockingQueue which is a blocking queue implementation that: Allows you to assign priority on tasks, just as with a PriorityBlockingQueue. Tasks may belong to task groups where each group may have a different priority. In that case, tasks are prioritized by group first, then task priority second. For a particular instance of a ResourcePriorityBlockingQueue you give it implementations of a ResourcePrioritizer and a ResourceAllocator, which further defines to which resources a particular task is made available. Focus as been put on making the code highly concurrent with as little synchronized code as possible. Lock free code is used where applicable, with efficient use of internal data structures. This gives ResourcePriorityBlockingQueue a performance characteristic which is comparable to that of a pure PriorityBlockingQueue when used in a similar fashion. It’s available on GitHub, so feel free to poke around. Any constructive feedback is always welcome. ...

April 7, 2013 · 9 min · Christian Felde