2 ms·
It might be worth looking at a generic Callable with your own generic response type, maybe something like Either where Left is an error and Right is your respon
by rad_gruchalski 5y ago
It might be worth looking at a generic Callable with your own generic response type, maybe something like Either where Left is an error and Right is your response type.
I'd wrap an executor into a provider. Make it accept a WorkItem and the method accepting WorkItem would construct the Callable.
I would suggest looking into an optimal way of doing this in, say, Scala and try to replicate some of those learnings in Java. Mind you - I didn't say "write it in Scala". I did say "try in a different language" and take the learnings from there. Scala Future is a good thing to look at.