Esempio n. 1
0
        internal Connection(OnCommandRecieved commandRecieved, OnServerLost serverLost, Logs logs, PerfStatsCollector perfStatsCollector,ResponseIntegrator rspIntegraotr, string bindIP)
        {
            _commandRecieved = commandRecieved;
            _serverLost = serverLost;
            _logger = logs;
            _responseIntegrator = rspIntegraotr;

            _perfStatsColl = perfStatsCollector;

            SetBindIP(bindIP);
            if (System.Configuration.ConfigurationSettings.AppSettings["EnableNaggling"] != null)
                _nagglingEnabled = Convert.ToBoolean(System.Configuration.ConfigurationSettings.AppSettings["EnableNaggling"]);

            //read the naggling size from app.config and covert it to bytes.
            if (System.Configuration.ConfigurationSettings.AppSettings["NagglingSize"] != null)
                _nagglingSize = 1024 * Convert.ToInt64(System.Configuration.ConfigurationSettings.AppSettings["NagglingSize"]);

            if (System.Configuration.ConfigurationSettings.AppSettings["EnableDualSockets"] != null)
                _supportDualSocket = Convert.ToBoolean(System.Configuration.ConfigurationSettings.AppSettings["EnableDualSockets"]);
        }
Esempio n. 2
0
        private Broker(RemoteCache cache, bool importHashMap, PerfStatsCollector2 perfStatsColl,
            CacheInitParams initParams)
        {
            _bulkEventCallback = new WaitCallback(RaiseBulkEvent);
            this._clientConfig = new ClientConfiguration(cache.CacheId, initParams);
            this._cache = cache;
            this._balanceNode = _clientConfig.BalanceNodes;
            this._importHashmap = _clientConfig.ImportHashmap;

            this._operationTimeout = _clientConfig.Timeout;
            this._connectionTimeout = _clientConfig.ConnectionTimeout;
            this._connectionRetries = _clientConfig.ConnectionRetries;
            this._retryInterval = _clientConfig.RetryInterval;

            this._retryConnnectionDelay = _clientConfig.RetryConnectionDelay;
            this._retryConnectionDelayInMinutes = Convert.ToDouble(_retryConnnectionDelay)/60000;
                //Conversion to minutes from milliseconds;
            _perfStatsColl2 = perfStatsColl;

            int pid = System.Diagnostics.Process.GetCurrentProcess().Id;
            string instanceName = "Client." + cache.CacheId + "." + pid;

            if (_perfStatsColl == null || !_perfStatsColl.InstanceName.Equals(instanceName))
            {
                _perfStatsColl = new PerfStatsCollector(instanceName, 0);
            }

            this._commandReieved = new OnCommandRecieved(CommandReceived);
            this._serverLost = new OnServerLost(ServerLost);
            this._requestTable = Hashtable.Synchronized(new Hashtable(10000, 0.75f));
            this._pool = new ConnectionPool();
        }