You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ke...@apache.org on 2010/07/09 21:57:26 UTC
svn commit: r962672 - in /geronimo/server/branches/2.2/plugins/activemq:
activemq-broker/src/main/plan/plan.xml
geronimo-activemq/src/main/java/org/apache/geronimo/activemq/BrokerServiceGBeanImpl.java
Author: kevan
Date: Fri Jul 9 19:57:26 2010
New Revision: 962672
URL: http://svn.apache.org/viewvc?rev=962672&view=rev
Log:
GERONIMO-5444 add asyncStartupDelay (default 3 seconds)
Modified:
geronimo/server/branches/2.2/plugins/activemq/activemq-broker/src/main/plan/plan.xml
geronimo/server/branches/2.2/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/BrokerServiceGBeanImpl.java
Modified: geronimo/server/branches/2.2/plugins/activemq/activemq-broker/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/activemq/activemq-broker/src/main/plan/plan.xml?rev=962672&r1=962671&r2=962672&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/activemq/activemq-broker/src/main/plan/plan.xml (original)
+++ geronimo/server/branches/2.2/plugins/activemq/activemq-broker/src/main/plan/plan.xml Fri Jul 9 19:57:26 2010
@@ -29,6 +29,7 @@
<attribute name="amqConfigFile">conf/activemq.xml</attribute>
<attribute name="useShutdownHook">false</attribute>
<attribute name="asyncStartup">false</attribute>
+ <attribute name="asyncStartupDelay">3</attribute>
<!--reference name="dataSource">
<name>NoTxDatasource</name>
</reference-->
Modified: geronimo/server/branches/2.2/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/BrokerServiceGBeanImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/BrokerServiceGBeanImpl.java?rev=962672&r1=962671&r2=962672&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/BrokerServiceGBeanImpl.java (original)
+++ geronimo/server/branches/2.2/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/BrokerServiceGBeanImpl.java Fri Jul 9 19:57:26 2010
@@ -20,6 +20,8 @@ package org.apache.geronimo.activemq;
import java.io.File;
import java.net.URI;
import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
import javax.jms.JMSException;
@@ -54,6 +56,8 @@ public class BrokerServiceGBeanImpl impl
private final String objectName;
private final BrokerService brokerService;
private final boolean asyncStartup;
+ private final int asyncStartupDelay;
+ private final CountDownLatch asyncStarted = new CountDownLatch(1);
private final AtomicBoolean active = new AtomicBoolean(false);
private Thread asyncStartThread;
private JMSManager manager;
@@ -64,6 +68,7 @@ public class BrokerServiceGBeanImpl impl
@ParamAttribute (name="amqConfigFile") String amqConfigFile,
@ParamAttribute (name="useShutdownHook") boolean useShutdownHook,
@ParamAttribute (name="asyncStartup") boolean asyncStartup,
+ @ParamAttribute (name="asyncStartupDelay") int asyncStartupDelay,
@ParamReference (name="ServerInfo") ServerInfo serverInfo,
@ParamReference (name="MBeanServerReference") MBeanServerReference mbeanServerReference,
@ParamSpecial (type= SpecialAttributeType.objectName) String objectName,
@@ -72,6 +77,7 @@ public class BrokerServiceGBeanImpl impl
this.objectName = objectName;
this.asyncStartup = asyncStartup;
+ this.asyncStartupDelay = asyncStartupDelay;
URI baseDir = serverInfo.resolveServer(amqBaseDir);
URI dataDir = baseDir.resolve(amqDataDir);
URI amqConfigUri = baseDir.resolve(amqConfigFile);
@@ -127,6 +133,7 @@ public class BrokerServiceGBeanImpl impl
}, "AsyncStartThread-" + getBrokerName());
asyncStartThread.setDaemon(true);
asyncStartThread.start();
+ asyncStarted.await(asyncStartupDelay, TimeUnit.SECONDS);
}
}
@@ -160,6 +167,7 @@ public class BrokerServiceGBeanImpl impl
try {
brokerService.start();
log.info("brokerService started");
+ asyncStarted.countDown();
brokerService.waitUntilStopped();
if (active.get()) {
log.warn("brokerService stopped");