Add no-args constructor for simple use-cases

This commit is contained in:
norman 2012-03-27 09:29:43 +02:00
parent 0082a15899
commit 0c3a33f83b
6 changed files with 62 additions and 0 deletions

View File

@ -86,6 +86,15 @@ public class NioClientSocketChannelFactory implements ClientSocketChannelFactory
private final WorkerPool<NioWorker> workerPool;
private final NioClientSocketPipelineSink sink;
/**
* Creates a new {@link NioClientSocketChannelFactory} which uses {@link Executors#newCachedThreadPool()} for the worker and boss executors.
*
* See {@link #NioClientSocketChannelFactory(Executor, Executor)}
*/
public NioClientSocketChannelFactory() {
this(Executors.newCachedThreadPool(), Executors.newCachedThreadPool());
}
/**
* Creates a new instance. Calling this constructor is same with calling
* {@link #NioClientSocketChannelFactory(Executor, Executor, int, int)} with

View File

@ -79,6 +79,17 @@ public class NioDatagramChannelFactory implements DatagramChannelFactory {
private final NioDatagramPipelineSink sink;
private final WorkerPool<NioDatagramWorker> workerPool;
/**
* Create a new {@link NioDatagramChannelFactory} with a {@link Executors#newCachedThreadPool()}.
*
* See {@link #NioDatagramChannelFactory(Executor)}
*/
public NioDatagramChannelFactory() {
this(Executors.newCachedThreadPool());
}
/**
* Creates a new instance. Calling this constructor is same with calling
* {@link #NioDatagramChannelFactory(Executor, int)} with 2 * the number of

View File

@ -89,6 +89,17 @@ public class NioServerSocketChannelFactory implements ServerSocketChannelFactory
private final WorkerPool<NioWorker> workerPool;
private final ChannelSink sink;
/**
* Create a new {@link NioServerSocketChannelFactory} using
* {@link Executors#newCachedThreadPool()} for the boss and worker.
*
* See {@link #NioServerSocketChannelFactory(Executor, Executor)}
*/
public NioServerSocketChannelFactory() {
this(Executors.newCachedThreadPool(), Executors.newCachedThreadPool());
}
/**
* Creates a new instance. Calling this constructor is same with calling
* {@link #NioServerSocketChannelFactory(Executor, Executor, int)} with 2 *

View File

@ -16,6 +16,7 @@
package io.netty.channel.socket.oio;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.RejectedExecutionException;
import io.netty.channel.Channel;
@ -75,6 +76,15 @@ public class OioClientSocketChannelFactory implements ClientSocketChannelFactory
private final Executor workerExecutor;
final OioClientSocketPipelineSink sink;
/**
* Creates a new instance with a {@link Executors#newCachedThreadPool()} as worker executor.
*
* See {@link #OioClientSocketChannelFactory(Executor)}
*/
public OioClientSocketChannelFactory() {
this(Executors.newCachedThreadPool());
}
/**
* Creates a new instance.
*

View File

@ -16,6 +16,7 @@
package io.netty.channel.socket.oio;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.RejectedExecutionException;
import io.netty.channel.Channel;
@ -74,6 +75,16 @@ public class OioDatagramChannelFactory implements DatagramChannelFactory {
private final Executor workerExecutor;
final OioDatagramPipelineSink sink;
/**
* Creates a new instance with a {@link Executors#newCachedThreadPool()} as worker executor.
*
* See {@link #OioDatagramChannelFactory(Executor)}
*/
public OioDatagramChannelFactory() {
this(Executors.newCachedThreadPool());
}
/**
* Creates a new instance.
*

View File

@ -16,6 +16,7 @@
package io.netty.channel.socket.oio;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.RejectedExecutionException;
import io.netty.channel.Channel;
@ -88,6 +89,15 @@ public class OioServerSocketChannelFactory implements ServerSocketChannelFactory
private final Executor workerExecutor;
private final ChannelSink sink;
/**
* Create a new {@link OioServerSocketChannelFactory} with a {@link Executors#newCachedThreadPool()} for the boss and worker executor.
*
* See {@link #OioServerSocketChannelFactory(Executor, Executor)}
*/
public OioServerSocketChannelFactory() {
this(Executors.newCachedThreadPool(), Executors.newCachedThreadPool());
}
/**
* Creates a new instance.
*