Add a no-args constructor for simple use cases
This commit is contained in:
parent
5e01ab7f4e
commit
784bf791c2
@ -87,6 +87,15 @@ public class NioClientSocketChannelFactory implements ClientSocketChannelFactory
|
|||||||
private final WorkerPool<NioWorker> workerPool;
|
private final WorkerPool<NioWorker> workerPool;
|
||||||
private final NioClientSocketPipelineSink sink;
|
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
|
* Creates a new instance. Calling this constructor is same with calling
|
||||||
* {@link #NioClientSocketChannelFactory(Executor, Executor, int, int)} with
|
* {@link #NioClientSocketChannelFactory(Executor, Executor, int, int)} with
|
||||||
|
@ -79,6 +79,15 @@ public class NioDatagramChannelFactory implements DatagramChannelFactory {
|
|||||||
private final NioDatagramPipelineSink sink;
|
private final NioDatagramPipelineSink sink;
|
||||||
private final WorkerPool<NioDatagramWorker> workerPool;
|
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
|
* Creates a new instance. Calling this constructor is same with calling
|
||||||
* {@link #NioDatagramChannelFactory(Executor, int)} with 2 * the number of
|
* {@link #NioDatagramChannelFactory(Executor, int)} with 2 * the number of
|
||||||
|
@ -89,6 +89,15 @@ public class NioServerSocketChannelFactory implements ServerSocketChannelFactory
|
|||||||
private final WorkerPool<NioWorker> workerPool;
|
private final WorkerPool<NioWorker> workerPool;
|
||||||
private final ChannelSink sink;
|
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
|
* Creates a new instance. Calling this constructor is same with calling
|
||||||
* {@link #NioServerSocketChannelFactory(Executor, Executor, int)} with 2 *
|
* {@link #NioServerSocketChannelFactory(Executor, Executor, int)} with 2 *
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
package org.jboss.netty.channel.socket.oio;
|
package org.jboss.netty.channel.socket.oio;
|
||||||
|
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.RejectedExecutionException;
|
import java.util.concurrent.RejectedExecutionException;
|
||||||
|
|
||||||
import org.jboss.netty.channel.Channel;
|
import org.jboss.netty.channel.Channel;
|
||||||
@ -76,6 +77,15 @@ public class OioClientSocketChannelFactory implements ClientSocketChannelFactory
|
|||||||
private final Executor workerExecutor;
|
private final Executor workerExecutor;
|
||||||
final OioClientSocketPipelineSink sink;
|
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.
|
* Creates a new instance.
|
||||||
*
|
*
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
package org.jboss.netty.channel.socket.oio;
|
package org.jboss.netty.channel.socket.oio;
|
||||||
|
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.RejectedExecutionException;
|
import java.util.concurrent.RejectedExecutionException;
|
||||||
|
|
||||||
import org.jboss.netty.channel.Channel;
|
import org.jboss.netty.channel.Channel;
|
||||||
@ -89,6 +90,15 @@ public class OioServerSocketChannelFactory implements ServerSocketChannelFactory
|
|||||||
private final Executor workerExecutor;
|
private final Executor workerExecutor;
|
||||||
private final ChannelSink sink;
|
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.
|
* Creates a new instance.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user