服務器配置熱更新


服務器配置熱更新

Keywords: 配置,熱更新

此功能能夠允許你在不重啟服務器的前提下更新服務器實例的配置。 (僅限1.6.5及其以上版本)

支持熱更新的服務器實例配置選項

SuperSocket 支持以下配置選項的熱更新:

* logCommand
* idleSessionTimeOut
* maxRequestLength
* logBasicSessionActivity
* logAllSocketException

SuperSocket 支持所有自定義配置屬性和自定義配置子節點的熱更新。

下面的代碼將演示如何讓你的自定義配置支持熱更新:

public class PushServer : AppServer
{
    private int m_Interval;

    protected override bool Setup(IRootConfig rootConfig, IServerConfig config)
    {
        RegisterConfigHandler(config, "pushInterval", (value) =>
            {
                // the code in this scope will be executed automatically
                // after the configuration attribute "pushInterval" is changed

                var interval = 0;
                int.TryParse(value, out interval);

                if (interval <= 0)
                    interval = 60;// 60 seconds by default

                m_Interval = interval * 1000;
                return true;
            });

        return true;
    }

    /// Other code
}

你可以在QuickStart中的 PushServer 項目中找到此更能的完整示例代碼。

 

© 2018 - GetDocs.Net - Hosted by BuyVM


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM