Commit e106057b by shenjinzhu

调试bug

parent 52ea6089
...@@ -39,6 +39,7 @@ public class MainThread extends Thread { ...@@ -39,6 +39,7 @@ public class MainThread extends Thread {
public static Map<String, Template> mainMap = new ConcurrentHashMap<String, Template>(); public static Map<String, Template> mainMap = new ConcurrentHashMap<String, Template>();
public static Map<String, Template> allTmp = new ConcurrentHashMap<String, Template>(); public static Map<String, Template> allTmp = new ConcurrentHashMap<String, Template>();
private static Lock mainLock = new ReentrantLock(); private static Lock mainLock = new ReentrantLock();
private static String today = "";
public MainThread() { public MainThread() {
this.start(); this.start();
...@@ -150,18 +151,21 @@ public class MainThread extends Thread { ...@@ -150,18 +151,21 @@ public class MainThread extends Thread {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH"); SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH");
while (true) { while (true) {
Date d = null; if (sdf.format(new Date()).equals(today)) {
} else {
today=sdf.format(new Date());
}
Calendar start = Calendar.getInstance(); Calendar start = Calendar.getInstance();
Calendar end = Calendar.getInstance(); Calendar end = Calendar.getInstance();
String today = sdf.format(start.getTime()); Date d=null;
try { try {
d = sdf.parse(today); d = sdf.parse(today);
start.setTime(sdf2.parse(sdf2.format(start.getTime()))); start.setTime(sdf2.parse(sdf2.format(start.getTime())));
if (start.get(Calendar.HOUR_OF_DAY) > 1) { if (start.get(Calendar.HOUR_OF_DAY) > 1) {
start.add(Calendar.HOUR_OF_DAY, -1); start.add(Calendar.HOUR_OF_DAY, -1);
} else { } else {
d.setHours(d.getHours()-1); d.setHours(d.getHours() - 1);
start.setTime(d); start.setTime(sdf.parse(today));
} }
end.setTime(sdf2.parse(sdf2.format(end.getTime()))); end.setTime(sdf2.parse(sdf2.format(end.getTime())));
// end.add(Calendar.HOUR_OF_DAY, -1); // end.add(Calendar.HOUR_OF_DAY, -1);
...@@ -219,7 +223,7 @@ public class MainThread extends Thread { ...@@ -219,7 +223,7 @@ public class MainThread extends Thread {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); 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