zoukankan      html  css  js  c++  java
  • java中的定时器

    1:Timer 最底层定时器

    转载:https://blog.csdn.net/zbx931197485/article/details/78721847

    转载:https://blog.csdn.net/mazegong/article/details/77743805

    2:spring 框架中使用的其他三种定时工具

    转载:https://blog.csdn.net/lchq1995/article/details/78222528

    (1):spring task spring自带定时器使用实例:

          转载:https://www.cnblogs.com/Jason-Xiang/p/6593329.html

                   在applicationContext中配置:      

    <!-- 配置定时任务 -->
    <task:annotation-driven scheduler="qbScheduler" mode="proxy"/>
    <task:scheduler id="qbScheduler" pool-size="10"/>

    (2):

    package com.webservice.enquiryControler;


    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.scheduling.annotation.Scheduled;
    import org.springframework.stereotype.Component;

    import com.webservice.dao.enquiryDao.PriceDao;
    import com.webservice.util.TimeHelp;

    @Component
    public class SchedulerDemo {

    @Autowired
    PriceDao PriceDao;
    /*
    *
    * 定时任务*/
    @Scheduled(cron="0 */10 * * * ?")
    public void job(){

    String setTime=TimeHelp.SetCurrentTime();//比当前时间少11分钟

    String time = TimeHelp.getCurrentTime();//当前时间
    // System.out.println("***************************第"+count+"次定时任务正在执行***************************");
    // System.out.println("***************************开始时间:"+setTime+"****结束时间:"+time+"***************************");
    PriceDao.job(setTime,time);
    // System.out.println("***************************定时任务执行完成***************************");
    }
    }

  • 相关阅读:
    Delphi 字符串操作
    SQL Browser (数据浏览器)
    .NET 3.5和VS 2008中的ASP.NET AJAX(转帖)
    delphi 最快速编码 URLDecode URLEncode
    Delphi 2007 如何安装控件
    Delphi TWebBrowser编程简述(转帖)
    delphi TStringList的用法
    Javascript+xmlhttp调用Webservice以及注意事项
    使用VSS 的Shadow folder的一点问题
    delphi 如何将XML格式的字符串导入ClientDataSet中
  • 原文地址:https://www.cnblogs.com/ConfidentLiu/p/9841920.html
Copyright © 2011-2022 走看看