本文整理汇总了Java中org.threadly.concurrent.wrapper.KeyDistributedExecutor类的典型用法代码示例。如果您正苦于以下问题:Java KeyDistributedExecutor类的具体用法?Java KeyDistributedExecutor怎么用?Java KeyDistributedExecutor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
KeyDistributedExecutor类属于org.threadly.concurrent.wrapper包,在下文中一共展示了KeyDistributedExecutor类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ThreadedSocketExecuter
import org.threadly.concurrent.wrapper.KeyDistributedExecutor; //导入依赖的package包/类
/**
* <p>Creates a ThreadedSocketExecuter with different max task cycle and Selector Thread defaults.</p>
*
* @param scheduler the {@link SubmitterScheduler} to be used for client/server callbacks.
* @param maxTasksPerCycle the max number of tasks to run on a clients thread before returning the thread back to the pool.
* @param numberOfSelectors the number of selector threads to run. Default is core/2.
*/
public ThreadedSocketExecuter(final SubmitterScheduler scheduler, final int maxTasksPerCycle, final int numberOfSelectors) {
super(scheduler);
int ps = -1;
if(numberOfSelectors == -1) {
ps = Runtime.getRuntime().availableProcessors()/2;
} else {
ps = numberOfSelectors;
}
clientSelectors = new SelectorThread[ps];
clientDistributer = new KeyDistributedExecutor(schedulerPool, maxTasksPerCycle);
this.selectors = ps;
}
示例2: KeyDistributedSchedulerExecuteUnfairExecutorBenchmark
import org.threadly.concurrent.wrapper.KeyDistributedExecutor; //导入依赖的package包/类
public KeyDistributedSchedulerExecuteUnfairExecutorBenchmark(int threadRunTime, int poolSize) {
super(threadRunTime);
originalExecutor = new UnfairExecutor(poolSize);
keyScheduler = new KeyDistributedExecutor(originalExecutor);
scheduler = new ExecutorSchedulerAdapter((task) -> keyScheduler.getExecutorForKey(new Object())
.execute(task));
}
开发者ID:threadly,项目名称:threadly_benchmarks,代码行数:9,代码来源:KeyDistributedSchedulerExecuteUnfairExecutorBenchmark.java
示例3: KeyDistributedExecutorUniqueKeyUnfairExecutorBenchmark
import org.threadly.concurrent.wrapper.KeyDistributedExecutor; //导入依赖的package包/类
public KeyDistributedExecutorUniqueKeyUnfairExecutorBenchmark(int submitterQty) {
this.submitterQty = submitterQty;
scheduler = new UnfairExecutor((submitterQty * 2) + 1);
distributor = new KeyDistributedExecutor(scheduler);
lastRunnable = new AtomicReferenceArray<DistributorRunnable>(submitterQty);
}
开发者ID:threadly,项目名称:threadly_benchmarks,代码行数:7,代码来源:KeyDistributedExecutorUniqueKeyUnfairExecutorBenchmark.java
示例4: DefaultExecutorListenerHelper
import org.threadly.concurrent.wrapper.KeyDistributedExecutor; //导入依赖的package包/类
/**
* Constructs a new {@link DefaultExecutorListenerHelper} that will handle listeners with the
* provided interface. The provided class MUST be an interface. If any listeners are not
* provided an executor, they will execute on the provided executor.
*
* @param listenerInterface Interface that listeners need to implement
* @param executor Executor to execute listeners which were not provided one by default
*/
public DefaultExecutorListenerHelper(Class<? super T> listenerInterface, Executor executor) {
super(listenerInterface);
taskDistributor = new KeyDistributedExecutor(executor);
}
示例5: DefaultExecutorRunnableListenerHelper
import org.threadly.concurrent.wrapper.KeyDistributedExecutor; //导入依赖的package包/类
/**
* Constructs a new {@link DefaultExecutorRunnableListenerHelper}. If any listeners are not
* provided an executor, they will execute on the provided executor.
*
* @param callListenersOnce {@code true} if listeners should only be called once
* @param executor {@link Executor} to execute listeners which were not provided one by default
*/
public DefaultExecutorRunnableListenerHelper(boolean callListenersOnce, Executor executor) {
super(callListenersOnce);
taskDistributor = new KeyDistributedExecutor(executor);
}