made the join ability of the transport configurable so that we don't have to wait for each transport to complete

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@380683 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2006-02-24 15:08:40 +00:00
parent 7130f43c8f
commit 00d07b7783
1 changed files with 17 additions and 1 deletions

View File

@ -38,6 +38,7 @@ public abstract class TransportServerThreadSupport extends TransportServerSuppor
private AtomicBoolean started = new AtomicBoolean(false); private AtomicBoolean started = new AtomicBoolean(false);
private AtomicBoolean closing = new AtomicBoolean(false); private AtomicBoolean closing = new AtomicBoolean(false);
private boolean daemon = true; private boolean daemon = true;
private boolean joinOnStop = true;
private Thread runner; private Thread runner;
public TransportServerThreadSupport() { public TransportServerThreadSupport() {
@ -67,7 +68,7 @@ public abstract class TransportServerThreadSupport extends TransportServerSuppor
catch (Exception e) { catch (Exception e) {
stopper.onException(this, e); stopper.onException(this, e);
} }
if (runner != null) { if (runner != null && joinOnStop) {
runner.join(); runner.join();
runner = null; runner = null;
} }
@ -97,9 +98,24 @@ public abstract class TransportServerThreadSupport extends TransportServerSuppor
return daemon; return daemon;
} }
/**
* Sets whether the background read thread is a daemon thread or not
*/
public void setDaemon(boolean daemon) { public void setDaemon(boolean daemon) {
this.daemon = daemon; this.daemon = daemon;
} }
public boolean isJoinOnStop() {
return joinOnStop;
}
/**
* Sets whether the background read thread is joined with (waited for) on a stop
*/
public void setJoinOnStop(boolean joinOnStop) {
this.joinOnStop = joinOnStop;
}
protected abstract void doStop(ServiceStopper stopper) throws Exception; protected abstract void doStop(ServiceStopper stopper) throws Exception;
} }