@Test void testTaskExecutorCustomizer() { final AgentProperties properties = new AgentProperties(); final TaskExecutorCustomizer customizer = new AgentAutoConfiguration().taskExecutorCustomizer(properties); final ThreadPoolTaskExecutor taskExecutor = Mockito.mock(ThreadPoolTaskExecutor.class); customizer.customize(taskExecutor); Mockito.verify(taskExecutor).setWaitForTasksToCompleteOnShutdown(true); Mockito.verify(taskExecutor).setAwaitTerminationSeconds(60); }
@Bean TaskExecutorCustomizer taskExecutorCustomizer(final AgentProperties agentProperties) { return taskExecutor -> { taskExecutor.setWaitForTasksToCompleteOnShutdown(true); taskExecutor.setAwaitTerminationSeconds( (int) agentProperties.getShutdown().getSystemExecutorLeeway().getSeconds() ); }; }
AgentAutoConfiguration { @Bean TaskExecutorCustomizer taskExecutorCustomizer(final AgentProperties agentProperties) { return taskExecutor -> { taskExecutor.setWaitForTasksToCompleteOnShutdown(true); taskExecutor.setAwaitTerminationSeconds( (int) agentProperties.getShutdown().getSystemExecutorLeeway().getSeconds() ); }; } }
AgentAutoConfiguration { @Bean TaskExecutorCustomizer taskExecutorCustomizer(final AgentProperties agentProperties) { return taskExecutor -> { taskExecutor.setWaitForTasksToCompleteOnShutdown(true); taskExecutor.setAwaitTerminationSeconds( (int) agentProperties.getShutdown().getSystemExecutorLeeway().getSeconds() ); }; }  }
AgentAutoConfiguration { @Bean TaskExecutorCustomizer taskExecutorCustomizer(final AgentProperties agentProperties) { return taskExecutor -> { taskExecutor.setWaitForTasksToCompleteOnShutdown(true); taskExecutor.setAwaitTerminationSeconds( (int) agentProperties.getShutdown().getSystemExecutorLeeway().getSeconds() ); }; }  @Bean @ConditionalOnMissingBean(GenieHostInfo.class) GenieHostInfo genieAgentHostInfo(); @Bean @Lazy @ConditionalOnMissingBean(AgentMetadata.class) AgentMetadataImpl agentMetadata(final GenieHostInfo genieHostInfo); @Bean @Lazy FileLockFactory fileLockFactory(); @Bean @Lazy @ConditionalOnMissingBean(name = "sharedAgentTaskExecutor", value = AsyncTaskExecutor.class) AsyncTaskExecutor sharedAgentTaskExecutor(final AgentProperties agentProperties); @Bean @Lazy @ConditionalOnMissingBean(name = "sharedAgentTaskScheduler") TaskScheduler sharedAgentTaskScheduler(final AgentProperties agentProperties); @Bean @Lazy @ConditionalOnMissingBean(name = "heartBeatServiceTaskScheduler") TaskScheduler heartBeatServiceTaskScheduler(final AgentProperties agentProperties); }
AgentAutoConfiguration { @Bean TaskExecutorCustomizer taskExecutorCustomizer(final AgentProperties agentProperties) { return taskExecutor -> { taskExecutor.setWaitForTasksToCompleteOnShutdown(true); taskExecutor.setAwaitTerminationSeconds( (int) agentProperties.getShutdown().getSystemExecutorLeeway().getSeconds() ); }; }  @Bean @ConditionalOnMissingBean(GenieHostInfo.class) GenieHostInfo genieAgentHostInfo(); @Bean @Lazy @ConditionalOnMissingBean(AgentMetadata.class) AgentMetadataImpl agentMetadata(final GenieHostInfo genieHostInfo); @Bean @Lazy FileLockFactory fileLockFactory(); @Bean @Lazy @ConditionalOnMissingBean(name = "sharedAgentTaskExecutor", value = AsyncTaskExecutor.class) AsyncTaskExecutor sharedAgentTaskExecutor(final AgentProperties agentProperties); @Bean @Lazy @ConditionalOnMissingBean(name = "sharedAgentTaskScheduler") TaskScheduler sharedAgentTaskScheduler(final AgentProperties agentProperties); @Bean @Lazy @ConditionalOnMissingBean(name = "heartBeatServiceTaskScheduler") TaskScheduler heartBeatServiceTaskScheduler(final AgentProperties agentProperties);  }