Make DefaultEventExecutor usable by users.

Motivation:

There's no reason to keep our users from using DefaultEventExecutor directly.  It should be actually very useful to them.

Modifications:

Make DefaultEventExecutor public and add useful public constructors.

Result:

DefaultEventExecutor got usable by anyone, yielding more value as a generic library.
This commit is contained in:
Trustin Lee 2014-03-24 11:18:03 +09:00
parent 4332821e6f
commit 924113ce8c

View File

@ -16,15 +16,35 @@
package io.netty.util.concurrent; package io.netty.util.concurrent;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import java.util.concurrent.ThreadFactory;
/** /**
* Default {@link SingleThreadEventExecutor} implementation which just execute all submitted task in a * Default {@link SingleThreadEventExecutor} implementation which just execute all submitted task in a
* serial fashion * serial fashion
*
*/ */
final class DefaultEventExecutor extends SingleThreadEventExecutor { public final class DefaultEventExecutor extends SingleThreadEventExecutor {
DefaultEventExecutor(DefaultEventExecutorGroup parent, Executor executor) { public DefaultEventExecutor() {
this((EventExecutorGroup) null);
}
public DefaultEventExecutor(ThreadFactory threadFactory) {
this(null, threadFactory);
}
public DefaultEventExecutor(Executor executor) {
this(null, executor);
}
public DefaultEventExecutor(EventExecutorGroup parent) {
this(parent, new DefaultThreadFactory(DefaultEventExecutor.class));
}
public DefaultEventExecutor(EventExecutorGroup parent, ThreadFactory threadFactory) {
super(parent, threadFactory, true);
}
public DefaultEventExecutor(EventExecutorGroup parent, Executor executor) {
super(parent, executor, true); super(parent, executor, true);
} }