public override void Start() { _forkJoinThreadPool = new ForkJoinPool(); _config.enabledBoltConnectors().ForEach(connector => { BoltScheduler boltScheduler = new ExecutorBoltScheduler(connector.key(), _executorFactory, _scheduler, _logService, _config.get(connector.thread_pool_min_size), _config.get(connector.thread_pool_max_size), _config.get(connector.thread_pool_keep_alive), _config.get(connector.unsupported_thread_pool_queue_size), _forkJoinThreadPool); boltScheduler.Start(); _boltSchedulers[connector.key()] = boltScheduler; }); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void initShouldCreateThreadPool() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void InitShouldCreateThreadPool() { ExecutorFactory mockExecutorFactory = mock(typeof(ExecutorFactory)); when(mockExecutorFactory.Create(anyInt(), anyInt(), any(), anyInt(), anyBoolean(), any())).thenReturn(Executors.newCachedThreadPool()); ExecutorBoltScheduler scheduler = new ExecutorBoltScheduler(CONNECTOR_KEY, mockExecutorFactory, _jobScheduler, _logService, 0, 10, Duration.ofMinutes(1), 0, ForkJoinPool.commonPool()); scheduler.Start(); verify(_jobScheduler).threadFactory(Group.BOLT_WORKER); verify(mockExecutorFactory, times(1)).create(anyInt(), anyInt(), any(typeof(Duration)), anyInt(), anyBoolean(), any(typeof(ThreadFactory))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shutdownShouldTerminateThreadPool() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShutdownShouldTerminateThreadPool() { ExecutorService cachedThreadPool = Executors.newCachedThreadPool(); ExecutorFactory mockExecutorFactory = mock(typeof(ExecutorFactory)); when(mockExecutorFactory.Create(anyInt(), anyInt(), any(), anyInt(), anyBoolean(), any())).thenReturn(cachedThreadPool); ExecutorBoltScheduler scheduler = new ExecutorBoltScheduler(CONNECTOR_KEY, mockExecutorFactory, _jobScheduler, _logService, 0, 10, Duration.ofMinutes(1), 0, ForkJoinPool.commonPool()); scheduler.Start(); scheduler.Stop(); assertTrue(cachedThreadPool.Shutdown); }