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("***************************定时任务执行完成***************************");
    }
    }

  • 相关阅读:
    耐性4/21
    吃枸杞上火4/11
    metro style app 的程序构成 以c# 为例 GIS
    ListView 和 GridView ————转 GIS
    最大程度地利用像素,适应视图状态的变更___转 GIS
    metro style 里面的控件一览 以 Windows.UI.Xaml.Controls空间 GIS
    Windows 8里的标准化输入 GIS
    漫游应用程序数据 GIS
    FlipView 知识准备 GIS
    Data Binding Notifications绑定通知 GIS
  • 原文地址:https://www.cnblogs.com/ConfidentLiu/p/9841920.html
Copyright © 2011-2022 走看看