[英]Design pattern used in ExecutorCompletionService core java class
ExecutorCompletionService是Executor和ExecutorService类的包装器。 通过查看ExecutorCompletionService类源代码,我可以想到许多设计模式
public class ExecutorCompletionService<V> implements CompletionService<V>
{
public ExecutorCompletionService(Executor executor) {
}
}
谁能详细解释我们可以对此类实现进行分类的设计模式? 提前致谢。
该ExecutorCompletionService
不在身边的包装Executor
,它是一个实现CompletionService
它使用一个Executor做其工作。
该Executor
是通过构造函数注入的,而不是在内部创建的,这是依赖反转的应用程序。
同样,它也可以接受外部BockingQueue
实现,以用于执行已完成的任务,但这并不能使其成为BockingQueue
的包装器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.