INFO (ReadCRLogTask.java:39) - Start________________Log : 2016-08-05 15:53:40
INFO (ReadCRLogTask.java:41) - readCabRadioLog : 2016-08-05 15:53:40
INFO (ReadCRLogTask.java:39) - Start________________Log : 2016-08-05 15:53:41
INFO (ReadCRLogTask.java:41) - readCabRadioLog : 2016-08-05 15:53:41
INFO (ReadCRLogTask.java:45) - insertCabRadioData : 2016-08-05 15:53:46
INFO (ReadCRLogTask.java:45) - insertCabRadioData : 2016-08-05 15:53:46
INFO (ReadCRLogTask.java:49) - coverageByLocation : 2016-08-05 15:53:46
INFO (ReadCRLogTask.java:53) - degradedCoverageLocations : 2016-08-05 15:53:46
INFO (ReadCRLogTask.java:49) - coverageByLocation : 2016-08-05 15:53:46
INFO (ReadCRLogTask.java:57) - unreportedCellChangeLocations : 2016-08-05 15:53:46
INFO (ReadCRLogTask.java:53) - degradedCoverageLocations : 2016-08-05 15:53:46
INFO (ReadCRLogTask.java:61) - unreportedTransponders : 2016-08-05 15:53:46
INFO (ReadCRLogTask.java:57) - unreportedCellChangeLocations : 2016-08-05 15:53:46
INFO (ReadCRLogTask.java:65) - abnormalCellChange : 2016-08-05 15:53:46
INFO (ReadCRLogTask.java:61) - unreportedTransponders : 2016-08-05 15:53:46
INFO (ReadCRLogTask.java:65) - abnormalCellChange : 2016-08-05 15:53:46
INFO (ReadCRLogTask.java:69) - End__________________Log : 2016-08-05 15:55:50
INFO (ReadCRLogTask.java:69) - End__________________Log : 2016-08-05 15:55:50
定时任务每天执行一次之前还正常 ,最近为什么会执行两次??
并没有对这块做任何修改?
求思路
指点一下大概可能也许是什么问题?
private static final String READ_LOG_TIME = "00:00:01";
private static final String READ_LOG_PATH = "E:\\monitor\\CabRadioLog";
private IReadCRLogService services;
@Override
public void run()
{
try
{
log.info("Start________________Log : "+ CommonUtil.getDatetimeByLong(System.currentTimeMillis()));
log.info("readLog : " + CommonUtil.getDatetimeByLong(System.currentTimeMillis()));
services.readLog(Task.getPath());
log.info("insertData : " + CommonUtil.getDatetimeByLong(System.currentTimeMillis()));
services.insertData();
log.info("coverageByLocation : " + CommonUtil.getDatetimeByLong(System.currentTimeMillis()));
services.coverageByLocation();
log.info("degradedCoverageLocations : " + CommonUtil.getDatetimeByLong(System.currentTimeMillis()));
services.degradedCoverageLocations();
log.info("unreportedCellChangeLocations : " + CommonUtil.getDatetimeByLong(System.currentTimeMillis()));
services.unreportedCellChangeLocations();
log.info("unreportedTransponders : " + CommonUtil.getDatetimeByLong(System.currentTimeMillis()));
services.unreportedTransponders();
log.info("abnormalCellChange : " + CommonUtil.getDatetimeByLong(System.currentTimeMillis()));
services.abnormalCellChange();
log.info("End__________________Log : " + CommonUtil.getDatetimeByLong(System.currentTimeMillis()));
}
catch (Exception e)
{
log.error("[ReadCRLogTask-run]The error = " + e.getMessage());
}
}
//读取 log日志
if (CommonUtil.isTimeToWork(Task.getReadCRLogTime()))
{
try
{
Task task = (Task)CommonUtil.getBean("Task");
task.start();
}
catch (Exception e)
{
log.error("[TIMER] backupDatabaseTask start failed. e=" + e.getMessage());
}
}
代码呢?
定时这块没做修改,两天前还正常(打印一次),今天就每次调试都打印两次。。。
@遥远的守望: IReadCRLogService这个代码补一下
@JokerJason:
public interface IReadCRLogService
{
public void readCabRadioLog(String path) throws Exception;
public void coverageByLocation() throws Exception;
public void insertCabRadioData() throws Exception;
public void degradedCoverageLocations() throws Exception;
public void unCellChangeLocations() throws Exception;
public void unTransponders() throws Exception;
public void abnormalCellChange() throws Exception;
}
@JokerJason:
修改这个对定时任务有影响么?
@遥远的守望: 觉得你代码还没给完全啊 不过估计是线程不安全 在关键代码上加Synchronized 试一下 或者把完整代码发我邮箱 zh-jia-ch@163.com 再帮你看看
@JokerJason:
恩 谢谢, 我试试看....
--! 代码不能外发,没权限 . . .
@JokerJason:
@Override
public void run()
{
try
{
excuteCRLogTask();
}
catch (Exception e)
{
log.error("[ReadCRLogTask-run]The error = " + e.getMessage());
}
}
private synchronized void excuteCRLogTask() throws Exception
加了这个,貌似不管用...
代码呢?
定时这块代码没做啥修改.
前两天还正常,今天就打印两次..
用定时器或者用线程池执行周期性任务.这样不容易出错.