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
相关文档:
create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',
@pagesize int output,--每页显示记录条数
@currentpage int output,--第几页
@orderid nvarchar(50),--主键排序
@sort int,--排序方式,1表示升序,0表示降序排列
......
1 前言
为了使软件开发过程有章可循,保证软件质量,加强开发管理。
2 开发管理
项目进度周报表格如下:
项目编号:
汇报人:
汇报日期:
项目进度详细描述:
其他问题:
3 项目周期
司项目开发周期分为以下几个步骤:
步骤 说明 参与角色 生成文档或程序(打*号为可选)
可行 ......
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 {
/**
* 删除文件
......
JDK1.5中,String类新增了一个很有用的静态方法String.format():
format(Locale l, String format, Object... args) 使用指定的语言环境、格式字符串和参数返回一个格式化字符串。
format(String format, Object... args) 使用指定的格式字符串和参数返回一个格式化字符串。
举几个这个方法实用的例子(注释是输出结果) ......
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 ......