usb4java/usb4java-javax — pull request #2 by colinrgodsey (2014-04-27 16:29:36+00:00)
Title: Confgurable xecutor service for IRP queue

This is a supplement to original PR. It goes a little further, but I think helps solve the initial issues in my first PR, while adding more customization and removing concurrency-control code.

My latest research into the IRP queue stuff has been aimed at reducing thread count and creation. Obviously each device must keep its queue non-parallel, but there are still different execution strategies a user may want to choose (maybe only one thread for the process? higher latency, but may work for some use cases). In my case ill be using Akka actors with a custom dispatcher to maintain queue locality, while sharing a thread pool. This will help me break my worst-case 2-thread per device complexity.

Using an executorservice also helps move thread control out of the codebase. There are tonnss of great patterns you could implement with that control, and the default java executors are really solid. At first I just wanted to add a timeout to the IRP queue thread, but noticed I could do all that with the standard executors.