Commit e106057b by shenjinzhu

调试bug

parent 52ea6089
......@@ -39,6 +39,7 @@ public class MainThread extends Thread {
public static Map<String, Template> mainMap = new ConcurrentHashMap<String, Template>();
public static Map<String, Template> allTmp = new ConcurrentHashMap<String, Template>();
private static Lock mainLock = new ReentrantLock();
private static String today = "";
public MainThread() {
this.start();
......@@ -150,18 +151,21 @@ public class MainThread extends Thread {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH");
while (true) {
Date d = null;
if (sdf.format(new Date()).equals(today)) {
} else {
today=sdf.format(new Date());
}
Calendar start = Calendar.getInstance();
Calendar end = Calendar.getInstance();
String today = sdf.format(start.getTime());
Date d=null;
try {
d = sdf.parse(today);
start.setTime(sdf2.parse(sdf2.format(start.getTime())));
if (start.get(Calendar.HOUR_OF_DAY) > 1) {
start.add(Calendar.HOUR_OF_DAY, -1);
} else {
d.setHours(d.getHours()-1);
start.setTime(d);
d.setHours(d.getHours() - 1);
start.setTime(sdf.parse(today));
}
end.setTime(sdf2.parse(sdf2.format(end.getTime())));
// end.add(Calendar.HOUR_OF_DAY, -1);
......@@ -219,7 +223,7 @@ public class MainThread extends Thread {
} catch (Exception e) {
e.printStackTrace();
}
Tools.sleep(1000 *60*60);
Tools.sleep(1000 * 60 * 60);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment