use of concurrent.checker.invoker.using_hold.ConcurrentCheckerUsingHoldInvoker in project solution-finder by knewjade.
the class PercentCore method createConcurrentCheckerInvoker.
/**
* Pass null to ExecutorService if executing on single thread
*/
private ConcurrentCheckerInvoker createConcurrentCheckerInvoker(ExecutorService executorService, ThreadLocal<Candidate<Action>> candidateThreadLocal, boolean isUsingHold, ThreadLocal<? extends Reachable> reachableThreadLocal, MinoFactory minoFactory) {
if (isUsingHold) {
CheckerUsingHoldThreadLocal<Action> checkerThreadLocal = new CheckerUsingHoldThreadLocal<>();
CheckerCommonObj commonObj = new CheckerCommonObj(minoFactory, candidateThreadLocal, checkerThreadLocal, reachableThreadLocal);
if (executorService == null)
return new SingleCheckerUsingHoldInvoker(commonObj);
return new ConcurrentCheckerUsingHoldInvoker(executorService, commonObj);
} else {
CheckerNoHoldThreadLocal<Action> checkerThreadLocal = new CheckerNoHoldThreadLocal<>();
CheckerCommonObj commonObj = new CheckerCommonObj(minoFactory, candidateThreadLocal, checkerThreadLocal, reachableThreadLocal);
if (executorService == null)
return new SingleCheckerNoHoldInvoker(commonObj);
return new ConcurrentCheckerNoHoldInvoker(executorService, commonObj);
}
}
Aggregations