Search in sources :

Example 1 with CheckerNoHoldThreadLocal

use of concurrent.checker.CheckerNoHoldThreadLocal 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);
    }
}
Also used : ConcurrentCheckerNoHoldInvoker(concurrent.checker.invoker.no_hold.ConcurrentCheckerNoHoldInvoker) CheckerNoHoldThreadLocal(concurrent.checker.CheckerNoHoldThreadLocal) Action(common.datastore.action.Action) ConcurrentCheckerUsingHoldInvoker(concurrent.checker.invoker.using_hold.ConcurrentCheckerUsingHoldInvoker) CheckerCommonObj(concurrent.checker.invoker.CheckerCommonObj) SingleCheckerNoHoldInvoker(concurrent.checker.invoker.no_hold.SingleCheckerNoHoldInvoker) CheckerUsingHoldThreadLocal(concurrent.checker.CheckerUsingHoldThreadLocal) SingleCheckerUsingHoldInvoker(concurrent.checker.invoker.using_hold.SingleCheckerUsingHoldInvoker)

Aggregations

Action (common.datastore.action.Action)1 CheckerNoHoldThreadLocal (concurrent.checker.CheckerNoHoldThreadLocal)1 CheckerUsingHoldThreadLocal (concurrent.checker.CheckerUsingHoldThreadLocal)1 CheckerCommonObj (concurrent.checker.invoker.CheckerCommonObj)1 ConcurrentCheckerNoHoldInvoker (concurrent.checker.invoker.no_hold.ConcurrentCheckerNoHoldInvoker)1 SingleCheckerNoHoldInvoker (concurrent.checker.invoker.no_hold.SingleCheckerNoHoldInvoker)1 ConcurrentCheckerUsingHoldInvoker (concurrent.checker.invoker.using_hold.ConcurrentCheckerUsingHoldInvoker)1 SingleCheckerUsingHoldInvoker (concurrent.checker.invoker.using_hold.SingleCheckerUsingHoldInvoker)1