<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Michael,<div><br></div><div>On 15 May 2013, at 21:51, Michael Klishin wrote:</div><div><div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">I'm investigating an issue report for Langohr:<div><div><a href="https://github.com/michaelklishin/langohr/issues/16#issuecomment-17964559">https://github.com/michaelklishin/langohr/issues/16#issuecomment-17964559</a><br>
</div><div><br></div><div style="">and not entirely sure when SignalShutdownException#isInitiatedByApplication</div><div style="">returns true and if it can really be used to tell a clean shutdown (e.g. when you</div><div style="">
voluntarily close channels).</div><div style=""><br></div></div></div></blockquote><div><br></div><div>That property will evaluate to true whenever the source of the shutdown originated in the client application, whether by deliberate closure or application error. So I'm not sure that you can differentiate based on that properly alone. Certainly the property will always be set to true when a channel is deliberately closed by the application, via a call to #close() or #waitForConfirmsOrDie and so on. However the comment at <a href="https://github.com/michaelklishin/langohr/issues/16#issuecomment-17964103">https://github.com/michaelklishin/langohr/issues/16#issuecomment-17964103</a> is correct, in that an exception in the consumer code will still set #isInitiatedByApplication to true.</div><div><br></div><div>So IMO, even when #isInitiatedByApplication is true, we should probably make it easier to determine whether a channel close was a deliberate action or the result of an application error. I'll file a bug for that.</div><br><blockquote type="cite"><div dir="ltr"><div><div style="">What's the recommended way to detect network errors</div></div></div></blockquote><div><br></div><div>For these, #isInitiatedByApplication will be false. You can also look at the exception tucked away in #getReason to determine this, at least to some extent.</div><br><blockquote type="cite"><div dir="ltr"><div><div style="">, channel AND consumer-level exceptions vs clean termination?</div></div></div></blockquote><div><br></div><div>There is no clean way to do this atm afaict - I think Ian Eure's analysis is correct and the the only way to differentiate between the two right now would be to "go spelunking through the object tree looking for the text 'Closed due to exception'" in Exception#getMessage. As I said, we'll fix that.</div><div><br></div><div>Cheers,</div><div>Tim</div></div></div></body></html>