JAVA WEB程序中添加定时器
//这是我的定时器类,用来定时执行某段任务;
package com.my.time;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Timer;
public
class
BugXmlTimer {
public
Timer timer;
public
void
timerStart(){
timer =
new
Timer();
Date datetime=
new
Date();
Date midnightDate=
new
Date();
SimpleDateFormat sdf1 =
new
SimpleDateFormat(
"yyyy-MM-dd"
);
SimpleDateFormat sdf2 =
new
SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss"
);
try
{
midnightDate = sdf2.parse(sdf1.format(datetime)+
" 23:00:00"
);
}
catch
(ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
long
in
=midnightDate.getTime()-datetime.getTime();
System.
out
.println(
"before task"
);
//立刻执行,然后每隔30s执行一次
timer.schedule(
new
BugXmlTimerTas
相关文档:
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;
public class DealFile {
/**
* 删除文件
......
淘宝用开源,微软用自己的东西,金山什么都用,Google、IBM和ORACLE以及JBOSS则全力支持OpenSource,诸多公司,我也不细评
了,从最终产品运行效率看,微软最差,Windows
Live系列的产品慢的不成样(最近几个月才略有改观),反倒是用开源的一个比一个快;看看google和淘宝。所以说,没有什么快慢,只 ......
java基础技术知识复习
一、 计算机基础知识:包括数据结构中的基本算法,计算机网络的OSI,TCP/IP模型。
计算机网络的OSI:OSI(Open System Interconnnection OSI)开放式系统互连, 是由国际化标准组织(ISO)制定的标准化开放式的计算机网络层次结构模型 ......
java exception 解决方案 - 我的异常网|异常|exception|myexception 831 - ActionMessages 832 - could not instantiate id generator 833 - javax.servlet.jsp.JspException 834 - javax.naming.NoInitialContextException 835 - net.sf.hibernate.HibernateException 836 - org.hibernate.exception.GenericJDBCExceptio ......