@Test void testTaskSchedulerCustomizer() { final AgentProperties properties = new AgentProperties(); final TaskSchedulerCustomizer customizer = new AgentAutoConfiguration().taskSchedulerCustomizer(properties); final ThreadPoolTaskScheduler taskScheduler = Mockito.mock(ThreadPoolTaskScheduler.class); customizer.customize(taskScheduler); Mockito.verify(taskScheduler).setWaitForTasksToCompleteOnShutdown(true); Mockito.verify(taskScheduler).setAwaitTerminationSeconds(60); }
@Bean TaskSchedulerCustomizer taskSchedulerCustomizer(final AgentProperties agentProperties) { return taskScheduler -> { taskScheduler.setWaitForTasksToCompleteOnShutdown(true); taskScheduler.setAwaitTerminationSeconds( (int) agentProperties.getShutdown().getSystemSchedulerLeeway().getSeconds() ); }; }
AgentAutoConfiguration { @Bean TaskSchedulerCustomizer taskSchedulerCustomizer(final AgentProperties agentProperties) { return taskScheduler -> { taskScheduler.setWaitForTasksToCompleteOnShutdown(true); taskScheduler.setAwaitTerminationSeconds( (int) agentProperties.getShutdown().getSystemSchedulerLeeway().getSeconds() ); }; } }
AgentAutoConfiguration { @Bean TaskSchedulerCustomizer taskSchedulerCustomizer(final AgentProperties agentProperties) { return taskScheduler -> { taskScheduler.setWaitForTasksToCompleteOnShutdown(true); taskScheduler.setAwaitTerminationSeconds( (int) agentProperties.getShutdown().getSystemSchedulerLeeway().getSeconds() ); }; }  }
AgentAutoConfiguration { @Bean TaskSchedulerCustomizer taskSchedulerCustomizer(final AgentProperties agentProperties) { return taskScheduler -> { taskScheduler.setWaitForTasksToCompleteOnShutdown(true); taskScheduler.setAwaitTerminationSeconds( (int) agentProperties.getShutdown().getSystemSchedulerLeeway().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 TaskSchedulerCustomizer taskSchedulerCustomizer(final AgentProperties agentProperties) { return taskScheduler -> { taskScheduler.setWaitForTasksToCompleteOnShutdown(true); taskScheduler.setAwaitTerminationSeconds( (int) agentProperties.getShutdown().getSystemSchedulerLeeway().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);  }