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;
     });
 }
Exemplo n.º 2
0
//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)));
        }
Exemplo n.º 3
0
//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);
        }
 private void InitializeInstanceFields()
 {
     _logService      = new SimpleLogService(_logProvider, _logProvider);
     _executorFactory = new NotifyingThreadPoolFactory(this);
     _boltScheduler   = new ExecutorBoltScheduler(CONNECTOR_KEY, _executorFactory, _jobScheduler, _logService, MAX_POOL_SIZE, MAX_POOL_SIZE, Duration.ofMinutes(1), 0, ForkJoinPool.commonPool());
 }
Exemplo n.º 5
0
 private void InitializeInstanceFields()
 {
     _logService    = new SimpleLogService(_logProvider);
     _boltScheduler = new ExecutorBoltScheduler(CONNECTOR_KEY, _executorFactory, _jobScheduler, _logService, 0, 10, Duration.ofMinutes(1), 0, ForkJoinPool.commonPool());
 }