Hi, have you used waitUntilStarted() and waitUntilStopped() methods.
Take a look at testForceBrokerRestart() test here http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/xbean/ConnectorXBeanConfigTest.java?revision=773569 it does what you are trying to achieve. If you still expirience problems, please create a test case and submit it to Jira. Cheers -- Dejan Bosanac Open Source Integration - http://fusesource.com/ ActiveMQ in Action - http://www.manning.com/snyder/ Blog - http://www.nighttale.net On Thu, May 28, 2009 at 3:13 PM, ffrenchm <ffrench.mathi...@gmail.com>wrote: > > Thanks for your answer Ruben... > > Anyway I think that the start(force) method shouldn't raise me the > following > exception : > > > 2562 [main] ERROR > > org.apache.activemq.store.kahadaptor.KahaPersistenceAdapter - Failed to > > get > > destinations > > java.io.IOException: Store has been closed. > > at > > org.apache.activemq.kaha.impl.KahaStore.initialize(KahaStore.java:460) > > I think it's a bug but I'd like to get the developer's opinion... > > ++ > > > Ruben de Gooijer-2 wrote: > > > > Hi, > > > > I experienced the same problem, > > > http://mail-archives.apache.org/mod_mbox/activemq-users/200905.mbox/%3c36e91d9d0905110857gf224b1dx3abdfdb2ce256...@mail.gmail.com%3e > > > > The solution can be found here: > > > http://cwiki.apache.org/confluence/display/ACTIVEMQ/How+do+I+restart+embedded+broker > > > > Regards, > > Ruben > > > > On Tue, May 12, 2009 at 9:06 AM, ffrenchm > > <ffrench.mathi...@gmail.com>wrote: > > > >> > >> Hello, > >> > >> I'm looking to the ActiveMQ restart methodology... Currently I saw some > >> JUnit tests in which restart are done but thanks new BrokerService > >> instantiation. My aim is to restart the broker with the same > >> instantiation. > >> IE : > >> > >> queuer = new BrokerService(); > >> queuer.start(); > >> queuer.stop(); > >> queuer.start(); > >> > >> With the bellowed code I've this exception : > >> > >> 4064 [main] ERROR org.apache.activemq.broker.BrokerService - Failed to > >> start ActiveMQ JMS Message Broker. Reason: > >> org.apache.activemq.broker.BrokerStoppedException: Broker has been > >> stopped: > >> org.apache.activemq.broker.brokerservic...@9b42e6 > >> > >> I would like to understand why I can't restart a BrokerService with the > >> same > >> instantiation ? > >> > >> Anyway I try another code : > >> queuer = new BrokerService(); > >> queuer.start(); > >> queuer.stop(); > >> queuer.start(true); > >> > >> And then I've this exception : > >> > >> 2562 [main] ERROR > >> org.apache.activemq.store.kahadaptor.KahaPersistenceAdapter - Failed to > >> get > >> destinations > >> java.io.IOException: Store has been closed. > >> at > >> org.apache.activemq.kaha.impl.KahaStore.initialize(KahaStore.java:460) > >> > >> Would like to know if it's a recommendation to follow to instanciate a > >> new > >> BrokerService before each restart or if my aim should work ? > >> > >> Thanks for all > >> > >> -- > >> View this message in context: > >> > http://www.nabble.com/ActiveMQ-native-API-problem-%3A-BrokerService.stop---BrokerService.start%28true%29-tp23505596p23505596.html > >> Sent from the ActiveMQ - User mailing list archive at Nabble.com. > >> > >> > > > > > > -- > View this message in context: > http://www.nabble.com/ActiveMQ-native-API-problem-%3A-BrokerService.stop---BrokerService.start%28true%29-tp23505596p23761498.html > Sent from the ActiveMQ - User mailing list archive at Nabble.com. > >