public void Close(ushort replyCode, string replyText, bool abort) { ShutdownContinuation k = new ShutdownContinuation(); ModelShutdown += new ModelShutdownEventHandler(k.OnShutdown); try { if (SetCloseReason(new ShutdownEventArgs(ShutdownInitiator.Application, replyCode, replyText))) { _Private_ChannelClose(replyCode, replyText, 0, 0); } k.Wait(); } catch (AlreadyClosedException ace) { if (!abort) { throw ace; } } catch (IOException ioe) { if (!abort) { throw ioe; } } }
public void Close(ShutdownEventArgs reason, bool abort) { ShutdownContinuation k = new ShutdownContinuation(); ModelShutdown += new ModelShutdownEventHandler(k.OnShutdown); try { if (SetCloseReason(reason)) { _Private_ChannelClose(reason.ReplyCode, reason.ReplyText, 0, 0); } k.Wait(); } catch (AlreadyClosedException ace) { if (!abort) throw ace; } catch (IOException ioe) { if (!abort) throw ioe; } }
public void Close(ShutdownEventArgs reason, bool abort) { var k = new ShutdownContinuation(); ModelShutdown += k.OnConnectionShutdown; try { ConsumerDispatcher.Quiesce(); if (SetCloseReason(reason)) { _Private_ChannelClose(reason.ReplyCode, reason.ReplyText, 0, 0); } k.Wait(TimeSpan.FromMilliseconds(10000)); ConsumerDispatcher.Shutdown(this); } catch (AlreadyClosedException) { if (!abort) { throw; } } catch (IOException) { if (!abort) { throw; } } catch (Exception) { if (!abort) { throw; } } }