this is my code :
public class Test {
public static void main(String[] args) throws Exception {
String logPath = "D:\\mywork\\OMS\\Tymon\\testlog\\testlog.log";
File file = new File(logPath);
SchedulerFactory schedFact = new StdSchedulerFactory();
Scheduler sched = schedFact.getScheduler();
sched.start();
JobDetail jobDetail = new JobDetail("a", "b", TestJob.class);
CronTrigger trigger = new CronTrigger("c", "d");
trigger.setCronExpression("0/23 * * * * ?");
sched.scheduleJob(jobDetail, trigger);
}
}
when the job is running, the file “D:\mywork\OMS\Tymon\testlog\testlog.log” can’t be renamed and deleted.
it seems like the file handle always be held
how fix it ?
please help ~
Why you create File file = new File(logPath) object.
Seems you never used in else where in your logic.