package net.ihiroky.niotty;

import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;

/**
 * <p>An implementation of {@link net.ihiroky.niotty.EventDispatcherGroup}
 * that manages {@link net.ihiroky.niotty.DefaultEventDispatcher}.</p>
 *
 * <p>This class use threads to execute the {@code DefaultEventDispatcher}. </p>
 */
public final class DefaultEventDispatcherGroup
        extends EventDispatcherGroup<DefaultEventDispatcher> {

    private static class DefaultEventDispatcherFactory implements EventDispatcherFactory<DefaultEventDispatcher> {

        private int eventQueueSize_;

        DefaultEventDispatcherFactory(int eventQueueSize) {
            eventQueueSize_ = eventQueueSize;
        }

        @Override
        public DefaultEventDispatcher newEventDispatcher() {
            return new DefaultEventDispatcher(eventQueueSize_);
        }
    };

    /**
     * Constructs a instance.
     *
     * An invocation of this constructor behaves in exactly the same way as the invocation
     * <code>DefaultEventDispatcherGroup(numberOfThread, Executors.defaultThreadFactory(), 0)</code>.
     *
     * @param workers the number of the threads to be managed by the instance
     */
    public DefaultEventDispatcherGroup(int workers) {
        this(workers, Executors.defaultThreadFactory(), 0);
    }

    /**
     * Constructs a instance.
     *
     * @param workers the number of the threads to be managed by the instance
     * @param threadFactory a factory to create thread which runs a event dispatcher
     * @param eventQueueCapacity the capacity of the event queue used by {@code DefaultEventDispatcher}
     */
    public DefaultEventDispatcherGroup(int workers, ThreadFactory threadFactory, int eventQueueCapacity) {
        super(workers, threadFactory, new DefaultEventDispatcherFactory(eventQueueCapacity));
    }
}

@@ -1067,22 +1067,15 @@
 oup(
-numberOfThread
+workers
 , Ex
@@ -1327,24 +1327,538 @@
  0);%0A    %7D%0A%0A
+    /**%0A     * Constructs a instance.%0A     *%0A     * An invocation of this constructor behaves in exactly the same way as the invocation%0A     * %3Ccode%3EDefaultEventDispatcherGroup(workers, threadFactory, 0)%3C/code%3E.%0A     * @param workers the number of the threads to be managed by the instance%0A     * @param threadFactory a factory to create thread which runs a event dispatcher%0A     */%0A    public DefaultEventDispatcherGroup(int workers, ThreadFactory threadFactory) %7B%0A        this(workers, threadFactory, 0);%0A    %7D%0A%0A
     /**%0A    
@@ -2156,16 +2156,93 @@
 patcher%7D
+,%0A     *                           zero or negative if the queue has no limit
 %0A     */

Add constructor