-
Nov 15th, 2010, 05:38 AM
#1
ShutdownNotifierComponent shutdowncause how to set back to null value
I have a question regarding this ShutdownNotifierComponent
there is this field in the ShutdownNotifierComponent.class file
/**
* When this value is null, the component is in an "open"
* state. When non-null, the component is in "closed" state, and
* this value indicates the circumstances of the shutdown.
*/
public volatile ShutdownSignalException _shutdownCause = null;
if I get an AlreadyClosedException due to a rabbitmq server crash, there is no way that I can set this _shutdownCause to null
I need to reconnect to rabbitmq and for that I overrided the method
prepareConnection(Connection con) from SingleConnectionFactory like this (the very simple case) :
@Override
protected void prepareConnection(Connection con) throws IOException {
con.addShutdownListener(new ShutdownListener(){
@Override
public void shutdownCompleted(final ShutdownSignalException cause) {
initConnection();
}
});
initConnection is the method from SingleConnectionFactory and a new connection is provided with all necessary but there is only one problem, the connection provided is AMQConnection which is ShutdownNotifierComponent and that connection will have the _shutdownCause not null,as there was a previous error so when the code needs to use this new connection provided by initConnection the isOpen() method from ShutdownNotifierComponent will return false as the _shutdownCause is not null and it seems there is no way that I can reuse the whole thing, I have to reconstruct everything from rabbitadmin to rabbittemplate, readd my listeners and redeclare all of the queues
Any advice is helpful , I am thinking to post an issue to spring amqp team.
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules