草庐IT

bk_schedule

全部标签

java - 如果在某个固定时间后挂起,则停止 Spring Scheduled 执行

我使用SpringFramework的Scheduled来安排我的作业使用cron每5分钟运行一次。但有时我的工作会无限等待外部资源,我不能在那里设置超时。我不能使用fixedDelay因为以前的进程有时会进入无限等待模式,我必须每5分钟刷新一次数据。所以我在SpringFramework的Scheduled中寻找任何选项,以在fixed-time成功或不成功运行之后停止该进程/线程。我发现下面的设置为我放入@Configuration类的keepAliveTime初始化了120秒的ThreadPoolExecutor。谁能告诉我这会按我的预期工作吗?@Bean(destroyMeth

spring - Spring 怎么样 <task :scheduled> objects represented at runtime?

我有一个应用程序使用“task:scheduler”和“task:scheduled-tasks”元素(后者包含“task:scheduled”元素)。这一切都很好。我正在尝试编写一些内省(introspection)“应用程序配置”的代码,以获取一些重要信息的简短摘要,例如计划了哪些任务以及它们的计划是什么。我已经有一个包含一堆“@Autowired”实例变量的类,所以我可以遍历所有这些。添加一个“列表”来获取所有TaskScheduler对象很容易。我只有其中两个,而且每个都有不同的计划任务集。我在那些TaskScheduler对象(它们实际上是ThreadPoolTask​​Sc

spring - Spring 怎么样 <task :scheduled> objects represented at runtime?

我有一个应用程序使用“task:scheduler”和“task:scheduled-tasks”元素(后者包含“task:scheduled”元素)。这一切都很好。我正在尝试编写一些内省(introspection)“应用程序配置”的代码,以获取一些重要信息的简短摘要,例如计划了哪些任务以及它们的计划是什么。我已经有一个包含一堆“@Autowired”实例变量的类,所以我可以遍历所有这些。添加一个“列表”来获取所有TaskScheduler对象很容易。我只有其中两个,而且每个都有不同的计划任务集。我在那些TaskScheduler对象(它们实际上是ThreadPoolTask​​Sc

Spring ThreadPoolTask​​Scheduler vs ThreadPoolTask​​Executor

在Springdocumentation中提到那:ThreadPoolTaskScheduleractuallyimplementsSpring'sTaskExecutorinterfaceaswell,sothatasingleinstancecanbeusedforasynchronousexecutionassoonaspossibleaswellasscheduled,andpotentiallyrecurring,executions.那么我们希望在哪些场景中使用ThreadPoolTask​​Executor实例而不是ThreadPoolTask​​Scheduler实例?

Spring ThreadPoolTask​​Scheduler vs ThreadPoolTask​​Executor

在Springdocumentation中提到那:ThreadPoolTaskScheduleractuallyimplementsSpring'sTaskExecutorinterfaceaswell,sothatasingleinstancecanbeusedforasynchronousexecutionassoonaspossibleaswellasscheduled,andpotentiallyrecurring,executions.那么我们希望在哪些场景中使用ThreadPoolTask​​Executor实例而不是ThreadPoolTask​​Scheduler实例?

java - Spring @Scheduler 并行运行

我有以下3个类(class):组件Apackagemytest.spring.test.spring;importorg.apache.log4j.Logger;importorg.springframework.scheduling.annotation.Scheduled;importorg.springframework.stereotype.Component;@ComponentpublicclassComponentA{Loggerlog=Logger.getLogger(ComponentB.class);@Scheduled(fixedRate=2000)publicv

java - Spring @Scheduler 并行运行

我有以下3个类(class):组件Apackagemytest.spring.test.spring;importorg.apache.log4j.Logger;importorg.springframework.scheduling.annotation.Scheduled;importorg.springframework.stereotype.Component;@ComponentpublicclassComponentA{Loggerlog=Logger.getLogger(ComponentB.class);@Scheduled(fixedRate=2000)publicv

Python 扭曲 : how to schedule?

在Twisted中有1天的经验,我尝试安排消息发送以回复tcp客户端:importos,sys,timefromtwisted.internetimportprotocol,reactorself.scenario=[(1,"Messageafter1sec!"),(4,"Thisafter4secs"),(2,"Endfinalafter2secs")]fortimeout,datainself.scenario:reactor.callLater(timeout,self.sendata,data)print"waited%dtime,sent%s\n"%(timeout,data

spring - Spring 3.2 "@Scheduled"注释的异常处理

如何自定义@Scheduled的异常处理Spring的注释?我有将在服务器(Tomcat6)中触发的Cron作业,当发生任何异常时,我需要进行一些处理。Spring版3.2Tomcat服务器6 最佳答案 如果你想使用JavaConfig,你需要创建实现SchedulingConfigurer的配置@EnableScheduling@ConfigurationclassSchedulingConfigurationimplementsSchedulingConfigurer{privatefinalLoggerlogger=Logge

spring - Spring 3.2 "@Scheduled"注释的异常处理

如何自定义@Scheduled的异常处理Spring的注释?我有将在服务器(Tomcat6)中触发的Cron作业,当发生任何异常时,我需要进行一些处理。Spring版3.2Tomcat服务器6 最佳答案 如果你想使用JavaConfig,你需要创建实现SchedulingConfigurer的配置@EnableScheduling@ConfigurationclassSchedulingConfigurationimplementsSchedulingConfigurer{privatefinalLoggerlogger=Logge