There's Callable<V>
in JDK which is producer in开发者_开发知识库terface, is there consumer interface in JDK?
Question rationale: I'm writing executor which accepts 2-phase tasks: 1st phase is producing data, 2nd phase is consuming of that data. In between these 2 phases I could like to cancel task (i.e., to not performing consumption).
UPDATE: Well, I thought such general-purpose interface (e.g., useful in multi-threaded programming) could be in JDK. I just can't remember if I actually seen such interface in JDK.
I settled by writing my own interface.
精彩评论