提交 bd83d25e authored 作者: Thomas Mueller's avatar Thomas Mueller

Less classes are loaded when using the database in embedded mode.

上级 12d611a2
...@@ -105,7 +105,6 @@ public class TraceSystem implements TraceWriter { ...@@ -105,7 +105,6 @@ public class TraceSystem implements TraceWriter {
this.fileName = fileName; this.fileName = fileName;
updateLevel(); updateLevel();
traces = SmallLRUCache.newInstance(100); traces = SmallLRUCache.newInstance(100);
dateFormat = new SimpleDateFormat("MM-dd HH:mm:ss ");
} }
private void updateLevel() { private void updateLevel() {
...@@ -210,10 +209,11 @@ public class TraceSystem implements TraceWriter { ...@@ -210,10 +209,11 @@ public class TraceSystem implements TraceWriter {
return levelFile; return levelFile;
} }
private String format(String module, String s) { private synchronized String format(String module, String s) {
synchronized (dateFormat) { if (dateFormat == null) {
return dateFormat.format(new Date()) + module + ": " + s; dateFormat = new SimpleDateFormat("MM-dd HH:mm:ss ");
} }
return dateFormat.format(new Date()) + module + ": " + s;
} }
public void write(int level, String module, String s, Throwable t) { public void write(int level, String module, String s, Throwable t) {
......
...@@ -213,6 +213,11 @@ public class WebServer implements Service { ...@@ -213,6 +213,11 @@ public class WebServer implements Service {
} }
String getStartDateTime() { String getStartDateTime() {
if (startDateTime == null) {
SimpleDateFormat format = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss z", new Locale("en", ""));
format.setTimeZone(TimeZone.getTimeZone("GMT"));
startDateTime = format.format(new Date());
}
return startDateTime; return startDateTime;
} }
...@@ -272,12 +277,6 @@ public class WebServer implements Service { ...@@ -272,12 +277,6 @@ public class WebServer implements Service {
// TraceSystem.traceThrowable(e); // TraceSystem.traceThrowable(e);
// } // }
// } // }
SimpleDateFormat format = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss z", new Locale("en", ""));
synchronized (format) {
format.setTimeZone(TimeZone.getTimeZone("GMT"));
startDateTime = format.format(new Date());
}
trace(startDateTime);
for (String[] lang : LANGUAGES) { for (String[] lang : LANGUAGES) {
languages.add(lang[0]); languages.add(lang[0]);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论