I have a spring based JAX-RS/Jetty Servlet that also starts an embedded
ActiveMQ broker.

For unit tests, I am using Jetty.  Sometimes an error occurs and Jetty
restarts.  When this happens, I get the following:

11:36:12,136 INFO  [12882...@qtp0-3] broker.BrokerService
(BrokerService.java:454) - Using Persistence Adapter:
AMQPersistenceAdapter(activemq\data)
11:36:12,136 INFO  [12882...@qtp0-3] amq.AMQPersistenceAdapter
(AMQPersistenceAdapter.java:175) - AMQStore starting using directory:
activemq\data
11:36:12,261 INFO  [12882...@qtp0-3] impl.KahaStore (KahaStore.java:475) -
Kaha Store using data directory activemq\data\kr-store\state
11:36:12,386 INFO  [12882...@qtp0-3] amq.AMQPersistenceAdapter
(AMQPersistenceAdapter.java:233) - Active data files: [1]
11:36:12,543 INFO  [12882...@qtp0-3] broker.BrokerService
(BrokerService.java:577) - ActiveMQ null JMS Message Broker (localhost) is
starting
11:36:12,543 INFO  [12882...@qtp0-3] broker.BrokerService
(BrokerService.java:578) - For help or more information please see:
http://activemq.apache.org/
[INFO] Restart completed at Mon Jan 12 11:36:12 EST 2009
11:36:12,777 INFO  [12882...@qtp0-3] impl.KahaStore (KahaStore.java:475) -
Kaha Store using data directory activemq\data\kr-store\data
11:36:12,902 INFO  [12882...@qtp0-3] transport.TransportServerThreadSupport
(TransportServerThreadSupport.java:72) - Listening for connections at:
tcp://AN5885:61616
11:36:12,902 INFO  [12882...@qtp0-3] broker.TransportConnector
(TransportConnector.java:252) - Connector openwire Started
11:36:12,918 INFO  [12882...@qtp0-3] broker.BrokerService
(BrokerService.java:488) - ActiveMQ JMS Message Broker (localhost,
ID:AN5885-4253-1231778172605-0:0) started
11:36:14,199 INFO  [32788...@qtp0-4] support.AbstractApplicationContext
(AbstractApplicationContext.java:412) - Refreshing
org.apache.xbean.spring.context.resourcexmlapplicationcont...@152d950:
display name
[org.apache.xbean.spring.context.resourcexmlapplicationcont...@152d950];
startup date [Mon Jan 12 11:36:14 EST 2009]; parent:
org.springframework.context.support.classpathxmlapplicationcont...@f65b5b
11:36:14,214 INFO  [32788...@qtp0-4] xml.XmlBeanDefinitionReader
(XmlBeanDefinitionReader.java:323) - Loading XML bean definitions from class
path resource [activemq.xml]
11:36:14,402 INFO  [32788...@qtp0-4] support.AbstractApplicationContext
(AbstractApplicationContext.java:427) - Bean factory for application context
[org.apache.xbean.spring.context.resourcexmlapplicationcont...@152d950]:
org.springframework.beans.factory.support.defaultlistablebeanfact...@92ed85
11:36:14,511 INFO  [32788...@qtp0-4] broker.BrokerService
(BrokerService.java:454) - Using Persistence Adapter:
AMQPersistenceAdapter(activemq\data)
11:36:14,511 WARN  [32788...@qtp0-4] amq.AMQPersistenceAdapter
(AMQPersistenceAdapter.java:1013) - Waiting to Lock the Store activemq\data

After the server restart -- AMQPersistenceAdapter is stuck waiting on a lock
-- the lock that it previously obtained and presumably left in a locked
state on the file system.

I'm sure I likely have an anti-pattern here, but what is the recommended way
to fix this?  I'm trying to figure out how to safely bootstrap the embedded
activemq broker when the servlet starts -- as a singleton...and then if an
error occurs in the server, how to safely destroy/restart the broker?  Is
there a recommended way to do this?
-- 
View this message in context: 
http://www.nabble.com/livelock-AMQPersistenceAdapter-tp21418331p21418331.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to