亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? cron.java

?? jcrontab是一個定時器開源項目包 目前提供存取文件或數據庫, 把執行結果寄發 email, 簡單地設置在 Tomcat, Resin, Jetty 及 JBoss 之上, 更是可以取代 cron
?? JAVA
字號:
/** *  This file is part of the jcrontab package *  Copyright (C) 2001-2003 Israel Olalla * *  This library is free software; you can redistribute it and/or *  modify it under the terms of the GNU Lesser General Public *  License as published by the Free Software Foundation; either *  version 2 of the License, or (at your option) any later version. * *  This library is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU *  Lesser General Public License for more details. * *  You should have received a copy of the GNU Lesser General Public *  License along with this library; if not, write to the Free *  Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, *  MA 02111-1307, USA * *  For questions, suggestions: * *  iolalla@yahoo.com * */ package org.jcrontab;import java.util.Calendar;import java.util.Date;import java.util.Properties;import java.util.Vector;import org.jcrontab.data.CalendarBuilder;import org.jcrontab.data.CrontabEntryBean;import org.jcrontab.data.CrontabEntryDAO;import org.jcrontab.data.DataNotFoundException;import org.jcrontab.log.Log;/**  * This class represents the Thread that loads the information from the DAO's * and maintains the list of events to execute by the Crontab. * @author $Author: iolalla $ * @version $Revision: 1.56 $ */public class Cron extends Thread {		private static boolean shouldRun = true;	    private static final String GENERATE_TIMETABLE_EVENT = "gen_timetable";	    private Crontab crontab;	    private int iFrec;	    private static int minute = 60000;	    public static Properties prop = null;        private static CrontabBean[] eventsQueue;	    private static CrontabEntryBean[] crontabEntryArray = null;        private static CalendarBuilder calb = null;    /**     * Used to lookup the time this class was loaded in the System object. Value is     * the fully qualified classname + ".load-time"     * @see #myClassLoadTime     */    private static final String LOAD_TIME_PROPERTY = Cron.class.getName() + ".load-time";    /**     * This is a mechanism to avoid multiple instances of this _class_ being loaded     * at the same time. In some environments, like Weblogic for instance, an     * application can be reloaded at run time.     *     * By remembering the value when the class is instantiated and comparing it to     * the current value from System.getProperty({@link #LOAD_TIME_PROPERTY})     * we can determine whether the class has been reloaded.     *     * The {@link #run}() method needs to check {@link #isClassReloaded} to see     * whether it should continue processing.     *     * @see #LOAD_TIME_PROPERTY     * @see #isClassReloaded     */    private long myClassLoadTime;    /**     * This method gets called every time the class is loaded. By setting the time     * this happened in a System property (rather than a static variable) then we     * can spot this happening.     * @see #myClassLoadTime     */    static {        System.setProperty(LOAD_TIME_PROPERTY, String.valueOf(System.currentTimeMillis()));    }    /**     * Constructor of a Cron. This one doesn't receive any parameters to make      * it easier to build an instance of Cron     */    public Cron() {        // Remember the time the class was loaded.        this.myClassLoadTime = Long.parseLong(System.getProperty(LOAD_TIME_PROPERTY));        crontab = Crontab.getInstance();        iFrec = 3600;        calb = new CalendarBuilder();    }    /**     * Constructor of a Cron     * @param cront Crontab The  Crontab that the cron must call to generate     * new tasks     * @param iTimeTableGenerationFrec int Frecuency of generation of new time table      * entries.     */    public Cron(Crontab cront, int iTimeTableGenerationFrec) {        // Remember the time the class was loaded.        this.myClassLoadTime = Long.parseLong(System.getProperty(LOAD_TIME_PROPERTY));        crontab = cront;        iFrec = iTimeTableGenerationFrec * 60;    }    /**     * Checks whether this class has been reloaded since this instance was instantiated.     *     * @return true if the class has been reloaded, false if all is okay     */    private boolean isClassReloaded() {        if (this.myClassLoadTime != Long.parseLong(System.getProperty(LOAD_TIME_PROPERTY))) {            Log.info("This class has been reloaded, so I am a runaway daemon. Canceling.");            return true;        } else {            return false;        }    }    /**     * Runs the Cron Thread. This method is the method called by the crontab	 * class. this method is inherited from Thread Class     */        public void run() {		// this counter is used to save array`s position        int counter = 0;        try {			// Waits until the next minute to begin       		// waitNextMinute();        	// Generates events list       		generateEvents();        } catch (Exception e) {            Log.error(e.toString(), e);        }        // Infinite loop, this thread will stop when the jvm is stopped         // shouldRun tells the system if should stop at some moment.        while(shouldRun) {			// The event...            CrontabBean nextEv = eventsQueue[counter];                        long intervalToSleep = nextEv.getTime() - System.currentTimeMillis();            // System.out.println("intervalToSleep :" + intervalToSleep);            if(intervalToSleep > 0) {                // Waits until the next event                try {                    synchronized(this) {                        Log.debug("Interval to sleep : " + intervalToSleep );                        wait(intervalToSleep);                    }                } catch(InterruptedException e) {                    // Waits until the next minute to begin                    // waitNextMinute();                    // Generates events list                    generateEvents();                    // Continues loop                    continue;                }            }			// it's incremented here to mantain array reference.            counter++;            // If it is a generate time table event, does it.            if(nextEv.getClassName().equals(GENERATE_TIMETABLE_EVENT)) {				// Generates events list                generateEvents();				// reinitialized the array				counter=0;            }            // Else, then tell the crontab to create the new task            else {                crontab.newTask(nextEv.getClassName(), nextEv.getMethodName(), 				nextEv.getExtraInfo());            }        }    }	/** 	 *	This method waits until the next minute to synxhonize the Cron 	 * activity eith the system clock     * @deprecated	 */    private void waitNextMinute() {        // Waits until the next minute        long tmp = System.currentTimeMillis();        long intervalToSleep;		// If modulus different to 0 then should wait the interval        // if(tmp % minute != 0) {            // long intervalToSleep = ((((long)(tmp / minute))+1) * minute) - tmp;            // Waits until the next minute            if (crontabEntryArray != null) {            CrontabEntryBean nextCeb = calb.getNextCrontabEntry(crontabEntryArray);            intervalToSleep = calb.buildCalendar(nextCeb).getTime();            } else {            intervalToSleep = ((((long)(tmp / minute))+1) * minute) - tmp;            }            try {                synchronized(this) {                    Log.debug("this is the interval to sleep : " + intervalToSleep);                    wait(intervalToSleep);                }            } catch(InterruptedException e) {                // Waits again (recursivity?)                waitNextMinute();            }        //}    }   /**    * Tell The system that should stop 	* @return CrontabEntryBean[] the resultant array of CrontabEntryBean    * @throws Exception     */   public static void stopInTheNextMinute() {	   shouldRun = false;   }      /**    * Loads the CrontabEntryBeans from the DAO	* @return CrontabEntryBean[] the resultant array of CrontabEntryBean    * @throws Exception     */   private static CrontabEntryBean[] readCrontab() throws Exception {       crontabEntryArray = CrontabEntryDAO.getInstance().findAll();       return crontabEntryArray;   }       /**     * Generates new time table entries (for new events).     * IN fact this method does more or less everything, this method tells the     * DAO to look for CrontabEntryArray, generates the CrontabBeans and puts     * itself as the last event to generate again the list of events. Nice     * Method. :-)     */    public void generateEvents() {		// This loads the info from the DAO        try {		          crontabEntryArray = null;				  crontabEntryArray = readCrontab();	    // This Vector is created cause don't know how big is the list 	    // of events             Vector lista1 = new Vector();            // Rounds the calendar to the previous minute            Calendar cal = Calendar.getInstance();            cal.setTime(new Date((System.currentTimeMillis())));			   for(int i=0; i<iFrec; i++) {					for(int j=0; j<crontabEntryArray.length; j++) {						if(crontabEntryArray[j].equals(cal) && shouldRunToday(crontabEntryArray[j].getBusinessDays())) {								CrontabBean ev = new CrontabBean();								ev.setId(j);								ev.setCalendar(cal);								ev.setTime(cal.getTime().getTime());								ev.setClassName(crontabEntryArray[j].getClassName());	ev.setMethodName(crontabEntryArray[j].getMethodName());								ev.setExtraInfo(crontabEntryArray[j].getExtraInfo());								lista1.add(ev);						}					}					cal.add(Calendar.SECOND, 1);				}				// The last event is the new generation of the event list				CrontabBean ev = new CrontabBean();						ev.setCalendar(cal);						ev.setTime(cal.getTime().getTime());						ev.setClassName(GENERATE_TIMETABLE_EVENT);						ev.setMethodName("");				lista1.add(ev);				eventsQueue = new CrontabBean[lista1.size()];				for (int i = 0; i < lista1.size() ; i++) {					eventsQueue[i] = (CrontabBean)lista1.get(i);				}		    				} catch (Exception e) {		    // Rounds the calendar to this minute		    Calendar cal = Calendar.getInstance();		    cal.setTime(new Date(((long)			(System.currentTimeMillis() / 60000))			    * 60000));	            // Adds to the calendar the iFrec Minutes		    cal.add(Calendar.SECOND, iFrec);		    CrontabBean ev = new CrontabBean();		    ev.setCalendar(cal);		    ev.setTime(cal.getTime().getTime());		    ev.setClassName(GENERATE_TIMETABLE_EVENT);		    ev.setMethodName("");		    // Sets the GENERATE_TIMETABLE_EVENT as the 		    // last event		    eventsQueue = new CrontabBean[1];		    eventsQueue[0] = ev;		    if (e instanceof DataNotFoundException) {		    Log.info(e.toString());		    } else {			Log.error(e.toString(), e);		    }	     }    }    /**     * This method says if this CrontabEntryBean should run or not     * @param the result of CrontabEntryBean.getBusinessDays()     * @throws Exception     */    private boolean shouldRunToday(boolean should) throws Exception {        if (!Crontab.getInstance().isHoliday()) {            return true;        } else if (should) {            return true;        } else {            return false;        }    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91黄视频在线观看| 亚洲欧美福利一区二区| 日产欧产美韩系列久久99| 欧美性生活久久| 亚洲成人在线观看视频| 欧美人妇做爰xxxⅹ性高电影| 亚洲图片有声小说| 91麻豆精品国产综合久久久久久| 日精品一区二区三区| 日韩一区二区不卡| 国内外成人在线视频| 国产欧美一区在线| 国产不卡在线播放| 亚洲免费观看高清在线观看| 在线观看亚洲精品视频| 日精品一区二区| 久久久精品中文字幕麻豆发布| 国产成人亚洲综合a∨婷婷| 国产精品乱码妇女bbbb| 欧美影视一区在线| 日韩精品91亚洲二区在线观看 | 国产福利一区二区三区| 国产三级欧美三级日产三级99 | 成人av高清在线| 亚洲视频一区二区在线| 欧美私人免费视频| 韩国毛片一区二区三区| 中文字幕一区二区三区蜜月| 欧美日韩精品二区第二页| 日本不卡视频一二三区| 久久久久久久免费视频了| 99re这里只有精品6| 婷婷激情综合网| 欧美激情在线看| 在线观看欧美黄色| 国产一本一道久久香蕉| 亚洲综合久久久| 精品国产电影一区二区| 91麻豆免费观看| 精品一区二区三区在线观看| 自拍偷拍欧美激情| 日韩亚洲欧美在线| 91理论电影在线观看| 久久精品国产精品亚洲精品| 自拍偷在线精品自拍偷无码专区| 欧美大片在线观看一区| 色吧成人激情小说| 国产激情偷乱视频一区二区三区| 亚洲1区2区3区4区| 国产精品美女久久久久久2018| 欧美老肥妇做.爰bbww视频| 丁香另类激情小说| 蜜臀国产一区二区三区在线播放| 亚洲欧美偷拍另类a∨色屁股| 日韩午夜激情av| 欧美在线免费观看亚洲| 成人高清视频在线| 狠狠久久亚洲欧美| 日本不卡1234视频| 亚洲一区二区三区四区中文字幕| 欧美国产日韩一二三区| 日韩精品一区在线观看| 3d动漫精品啪啪| 在线观看国产精品网站| 成人国产精品免费观看视频| 国产一区二区三区久久悠悠色av| 五月婷婷久久综合| 亚洲一区二区三区小说| 《视频一区视频二区| 国产欧美精品一区二区色综合| 4438亚洲最大| 91精品国产综合久久香蕉麻豆| 欧洲一区二区av| 日本丶国产丶欧美色综合| 成人av在线一区二区三区| 国产一区二区在线观看免费| 麻豆91在线播放免费| 午夜视频在线观看一区| 一区二区高清在线| 亚洲三级在线免费| 中文字幕一区av| 国产精品麻豆久久久| 国产精品久久久久久久蜜臀| 一区二区中文字幕在线| 中文字幕一区日韩精品欧美| 国产精品美女视频| 亚洲丝袜另类动漫二区| 亚洲精品国产品国语在线app| 国产精品久久久久久久久久久免费看 | 精品国产区一区| 欧美tk—视频vk| 久久久久久久久久看片| 国产欧美一区二区精品仙草咪| 2020国产精品| 国产精品无码永久免费888| 国产精品毛片a∨一区二区三区| 国产精品久线观看视频| 亚洲视频在线观看三级| 亚洲国产欧美另类丝袜| 日本成人超碰在线观看| 极品少妇一区二区三区精品视频| 国模娜娜一区二区三区| 成人免费视频国产在线观看| 一本大道综合伊人精品热热| 欧美伊人精品成人久久综合97| 欧美精品三级在线观看| 日韩精品自拍偷拍| 国产午夜精品一区二区三区嫩草 | 黑人精品欧美一区二区蜜桃| 国产在线播精品第三| 成人高清在线视频| 久久国产免费看| 欧美福利电影网| 亚洲一区在线播放| 免费观看在线综合| 激情久久五月天| 在线观看亚洲一区| 最新日韩在线视频| 成人avav影音| 亚洲激情图片一区| 精品国产一区二区在线观看| 自拍偷拍亚洲综合| 国产乱码字幕精品高清av| 亚洲国产一区二区a毛片| 亚洲视频免费在线| 日本午夜精品一区二区三区电影| 韩国v欧美v亚洲v日本v| 97精品电影院| 精品国产乱码久久久久久久| 亚洲日本免费电影| 久久爱www久久做| 91蜜桃婷婷狠狠久久综合9色| 欧美精品第一页| 欧美国产日韩亚洲一区| 日韩国产精品久久久| www.亚洲色图| 精品国产伦一区二区三区免费| 最新国产成人在线观看| 久久66热re国产| 欧洲亚洲精品在线| 国产欧美1区2区3区| 人人爽香蕉精品| 色嗨嗨av一区二区三区| 久久精品亚洲一区二区三区浴池| 午夜精品福利在线| 91亚洲国产成人精品一区二区三 | 久久久久久久久岛国免费| 亚洲国产乱码最新视频| 不卡的电影网站| 国产日韩视频一区二区三区| 热久久久久久久| 欧美老肥妇做.爰bbww| 亚洲视频 欧洲视频| 懂色av一区二区三区蜜臀| 日韩一级在线观看| 午夜精品久久久久久久99水蜜桃| 91麻豆国产福利精品| 国产精品盗摄一区二区三区| 国产v日产∨综合v精品视频| 欧美不卡视频一区| 久久国产精品99久久久久久老狼| 色婷婷综合五月| 国产欧美中文在线| 国产精品一二三在| 精品国产乱子伦一区| 毛片一区二区三区| 日韩一区二区影院| 日韩va亚洲va欧美va久久| 欧美日韩大陆在线| 五月天精品一区二区三区| 欧美在线不卡一区| 亚洲成人精品在线观看| 欧美日韩国产经典色站一区二区三区| 亚洲综合久久久久| 欧美视频一区二区在线观看| 亚洲一二三四区| 欧美伦理电影网| 日韩激情视频在线观看| 欧美一区二区三级| 久久电影国产免费久久电影 | 9久草视频在线视频精品| 中文字幕在线观看不卡| 91亚洲精华国产精华精华液| 亚洲精品自拍动漫在线| 日本二三区不卡| 婷婷久久综合九色综合伊人色| 911精品国产一区二区在线| 强制捆绑调教一区二区| 久久日一线二线三线suv| 国产一区二区免费在线| 国产精品久久久久桃色tv| 色婷婷久久一区二区三区麻豆| 亚洲成人手机在线| 欧美一区三区二区| 国产一区91精品张津瑜| 国产精品传媒入口麻豆| 欧美色涩在线第一页| 九色porny丨国产精品| 国产人伦精品一区二区| 91美女精品福利|