Существуют символы двух классов:
/**
* The {@link EventExecutor} is a special {@link EventExecutorGroup} which comes
* with some handy methods to see if a {@link Thread} is executed in a event loop.
* Besides this, it also extends the {@link EventExecutorGroup} to allow for a generic
* way to access methods.
*
*/
public interface EventExecutor extends EventExecutorGroup {
/**
* The {@link EventExecutorGroup} is responsible for providing the {@link EventExecutor}'s to use
* via its {@link #next()} method. Besides this, it is also responsible for handling their
* life-cycle and allows shutting them down in a global fashion.
*
*/
public interface EventExecutorGroup extends ScheduledExecutorService, Iterable<EventExecutor> {
EventExecutorGroup
является контейнером EventExecutor
и управляет их жизненным циклом.Это хорошо и легко понять.
Я думаю, что цель дизайна в основном состоит в том, чтобы повторно использовать некоторые определения методов и чувствовать себя не так естественно.Никто бы не сделал Thread extends ThreadPool
, верно? (Эммм .. Там тоже EventLoop
расширяет EventLoopGroup
....)
Почему элемент расширяет свой контейнер и рассматривает себя как специальный контейнер?
Я хочу знать, есть ли какие-то преимущества, которые я упустил.