當前位置: 首頁>>代碼示例>>Java>>正文


Java KeyDistributedExecutor類代碼示例

本文整理匯總了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;
}
 
開發者ID:threadly,項目名稱:litesockets,代碼行數:20,代碼來源:ThreadedSocketExecuter.java

示例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);
}
 
開發者ID:threadly,項目名稱:threadly,代碼行數:14,代碼來源:DefaultExecutorListenerHelper.java

示例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);
}
 
開發者ID:threadly,項目名稱:threadly,代碼行數:13,代碼來源:DefaultExecutorRunnableListenerHelper.java


注:本文中的org.threadly.concurrent.wrapper.KeyDistributedExecutor類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。