If you want to natively support returning results from a worker to the submitting thread, I would add something like the following method to
WorkerExecutor (or to a new sub-interface, if you need to preserve backwards compatibility for existing third-party implementations of the interface):
<R extends Serializable> void submit(Class<? extends Callable<R>> actionClass, Consumer<? super R> callback, Action<? super WorkerConfiguration> configAction)
Obviously, the Worker API would take the return value from running the instantiated
Callable, and pass it as the argument to
To prevent threading issues, only one callback can run at a time. If a worker finishes while another callback is running, its callback is queued.