Esempio n. 1
0
        public void init(ChannelConfig channelConfig)
        {
            var executorPool = new ExecutorPool();

            executorPool.CreateMessageExecutor();
            init(channelConfig, executorPool, new MultithreadEventLoopGroup());
        }
Esempio n. 2
0
        public void init(ChannelConfig channelConfig, ExecutorPool executorPool, IEventLoopGroup eventLoopGroup)
        {
            if (channelConfig.UseConvChannel)
            {
                var convIndex = 0;
                if (channelConfig.Crc32Check)
                {
                    convIndex += Ukcp.HEADER_CRC;
                }
                if (channelConfig.FecDataShardCount != 0 && channelConfig.FecParityShardCount != 0)
                {
                    convIndex += Fec.fecHeaderSizePlus2;
                }
                _channelManager = new ClientConvChannelManager(convIndex);
            }
            else
            {
                _channelManager = new ClientEndPointChannelManager();
            }

            //初始化线程池 创建一个线程就够了
            _executorPool = executorPool;
            _executorPool.CreateMessageExecutor();
            _eventLoopGroup = eventLoopGroup;

            bootstrap = new Bootstrap();
            bootstrap.Group(_eventLoopGroup);
            bootstrap.ChannelFactory(() => new SocketDatagramChannel(AddressFamily.InterNetwork));
            bootstrap.Handler(new ActionChannelInitializer <SocketDatagramChannel>(channel =>
            {
                var pipeline = channel.Pipeline;
                pipeline.AddLast(new ClientChannelHandler(_channelManager, channelConfig));
            }));
        }
 public AuthoringRunnerServiceHandler(IStaticLoader loader, ExecutorPool pool, IHostApplicationLifetime lifetime)
 {
     this._pool    = pool;
     this.lifetime = lifetime;
     this._loader  = loader;
     _stepRegistry = loader.GetStepRegistry();
     this.InitializeMessageProcessors();
 }
Esempio n. 4
0
 public ExecutableRunnerServiceHandler(IActivatorWrapper activationWrapper, IReflectionWrapper reflectionWrapper,
                                       IAssemblyLoader assemblyLoader, IStaticLoader loader, ExecutorPool pool, IHostApplicationLifetime lifetime)
     : base(loader, pool, lifetime)
 {
     this._activatorWrapper  = activationWrapper;
     this._reflectionWrapper = reflectionWrapper;
     this._assemblyLoader    = assemblyLoader;
     _stepRegistry           = assemblyLoader.GetStepRegistry();
     InitializeExecutionMessageHandlers();
 }