public void refresh() throws ServletException { BatchUtil batch = new BatchUtil(getServletContext());
Date date = new Date();
timer = new java.util.Timer(true); calendar = batch.getBatchCalendarFromDB(Constants.BATCH_SMS_TIME_FULLCODE);
calcCalendar(calendar);
task[0] = new SmsBatch(getServletContext(), calendar, date);
timer.scheduleAtFixedRate(task[0], calendar.getTime(), 24 * 60 * 60 * 1000); //每24小时跑一次。
//timer.schedule(task[0], 1000); calendar = batch.getBatchCalendarFromDB(Constants.BATCH_SMS_TIME_SIGN);
calcCalendar(calendar);
task[1] = new SmsSignBatch(getServletContext(), calendar, date); timer.scheduleAtFixedRate(task[1], calendar.MONTH, 1); //待定 }
calendar能从数据库获得日期,主要是最后一条按月循环执行,一月一次,每月一号换二号都可以,求问最后一条写的对不对,不对如何写,小弟在此谢过!!1
Date date = new Date();
timer = new java.util.Timer(true); calendar = batch.getBatchCalendarFromDB(Constants.BATCH_SMS_TIME_FULLCODE);
calcCalendar(calendar);
task[0] = new SmsBatch(getServletContext(), calendar, date);
timer.scheduleAtFixedRate(task[0], calendar.getTime(), 24 * 60 * 60 * 1000); //每24小时跑一次。
//timer.schedule(task[0], 1000); calendar = batch.getBatchCalendarFromDB(Constants.BATCH_SMS_TIME_SIGN);
calcCalendar(calendar);
task[1] = new SmsSignBatch(getServletContext(), calendar, date); timer.scheduleAtFixedRate(task[1], calendar.MONTH, 1); //待定 }
calendar能从数据库获得日期,主要是最后一条按月循环执行,一月一次,每月一号换二号都可以,求问最后一条写的对不对,不对如何写,小弟在此谢过!!1
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货