You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ra...@apache.org on 2008/03/18 07:24:38 UTC
svn commit: r638233 -
/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
Author: rajdavies
Date: Mon Mar 17 23:24:37 2008
New Revision: 638233
URL: http://svn.apache.org/viewvc?rev=638233&view=rev
Log:
Use ThreadPool for starting remote services
Modified:
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java?rev=638233&r1=638232&r2=638233&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java Mon Mar 17 23:24:37 2008
@@ -79,7 +79,7 @@
public abstract class DemandForwardingBridgeSupport implements NetworkBridge {
private static final Log LOG = LogFactory.getLog(DemandForwardingBridge.class);
- private static final ThreadPoolExecutor STOP_TASKS;
+ private static final ThreadPoolExecutor ASYNC_TASKS;
protected final Transport localBroker;
protected final Transport remoteBroker;
protected final IdGenerator idGenerator = new IdGenerator();
@@ -236,7 +236,7 @@
}
protected void triggerRemoteStartBridge() throws IOException {
- Thread thead = new Thread() {
+ ASYNC_TASKS.execute(new Runnable() {
public void run() {
try {
startRemoteBridge();
@@ -244,8 +244,7 @@
serviceRemoteException(e);
}
}
- };
- thead.start();
+ });
}
protected void startLocalBridge() throws Exception {
@@ -337,7 +336,7 @@
disposed = true;
remoteBridgeStarted.set(false);
final CountDownLatch sendShutdown = new CountDownLatch(1);
- STOP_TASKS.execute(new Runnable() {
+ ASYNC_TASKS.execute(new Runnable() {
public void run() {
try {
localBroker.oneway(new ShutdownInfo());
@@ -970,7 +969,7 @@
}
static {
- STOP_TASKS = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 10, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), new ThreadFactory() {
+ ASYNC_TASKS = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 30, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), new ThreadFactory() {
public Thread newThread(Runnable runnable) {
Thread thread = new Thread(runnable, "NetworkBridge: "+runnable);
thread.setDaemon(true);