本文整理汇总了C#中ShutdownEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# ShutdownEventArgs类的具体用法?C# ShutdownEventArgs怎么用?C# ShutdownEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ShutdownEventArgs类属于命名空间,在下文中一共展示了ShutdownEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OperationInterruptedException
///<summary>Construct an OperationInterruptedException with
///the passed-in explanation and prefix, if any.</summary>
public OperationInterruptedException(ShutdownEventArgs reason, String prefix)
: base(reason == null ? (prefix + ": The AMQP operation was interrupted") :
string.Format("{0}: The AMQP operation was interrupted: {1}",
prefix, reason))
{
ShutdownReason = reason;
}
示例2: OperationInterruptedException
///<summary>Construct an OperationInterruptedException with
///the passed-in explanation, if any.</summary>
public OperationInterruptedException(ShutdownEventArgs reason)
: base(reason == null ? "The AMQP operation was interrupted" :
string.Format("The AMQP operation was interrupted: {0}",
reason))
{
m_shutdownReason = reason;
}
示例3: Shutdown
private static void Shutdown(ShutdownEventArgs args)
{
if (Server != null)
{
Server.Stop();
}
}
示例4: EventSink_Shutdown
public static void EventSink_Shutdown(ShutdownEventArgs e)
{
try
{
World.Broadcast(0x35, true, "The server has shut down.");
}
catch
{
}
}
示例5: AlreadyClosedException
///<summary>Construct an instance containing the given
///shutdown reason.</summary>
public AlreadyClosedException(ShutdownEventArgs reason)
: base(reason)
{
}
示例6: InternalClose
public void InternalClose(ShutdownEventArgs reason)
{
if (!SetCloseReason(reason))
{
if (m_closed)
{
throw new AlreadyClosedException(m_closeReason);
}
// We are quiescing, but still allow for server-close
}
OnShutdown();
m_session0.SetSessionClosing(true);
TerminateMainloop();
}
示例7: Close
///<summary>Try to close connection in a graceful way</summary>
///<remarks>
///<para>
///Shutdown reason contains code and text assigned when closing the connection,
///as well as the information about what initiated the close
///</para>
///<para>
///Abort flag, if true, signals to close the ongoing connection immediately
///and do not report any errors if it was already closed.
///</para>
///<para>
///Timeout determines how much time internal close operations should be given
///to complete. Negative or Timeout.Infinite value mean infinity.
///</para>
///</remarks>
public void Close(ShutdownEventArgs reason, bool abort, int timeout)
{
if (!SetCloseReason(reason))
{
if (!abort)
{
throw new AlreadyClosedException(m_closeReason);
}
}
else
{
OnShutdown();
m_session0.SetSessionClosing(false);
try
{
// Try to send connection.close
// Wait for CloseOk in the MainLoop
m_session0.Transmit(ConnectionCloseWrapper(reason.ReplyCode,
reason.ReplyText));
}
catch (AlreadyClosedException ace)
{
if (!abort)
{
throw ace;
}
}
#pragma warning disable 0168
catch (NotSupportedException nse)
{
// buffered stream had unread data in it and Flush()
// was called, ignore to not confuse the user
}
#pragma warning restore 0168
catch (IOException ioe)
{
if (m_model0.CloseReason == null)
{
if (!abort)
{
throw ioe;
}
else
{
LogCloseError("Couldn't close connection cleanly. "
+ "Socket closed unexpectedly", ioe);
}
}
}
finally
{
TerminateMainloop();
}
}
#if NETFX_CORE
var receivedSignal = m_appContinuation.WaitOne(BlockingCell.validatedTimeout(timeout));
#else
var receivedSignal = m_appContinuation.WaitOne(BlockingCell.validatedTimeout(timeout));
#endif
if (!receivedSignal)
{
m_frameHandler.Close();
}
}
示例8: SetCloseReason
public bool SetCloseReason(ShutdownEventArgs reason)
{
lock (m_eventLock)
{
if (m_closeReason == null)
{
m_closeReason = reason;
return true;
}
else
{
return false;
}
}
}
示例9: ShouldTriggerConnectionRecovery
protected bool ShouldTriggerConnectionRecovery(ShutdownEventArgs args)
{
return (args.Initiator == ShutdownInitiator.Peer ||
// happens when EOF is reached, e.g. due to RabbitMQ node
// connectivity loss or abrupt shutdown
args.Initiator == ShutdownInitiator.Library);
}
示例10: OnModelShutdown
public virtual void OnModelShutdown(ShutdownEventArgs reason)
{
m_delegate.OnModelShutdown(reason);
}
示例11: Close
public void Close(ShutdownEventArgs reason, bool abort)
{
try
{
m_delegate.Close(reason, abort);
}
finally
{
m_connection.UnregisterModel(this);
}
}
示例12: HandleModelShutdown
public virtual void HandleModelShutdown(ShutdownEventArgs reason)
{
m_cell.Value = Either.Right(reason);
}
示例13: InvokeShutdown
public static void InvokeShutdown(ShutdownEventArgs e) {
if (Shutdown != null)
Shutdown(e);
}
示例14: HandleConnectionStart
public void HandleConnectionStart(byte versionMajor,
byte versionMinor,
IDictionary<string, object> serverProperties,
byte[] mechanisms,
byte[] locales)
{
if (m_connectionStartCell == null)
{
var reason =
new ShutdownEventArgs(ShutdownInitiator.Library,
Constants.CommandInvalid,
"Unexpected Connection.Start");
((Connection)Session.Connection).Close(reason);
}
var details = new ConnectionStartDetails
{
m_versionMajor = versionMajor,
m_versionMinor = versionMinor,
m_serverProperties = serverProperties,
m_mechanisms = mechanisms,
m_locales = locales
};
m_connectionStartCell.Value = details;
m_connectionStartCell = null;
}
示例15: HandleConnectionClose
public void HandleConnectionClose(ushort replyCode,
string replyText,
ushort classId,
ushort methodId)
{
var reason = new ShutdownEventArgs(ShutdownInitiator.Peer,
replyCode,
replyText,
classId,
methodId);
try
{
((Connection)Session.Connection).InternalClose(reason);
_Private_ConnectionCloseOk();
SetCloseReason((Session.Connection).CloseReason);
}
catch (IOException)
{
// Ignored. We're only trying to be polite by sending
// the close-ok, after all.
}
catch (AlreadyClosedException)
{
// Ignored. We're only trying to be polite by sending
// the close-ok, after all.
}
}