public void init() { if (!initDone.get()) { // If your OS/JVM combination has a good thread model, you may want to // avoid using a thread pool to run tasks and use a DedicatedTaskRunner instead. //AMQ-6602 - lock instead of using compareAndSet to prevent threads from seeing a null value //for executorRef inside createTaskRunner() on contention and creating a DedicatedTaskRunner synchronized(this) { //need to recheck if initDone is true under the lock if (!initDone.get()) { if (dedicatedTaskRunner || "true".equalsIgnoreCase(System.getProperty("org.apache.activemq.UseDedicatedTaskRunner"))) { executorRef.set(null); } else { executorRef.compareAndSet(null, createDefaultExecutor()); } LOG.debug("Initialized TaskRunnerFactory[{}] using ExecutorService: {}", name, executorRef.get()); initDone.set(true); } } } }
public TaskRunnerFactory(String name, int priority, boolean daemon, int maxIterationsPerRun, boolean dedicatedTaskRunner) { this.name = name; this.priority = priority; this.daemon = daemon; this.maxIterationsPerRun = maxIterationsPerRun; // If your OS/JVM combination has a good thread model, you may want to // avoid // using a thread pool to run tasks and use a DedicatedTaskRunner // instead. if (dedicatedTaskRunner || "true".equalsIgnoreCase(System.getProperty("org.apache.activemq.UseDedicatedTaskRunner"))) { executor = null; } else { executor = createDefaultExecutor(); } }
public void init() { if (!initDone.get()) { // If your OS/JVM combination has a good thread model, you may want to // avoid using a thread pool to run tasks and use a DedicatedTaskRunner instead. //AMQ-6602 - lock instead of using compareAndSet to prevent threads from seeing a null value //for executorRef inside createTaskRunner() on contention and creating a DedicatedTaskRunner synchronized(this) { //need to recheck if initDone is true under the lock if (!initDone.get()) { if (dedicatedTaskRunner || "true".equalsIgnoreCase(System.getProperty("org.apache.activemq.UseDedicatedTaskRunner"))) { executorRef.set(null); } else { executorRef.compareAndSet(null, createDefaultExecutor()); } LOG.debug("Initialized TaskRunnerFactory[{}] using ExecutorService: {}", name, executorRef.get()); initDone.set(true); } } } }
public void init() { if (!initDone.get()) { // If your OS/JVM combination has a good thread model, you may want to // avoid using a thread pool to run tasks and use a DedicatedTaskRunner instead. //AMQ-6602 - lock instead of using compareAndSet to prevent threads from seeing a null value //for executorRef inside createTaskRunner() on contention and creating a DedicatedTaskRunner synchronized(this) { //need to recheck if initDone is true under the lock if (!initDone.get()) { if (dedicatedTaskRunner || "true".equalsIgnoreCase(System.getProperty("org.apache.activemq.UseDedicatedTaskRunner"))) { executorRef.set(null); } else { executorRef.compareAndSet(null, createDefaultExecutor()); } LOG.debug("Initialized TaskRunnerFactory[{}] using ExecutorService: {}", name, executorRef.get()); initDone.set(true); } } } }
public void init() { if (!initDone.get()) { // If your OS/JVM combination has a good thread model, you may want to // avoid using a thread pool to run tasks and use a DedicatedTaskRunner instead. //AMQ-6602 - lock instead of using compareAndSet to prevent threads from seeing a null value //for executorRef inside createTaskRunner() on contention and creating a DedicatedTaskRunner synchronized(this) { //need to recheck if initDone is true under the lock if (!initDone.get()) { if (dedicatedTaskRunner || "true".equalsIgnoreCase(System.getProperty("org.apache.activemq.UseDedicatedTaskRunner"))) { executorRef.set(null); } else { executorRef.compareAndSet(null, createDefaultExecutor()); } LOG.debug("Initialized TaskRunnerFactory[{}] using ExecutorService: {}", name, executorRef.get()); initDone.set(true); } } } }