ARTEMIS-482 Assign dedicated ThreadPool for InVMTransport
This commit is contained in:
parent
5678d1ad2b
commit
fc8a1eff43
|
@ -22,11 +22,17 @@ import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.concurrent.ConcurrentMap;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.SynchronousQueue;
|
||||||
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.apache.activemq.artemis.api.core.ActiveMQException;
|
import org.apache.activemq.artemis.api.core.ActiveMQException;
|
||||||
|
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
|
||||||
import org.apache.activemq.artemis.core.server.ActiveMQComponent;
|
import org.apache.activemq.artemis.core.server.ActiveMQComponent;
|
||||||
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
|
|
||||||
import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle;
|
import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle;
|
||||||
|
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
|
||||||
import org.apache.activemq.artemis.spi.core.remoting.AbstractConnector;
|
import org.apache.activemq.artemis.spi.core.remoting.AbstractConnector;
|
||||||
import org.apache.activemq.artemis.spi.core.remoting.Acceptor;
|
import org.apache.activemq.artemis.spi.core.remoting.Acceptor;
|
||||||
import org.apache.activemq.artemis.spi.core.remoting.BaseConnectionLifeCycleListener;
|
import org.apache.activemq.artemis.spi.core.remoting.BaseConnectionLifeCycleListener;
|
||||||
|
@ -86,6 +92,20 @@ public class InVMConnector extends AbstractConnector {
|
||||||
|
|
||||||
private final Executor closeExecutor;
|
private final Executor closeExecutor;
|
||||||
|
|
||||||
|
private static ExecutorService threadPoolExecutor;
|
||||||
|
|
||||||
|
private static ExecutorService getInVMExecutor() {
|
||||||
|
if (threadPoolExecutor == null) {
|
||||||
|
if (ActiveMQClient.globalThreadMaxPoolSize <= -1) {
|
||||||
|
threadPoolExecutor = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), Executors.defaultThreadFactory());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
threadPoolExecutor = Executors.newFixedThreadPool(ActiveMQClient.globalThreadMaxPoolSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return threadPoolExecutor;
|
||||||
|
}
|
||||||
|
|
||||||
public InVMConnector(final Map<String, Object> configuration,
|
public InVMConnector(final Map<String, Object> configuration,
|
||||||
final BufferHandler handler,
|
final BufferHandler handler,
|
||||||
final ClientConnectionLifeCycleListener listener,
|
final ClientConnectionLifeCycleListener listener,
|
||||||
|
@ -101,7 +121,7 @@ public class InVMConnector extends AbstractConnector {
|
||||||
|
|
||||||
this.closeExecutor = closeExecutor;
|
this.closeExecutor = closeExecutor;
|
||||||
|
|
||||||
executorFactory = new OrderedExecutorFactory(threadPool);
|
executorFactory = new OrderedExecutorFactory(getInVMExecutor());
|
||||||
|
|
||||||
InVMRegistry registry = InVMRegistry.instance;
|
InVMRegistry registry = InVMRegistry.instance;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue