本文整理汇总了Java中org.simpleframework.util.thread.PoolExecutor类的典型用法代码示例。如果您正苦于以下问题:Java PoolExecutor类的具体用法?Java PoolExecutor怎么用?Java PoolExecutor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PoolExecutor类属于org.simpleframework.util.thread包,在下文中一共展示了PoolExecutor类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createClient
import org.simpleframework.util.thread.PoolExecutor; //导入依赖的package包/类
public static Client createClient(InetSocketAddress address, String tag) throws Exception {
PoolExecutor executor = new PoolExecutor(Runnable.class, 20);
int port = address.getPort();
Client client = new Client(executor, port, tag);
client.start();
return client;
}
示例2: Pinger
import org.simpleframework.util.thread.PoolExecutor; //导入依赖的package包/类
public Pinger(int port, boolean socket, int count) throws Exception {
this.executor = new PoolExecutor(Pinger.class, count);
this.list = new Vector<String>(count);
this.sockets = new Vector<java.net.Socket>(count);
this.latch = new CountDownLatch(count);
this.stop = new CountDownLatch(count + count);
this.dumper = new ThreadDumper();
this.port = port;
this.socket = socket;
this.count = count;
}
示例3: Client
import org.simpleframework.util.thread.PoolExecutor; //导入依赖的package包/类
public Client(PoolExecutor executor, int port, String tag) {
this.task = new RequestTask(this, port, tag);
this.executor = executor;
}
示例4: ContainerSelector
import org.simpleframework.util.thread.PoolExecutor; //导入依赖的package包/类
/**
* Constructor for the <code>ContainerSelector</code> object. This
* is used to create a selector which will collect and dispatch
* requests using two thread pools. The first is used to collect
* the requests, the second is used to service those requests.
*
* @param handler this is the container used to service requests
* @param allocator this is used to allocate any buffers needed
* @param count this is the number of threads per thread pool
* @param select this is the number of selector threads to use
*/
public ContainerSelector(Container handler, Allocator allocator, int count, int select) throws IOException {
this.executor = new PoolExecutor(Dispatcher.class, count);
this.collect = new PoolExecutor(Reader.class, count);
this.reactor = new ExecutorReactor(collect, select);
this.allocator = allocator;
this.handler = handler;
}
示例5: ContainerSelector
import org.simpleframework.util.thread.PoolExecutor; //导入依赖的package包/类
/**
* Constructor for the <code>ContainerSelector</code> object. This is used
* to create a selector which will collect and dispatch requests using two
* thread pools. The first is used to collect the requests, the second is
* used to service those requests.
*
* @param handler
* this is the container used to service requests
* @param allocator
* this is used to allocate any buffers needed
* @param count
* this is the number of threads per thread pool
* @param select
* this is the number of selector threads to use
*/
public ContainerSelector(Container handler, Allocator allocator, int count,
int select) throws IOException {
this.executor = new PoolExecutor(Dispatcher.class, count);
this.collect = new PoolExecutor(Reader.class, count);
this.reactor = new ExecutorReactor(this.collect, select);
this.allocator = allocator;
this.handler = handler;
}
示例6: SecureNegotiator
import org.simpleframework.util.thread.PoolExecutor; //导入依赖的package包/类
/**
* Constructor for the <code>SecureNegotiator</code> object. This is used to
* create a negotiator that will perform SSL handshakes on provided
* pipelines so that the data read from an written to the underlying
* transport is complete and ready to use.
*
* @param transporter
* this is used to process the transports
* @param count
* this is the number of threads used by this
*/
public SecureNegotiator(Processor transporter, int count)
throws IOException {
this.executor = new PoolExecutor(Notifier.class, count);
this.reactor = new ExecutorReactor(this.executor);
this.transporter = transporter;
}
示例7: SecureNegotiator
import org.simpleframework.util.thread.PoolExecutor; //导入依赖的package包/类
/**
* Constructor for the <code>SecureNegotiator</code> object. This
* is used to create a negotiator that will perform SSL handshakes
* on provided pipelines so that the data read from an written to
* the underlying transport is complete and ready to use.
*
* @param processor this is used to process the transports
* @param count this is the number of threads used by this
*/
public SecureNegotiator(Processor processor, int count) throws IOException {
this.executor = new PoolExecutor(Notifier.class, count);
this.reactor = new ExecutorReactor(executor);
this.processor = processor;
}