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


C# IRunnable.Start方法代码示例

本文整理汇总了C#中IRunnable.Start方法的典型用法代码示例。如果您正苦于以下问题:C# IRunnable.Start方法的具体用法?C# IRunnable.Start怎么用?C# IRunnable.Start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IRunnable的用法示例。


在下文中一共展示了IRunnable.Start方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateProgress

        internal override void UpdateProgress(UpdateParameters p)
		{
			if (currentRunnable == null)
			{	
				currentRunnable = runnables[currentIndex];
				currentRunnable.Start();
			}
			
			currentRunnable.Update(p);
			
			if (!currentRunnable.InProgress)
			{
				currentRunnable = null;
				currentIndex++;
				
				if (currentIndex >= runnables.Count)
				{	
					repeatsDone++;
					currentIndex -= runnables.Count;
				}
			}
		}
开发者ID:valsavva,项目名称:dynacat,代码行数:22,代码来源:XSequenceSet.cs

示例2: OnStart

        /// <summary>
        /// Fires when the windows service starts.
        /// </summary>
        /// <param name="args">The arguments passed, if any.</param>
        protected override void OnStart(string[] args)
        {
            _logger.Info("Cache Host is starting", "Cache Host is starting");

            // Configure the thread pool's minimum threads
            ThreadPool.SetMinThreads(128, 128);

            _logger.Info("Cache Host is starting", "Verifying settings");

            try
            {
                var port = CacheHostConfigurationSection.Settings.Port;

                // Configure the custom performance counter manager
                var customPerformanceCounterManager = new CustomPerformanceCounterManager(string.Format("port:{0}", port), false);

                // Initialize the mem cache container instance
                var physicalMemoryLimitPercentage = CacheHostConfigurationSection.Settings.CacheMemoryLimitPercentage;

                IMemCache memCache;
                var memoryCache = new MemCache("Dache", physicalMemoryLimitPercentage, customPerformanceCounterManager);

                if (CacheHostConfigurationSection.Settings.StorageProvider == typeof(GZipMemCache))
                {
                    memCache = new GZipMemCache(memoryCache);
                }
                else
                {
                    memCache = memoryCache;
                }

                // Initialize the tag routing table
                var tagRoutingTable = new TagRoutingTable();

                // Initialize the cache host server
                var maximumConnections = CacheHostConfigurationSection.Settings.MaximumConnections;
                var cacheHostServer = new CacheHostServer(memCache, tagRoutingTable, port, maximumConnections, 1024);

                // Initialize the cache host information poller
                var cacheHostInformationPoller = new CacheHostInformationPoller(memCache, customPerformanceCounterManager, 1000);

                // Instantiate the cache host engine
                _cacheHostEngine = new CacheHostEngine(cacheHostInformationPoller, cacheHostServer);
            }
            catch (Exception ex)
            {
                // The inner exception has the actual details of the configuration error
                if (ex.InnerException != null && ex.InnerException.Message != null && ex.InnerException.Message.StartsWith("The value for the property", StringComparison.OrdinalIgnoreCase))
                {
                    ex = ex.InnerException;
                }

                // Log the error
                _logger.Error("Cache Host failed to start", ex.Message);

                // Stop the service
                Stop();
            }

            _logger.Info("Cache Host is starting", "Settings verified successfully");

            _cacheHostEngine.Start();
        }
开发者ID:najlepejsi,项目名称:dache,代码行数:67,代码来源:CacheHostService.cs

