• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ShutdownEventArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ShutdownEventArgs的典型用法代码示例。如果您正苦于以下问题:C# ShutdownEventArgs类的具体用法?C# ShutdownEventArgs怎么用?C# ShutdownEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ShutdownEventArgs类属于命名空间,在下文中一共展示了ShutdownEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: OnConnectionShutdown

        // You will note there are two practically identical overloads
        // of OnShutdown() here. This is because Microsoft's C#
        // compilers do not consistently support the Liskov
        // substitutability principle. When I use
        // OnShutdown(object,ShutdownEventArgs), the compilers
        // complain that OnShutdown can't be placed into a
        // ConnectionShutdownEventHandler because object doesn't
        // "match" IConnection, even though there's no context in
        // which the program could Go Wrong were it to accept the
        // code. The same problem appears for
        // ModelShutdownEventHandler. The .NET 1.1 compiler complains
        // about these two cases, and the .NET 2.0 compiler does not -
        // presumably they improved the type checker with the new
        // release of the compiler.

        public virtual void OnConnectionShutdown(object sender, ShutdownEventArgs reason)
        {
            m_cell.Value = reason;
        }
开发者ID:hanxinimm,项目名称:rabbitmq-dotnet-client,代码行数:19,代码来源:ShutdownContinuation.cs


示例17: OnModelShutdown

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


示例18: OnSessionShutdown

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


示例19: HandleSessionShutdown

 public void HandleSessionShutdown(object sender, ShutdownEventArgs reason)
 {
     lock (m_sessionMap)
     {
         var session = (ISession) sender;
         m_sessionMap.Remove(session.ChannelNumber);
         Ints.Free(session.ChannelNumber);
         CheckAutoClose();
     }
 }
开发者ID:hanxinimm,项目名称:rabbitmq-dotnet-client,代码行数:10,代码来源:SessionManager.cs


示例20: SetCloseReason

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ShutdownReason类代码示例发布时间:2022-05-24
下一篇:
C# ShowShop类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap