示例#1
0
        /// <summary>
        /// Reads the client.ncconf to set the parameters user has not provided values for.
        /// If the client.ncconf is not found or the values for some parameters are not set in client.ncconf,
        /// then default values are set for such parameters.
        /// </summary>
        internal void Initialize(string cacheId)
        {
            bool useDefault = false;

            Web.RemoteClient.Config.ClientConfiguration config = new Web.RemoteClient.Config.ClientConfiguration(cacheId);
            int retries = 3;

            while (true)
            {
                try
                {
                    config.LoadConfiguration();
                    break;
                }
                catch (Exception ie)
                {
                    if (--retries == 0)
                    {
                        useDefault = true;
                        break;
                    }
                    System.Threading.Thread.Sleep(500);
                }
            }

            if (!useDefault)
            {
                if (!IsSet(OPTIMEOUT))
                {
                    this._opTimeout = config.Timeout;
                }
                if (!IsSet(CONNECTIONTIMEOUT))
                {
                    this._connectionTimeout = config.ConnectionTimeout;
                }
                if (!IsSet(CONNECTIONRETRIES))
                {
                    this._connectionRetries = config.ConnectionRetries;
                }
                if (!IsSet(RETRYINTERVAL))
                {
                    this._retryInterval = config.RetryInterval;
                }
                if (!IsSet(RETRYCONNECTIONDELAY))
                {
                    this._retryConnectionDelay = config.RetryConnectionDelay;                               //[KS]
                }
                if (!IsSet(BINDIP))
                {
                    this._bindIP = config.BindIP;
                }
                if (!IsSet(PORT))
                {
                    this._port = config.ServerPort;
                }
                if (!IsSet(LOADBALANCE))
                {
                    this._balanceNodes = config.BalanceNodes;
                }
            }
        }
示例#2
0
        /// <summary>
        /// Reads the client.ncconf to set the parameters user has not provided values for.
        /// If the client.ncconf is not found or the values for some parameters are not set in client.ncconf,
        /// then default values are set for such parameters.
        /// </summary>
        internal void Initialize(string cacheId)
        {
            bool useDefault = false;
            Web.RemoteClient.Config.ClientConfiguration config = new Web.RemoteClient.Config.ClientConfiguration(cacheId);
            int retries = 3;
            while(true)
            {
                try
                {
                    config.LoadConfiguration();
                    break;
                }
                catch (Exception ie)
                {
                    if (--retries == 0)
                    {
                        useDefault = true;
                        break;
                    }
                    System.Threading.Thread.Sleep(500);
                }
            }

            if (!useDefault)
            {
                if (!IsSet(OPTIMEOUT)) this._opTimeout = config.Timeout;
                if (!IsSet(CONNECTIONTIMEOUT)) this._connectionTimeout = config.ConnectionTimeout;
                if (!IsSet(CONNECTIONRETRIES)) this._connectionRetries = config.ConnectionRetries;
                if (!IsSet(RETRYINTERVAL)) this._retryInterval = config.RetryInterval;
                if (!IsSet(RETRYCONNECTIONDELAY)) this._retryConnectionDelay = config.RetryConnectionDelay; //[KS]
                if (!IsSet(BINDIP)) this._bindIP =config.BindIP;
                if (!IsSet(PORT)) this._port = config.ServerPort;
                if (!IsSet(LOADBALANCE)) this._balanceNodes = config.BalanceNodes;
            }
        }