示例3: OnStart

        /// <summary>
        /// Fires when the windows service starts.
        /// </summary>
        /// <param name="args">The arguments passed, if any.</param>
        protected override void OnStart(string[] args)
        {
            LoggerContainer.Instance.Info("Cache Host is starting", "Cache Host is starting");

            // Configure the thread pool's minimum threads
            ThreadPool.SetMinThreads(128, 128);

            LoggerContainer.Instance.Info("Cache Host is starting", "Verifying settings");

            try
            {
                // Initialize the mem cache container instance
                var physicalMemoryLimitPercentage = CacheHostConfigurationSection.Settings.CacheMemoryLimitPercentage;

                var cacheConfig = new NameValueCollection();
                cacheConfig.Add("pollingInterval", "00:00:15");
                cacheConfig.Add("physicalMemoryLimitPercentage", physicalMemoryLimitPercentage.ToString());

                var memCache = new MemCache("Dache", cacheConfig);

                // Initialize the client to cache service host
                var clientToCacheServiceHost = new ServiceHost(typeof(ClientToCacheServer));
                // Configure the client to cache service host
                var cacheHostAddress = CacheHostConfigurationSection.Settings.Address;
                var cacheHostPort = CacheHostConfigurationSection.Settings.Port;
                // Build the endpoint address
                var endpointAddress = string.Format("net.tcp://{0}:{1}/Dache/CacheHost", cacheHostAddress, cacheHostPort);
                // Build the net tcp binding
                var netTcpBinding = CreateNetTcpBinding();
                // Service throttling
                var serviceThrottling = clientToCacheServiceHost.Description.Behaviors.Find<ServiceThrottlingBehavior>();
                if (serviceThrottling == null)
                {
                    serviceThrottling = new ServiceThrottlingBehavior
                    {
                        MaxConcurrentCalls = int.MaxValue,
                        MaxConcurrentInstances = int.MaxValue,
                        MaxConcurrentSessions = int.MaxValue
                    };

                    clientToCacheServiceHost.Description.Behaviors.Add(serviceThrottling);
                }

                // Configure the service endpoint
                clientToCacheServiceHost.AddServiceEndpoint(typeof(IClientToCacheContract), netTcpBinding, endpointAddress);

                // Configure the custom performance counter manager
                var serviceHostAddress = clientToCacheServiceHost.Description.Endpoints.First().Address.Uri;
                CustomPerformanceCounterManagerContainer.Instance = new CustomPerformanceCounterManager(string.Format("{0}_{1}", serviceHostAddress.Host, serviceHostAddress.Port), false);

                // Initialize the cache host information poller
                var cacheHostInformationPoller = new CacheHostInformationPoller(1000);

                // Instantiate the cache host engine
                _cacheHostEngine = new CacheHostEngine(cacheHostInformationPoller, memCache, clientToCacheServiceHost);
            }
            catch (Exception ex)
            {
                // The inner exception has the actual details of the configuration error
                if (ex.InnerException != null && ex.InnerException.Message != null && ex.InnerException.Message.StartsWith("The value for the property", StringComparison.OrdinalIgnoreCase))
                {
                    ex = ex.InnerException;
                }

                // Log the error
                LoggerContainer.Instance.Error("Cache Host failed to start", ex.Message);

                // Stop the service
                Stop();
            }

            LoggerContainer.Instance.Info("Cache Host is starting", "Settings verified successfully");

            _cacheHostEngine.Start();
        }
开发者ID:nategreenwood,项目名称:dache,代码行数:79,代码来源:CacheHostService.cs

示例4: OnStart

        /// <summary>
        /// Fires when the windows service starts.
        /// </summary>
        /// <param name="args">The arguments passed, if any.</param>
        protected override void OnStart(string[] args)
        {
            LoggerContainer.Instance.Info("Cache Host is starting", "Cache Host is starting");

            // Configure the thread pool's minimum threads
            ThreadPool.SetMinThreads(128, 128);

            LoggerContainer.Instance.Info("Cache Host is starting", "Verifying settings");

            try
            {
                IWindsorContainer container = new Castle.Windsor.WindsorContainer();
                // Initialize the mem cache container instance
                var physicalMemoryLimitPercentage = CacheHostConfigurationSection.Settings.CacheMemoryLimitPercentage;

                var cacheConfig = new NameValueCollection();
                cacheConfig.Add("pollingInterval", "00:00:15");
                cacheConfig.Add("physicalMemoryLimitPercentage", physicalMemoryLimitPercentage.ToString());

                // Initialize the client to cache service host
                ServiceHost clientToCacheServiceHost = SetupServiceHost();
                Uri serviceHostAddress = clientToCacheServiceHost.Description.Endpoints.First().Address.Uri;
                container.Install(new MemcacheInstaller(string.Format("{0}_{1}", serviceHostAddress.Host, serviceHostAddress.Port), false));
                CustomPerformanceCounterManagerContainer.Instance = container.Resolve<CustomPerformanceCounterManager>();
                IMemCache memCache = container.Resolve<IMemCache>(new { cacheName = "Dache", cacheConfig = cacheConfig });

                // Initialize the cache host information poller
                var cacheHostInformationPoller = new CacheHostInformationPoller(1000);

                // Instantiate the cache host engine
                _cacheHostEngine = new CacheHostEngine(cacheHostInformationPoller, memCache, clientToCacheServiceHost);
            }
            catch (Exception ex)
            {
                // The inner exception has the actual details of the configuration error
                if (ex.InnerException != null && ex.InnerException.Message != null && ex.InnerException.Message.StartsWith("The value for the property", StringComparison.OrdinalIgnoreCase))
                {
                    ex = ex.InnerException;
                }

                // Log the error
                LoggerContainer.Instance.Error("Cache Host failed to start", ex.Message);

                // Stop the service
                Stop();
            }

            LoggerContainer.Instance.Info("Cache Host is starting", "Settings verified successfully");

            _cacheHostEngine.Start();
        }
开发者ID:pdoran,项目名称:dache,代码行数:55,代码来源:CacheHostService.cs


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