Looked at the code. Looks like the current impl expects the locker to have
achieved the lock at least once. The functionality will then restart the
broker when it loses the lock.

I guess you could implement this blocking/retry-mechanism in your
datasource#getConnection()....So when activemq tries to start up the
persistence adapter it will block there when it tries to aquire a
connection instead of just fail?

If this doesn't suit you, please open a JIRA. we can possibly broaden the
scope of retry mechanisms to include not only keepAlive scenarios.




On Mon, Jun 24, 2013 at 12:35 PM, afant <allenf...@gmail.com> wrote:

> I just tried the 5.9 nightly snapshot.  On my broker I set
> restartAllowed="true".  Then, I tried to start the broker while the
> database
> was down, and the broker still failed to start.  I saw a restart was
> triggered by the default IO exception handler, and since the database was
> still down a RuntimeException was thrown ("Failed to execute start task.
> Reason: java.lang.IllegalStateException: BeanFactory not initialized or
> already closed - call 'refresh' before accessing beans via the
> ApplicationContext....)
>
> The desired behavior would be to just continue to retry the database
> connection.  I even tried adding retryconnection parameters to mysql url
> ex:
> autoReconnect=true&amp;maxReconnects=2147483647.
>
> Thanks,
> Allen
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Retry-connection-on-broker-start-when-database-is-unavailable-tp4668329p4668528.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta

Reply via email to