I would like to implement a consumer service which is processing tasks from a queue. The consumer service / task runner I have implemented using an executor service.
However some of the tasks I need to process take longer than others and I would like to implement some type fairness within the task runner. When i invoke/schedule the consumer I will know the number tasks presently on the queue to execute.
I was wondering what is the best approach to achieve this ?
Each task has a specific type and an approx execution time.