开发者

Is there JDK interface which looks like interface ConsumerInterface<T> { void consume(T data); }

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