当前位置: 首页>>代码示例>>C#>>正文


C# ShutdownEventArgs类代码示例

本文整理汇总了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;
 }
开发者ID:hanxinimm,项目名称:rabbitmq-dotnet-client,代码行数:9,代码来源:OperationInterruptedException.cs

示例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;
 }
开发者ID:jkff,项目名称:rabbitmq-dotnet-client,代码行数:9,代码来源:OperationInterruptedException.cs

示例3: Shutdown

 private static void Shutdown(ShutdownEventArgs args)
 {
     if (Server != null)
     {
         Server.Stop();
     }         
 }
开发者ID:FreeReign,项目名称:imaginenation,代码行数:7,代码来源:HttpServer.cs

示例4: EventSink_Shutdown

 public static void EventSink_Shutdown(ShutdownEventArgs e)
 {
     try
     {
         World.Broadcast(0x35, true, "The server has shut down.");
     }
     catch
     {
     }
 }
开发者ID:Crome696,项目名称:ServUO,代码行数:10,代码来源:Broadcasts.cs

示例5: AlreadyClosedException

 ///<summary>Construct an instance containing the given
 ///shutdown reason.</summary>
 public AlreadyClosedException(ShutdownEventArgs reason)
     : base(reason)
 {
 }
开发者ID:pooleja,项目名称:rabbitmq-dotnet-client,代码行数:6,代码来源:AlreadyClosedException.cs

示例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();
        }
开发者ID:rabbitmq,项目名称:rabbitmq-dotnet-client,代码行数:15,代码来源:Connection.cs

示例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();
            }
        }
开发者ID:rabbitmq,项目名称:rabbitmq-dotnet-client,代码行数:82,代码来源:Connection.cs

示例8: SetCloseReason

 public bool SetCloseReason(ShutdownEventArgs reason)
 {
     lock (m_eventLock)
     {
         if (m_closeReason == null)
         {
             m_closeReason = reason;
             return true;
         }
         else
         {
             return false;
         }
     }
 }
开发者ID:rabbitmq,项目名称:rabbitmq-dotnet-client,代码行数:15,代码来源:Connection.cs

示例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);
 }
开发者ID:rabbitmq,项目名称:rabbitmq-dotnet-client,代码行数:7,代码来源:AutorecoveringConnection.cs

示例10: OnModelShutdown

 public virtual void OnModelShutdown(ShutdownEventArgs reason)
 {
     m_delegate.OnModelShutdown(reason);
 }
开发者ID:ru-sh,项目名称:rabbitmq-dotnet-client,代码行数:4,代码来源:AutorecoveringModel.cs

示例11: Close

 public void Close(ShutdownEventArgs reason, bool abort)
 {
     try
     {
         m_delegate.Close(reason, abort);
     }
     finally
     {
         m_connection.UnregisterModel(this);
     }
 }
开发者ID:ru-sh,项目名称:rabbitmq-dotnet-client,代码行数:11,代码来源:AutorecoveringModel.cs

示例12: HandleModelShutdown

 public virtual void HandleModelShutdown(ShutdownEventArgs reason)
 {
     m_cell.Value = Either.Right(reason);
 }
开发者ID:hanxinimm,项目名称:rabbitmq-dotnet-client,代码行数:4,代码来源:SimpleBlockingRpcContinuation.cs

示例13: InvokeShutdown

		public static void InvokeShutdown(ShutdownEventArgs e) {
			if (Shutdown != null)
				Shutdown(e);
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:4,代码来源:Events.cs

示例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;
 }
开发者ID:rabbitmq,项目名称:rabbitmq-dotnet-client,代码行数:25,代码来源:ModelBase.cs

示例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.
     }
 }
开发者ID:rabbitmq,项目名称:rabbitmq-dotnet-client,代码行数:27,代码来源:ModelBase.cs


注:本文中的ShutdownEventArgs类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。