zoukankan      html  css  js  c++  java
  • Spring定时

    <!-- Spring的ScheduledTimerTimerTask定义了一个定时器任务的运行周期。应该如下装配一个ScheduledTimerTask
    timerTask告诉ScheduledTimerTask运行哪个TimerTask, 这里该装配属性指向reportTimerTask的一个引用。
    属性period告诉ScheduledTimerTask以怎样的频率调用TimerTask的run()方法。 这个属性以毫秒作为单位, 86400000指定该任务每24小时运行一次
    10X1000 属性scheduledTimerTasks 要求一个需要启动的定时器任务列表。 ScheduledTimerTask有一个delay属性,
    允许你指定当任务第一次运行之前应该等多久。 如,EmailReportTask的第一次运行延迟5毫秒 -->
    <bean id="scheduledReportTask" class="org.springframework.scheduling.timer.ScheduledTimerTask">
    <property name="timerTask">
    <ref bean="autoFlushSoftPatchStatusImpl" />
    </property>
    <!-- 10分钟轮询一次 -->
    <property name="period">
    <value>600000</value>
    </property>
    <!--5秒后开始进行轮询任务 -->
    <property name="delay">
    <value>5000</value>
    </property>
    </bean>

    <!--Spring 的TimerFactoryBean负责启动定时任务 -->
    <bean class="org.springframework.scheduling.timer.TimerFactoryBean" destroy-method="destroy">
    <property name="beanName" value="ecm-websvrswm-patchTask-timer"/>
    <property name="scheduledTimerTasks">
    <list>
    <ref bean="scheduledReportTask" />
    </list>
    </property>
    </bean>

  • 相关阅读:
    MCU 51-7 I2C Communication EEPROM
    FinalShell(免费的XShell替代品)
    Docker部署Redis
    Docker-Compose部署ELK
    Linux清空文件
    Linux防火墙的操作
    VSCode远程连接Linux服务器
    Apollo分布式配置中心
    SpringBoot整合log4j2
    MySQL区分大小写
  • 原文地址:https://www.cnblogs.com/qq1988627/p/6606875.html
Copyright © 2011-2022 走看看