ForkJoinDispatcher - custom multi-threaded dispatcher that runs on top of a Helios.Concurrency.DedicatedThreadPool, designed to be used for mission-critical actors that can't afford ThreadPool starvation. Relevant configuration options: my-forkjoin-dispatcher{ type = ForkJoinDispatcher throughput = 100 dedicated-thread-pool{ #settings for Helios.DedicatedThreadPool thread-count = 3 #number of threads #deadlock-timeout = 3s #optional timeout for deadlock detection threadtype = background #values can be "background" or "foreground" } }
Inheritance: MessageDispatcher
コード例 #1
0
        public ForkJoinDispatcherConfigurator(Config config, IDispatcherPrerequisites prerequisites) : base(config, prerequisites)
        {
            var dtp = config.GetConfig("dedicated-thread-pool");
            if (dtp == null || dtp.IsEmpty) throw new ConfigurationException(string.Format("must define section dedicated-thread-pool for ForkJoinDispatcher {0}", config.GetString("id", "unknown")));

            var settings = new DedicatedThreadPoolSettings(dtp.GetInt("thread-count"), 
                DedicatedThreadPoolConfigHelpers.ConfigureThreadType(dtp.GetString("threadtype", ThreadType.Background.ToString())),
                config.GetString("id"),
                DedicatedThreadPoolConfigHelpers.GetSafeDeadlockTimeout(dtp));
            _instance = new ForkJoinDispatcher(this, settings);
        }
コード例 #2
0
        public ForkJoinDispatcherConfigurator(Config config, IDispatcherPrerequisites prerequisites) : base(config, prerequisites)
        {
            var dtp = config.GetConfig("dedicated-thread-pool");

            if (dtp == null || dtp.IsEmpty)
            {
                throw new ConfigurationException(string.Format("must define section dedicated-thread-pool for ForkJoinDispatcher {0}", config.GetString("id", "unknown")));
            }

            var settings = new DedicatedThreadPoolSettings(dtp.GetInt("thread-count"),
                                                           DedicatedThreadPoolConfigHelpers.ConfigureThreadType(dtp.GetString("threadtype", ThreadType.Background.ToString())),
                                                           DedicatedThreadPoolConfigHelpers.GetSafeDeadlockTimeout(dtp));

            _instance = new ForkJoinDispatcher(this, settings);
        }