brudo commented on pull request #59:
URL: https://github.com/apache/activemq-nms-amqp/pull/59#issuecomment-824271798


   I tried to see if I could understand this better, including digging into 
AmqpNetLite. In FailoverProvider, the underlying provider and its listener are 
cleared before calling provider.Close(), while Amqp.AmqpObject.NotifyClosed 
protects against calling back more than once from the same instance, so it's 
probably safe from triggering a second call to HandleProviderError there.
   
   In any case my initial approach with adding a call to Task.Run may be more 
heavy-handed than it needed to be, and might be in the wrong place for all we 
know. I notice there is not a single Task.Run, other than the one I added, and 
the ones in the tests.
   
   One approach that doesn't use Task.Run might be something like this: have a 
dedicated background thread, that waits for a manual reset event that is set 
when a reconnect is required. I don't know if that is better, though. It 
guarantees only one reconnect at a time, and doesn't tie up a thread from the 
thread pool, and doesn't require blocking the AsyncPump, but uses a kernel 
handle and an idle thread per failover provider instance.
   
   The next step though should be to come up with a test that confirms the 
issue... hopefully the test will point to the right way to fix it, and if it's 
a quick fix that stands up to review, then perhaps it will make it into the 2.0 
release. I'll be looking into that this afternoon.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to