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

Code conventions

上级 430f4773
...@@ -47,9 +47,7 @@ public class Message { ...@@ -47,9 +47,7 @@ public class Message {
} else { } else {
message = "General exception"; message = "General exception";
} }
SQLException e2 = new SQLException(message + ": " + e.toString()); return new SQLException(message + ": " + e.toString(), e);
e2.initCause(e);
return e2;
} }
} }
...@@ -21,7 +21,7 @@ import java.util.concurrent.atomic.AtomicLong; ...@@ -21,7 +21,7 @@ import java.util.concurrent.atomic.AtomicLong;
public class StatementLogger { public class StatementLogger {
public static boolean logStatements; public static boolean logStatements;
private static final PrintWriter out = new PrintWriter(System.out); private static final PrintWriter OUT = new PrintWriter(System.out);
private static final AtomicLong SELECT_COUNT = new AtomicLong(); private static final AtomicLong SELECT_COUNT = new AtomicLong();
private static final AtomicLong CREATE_COUNT = new AtomicLong(); private static final AtomicLong CREATE_COUNT = new AtomicLong();
private static final AtomicLong INSERT_COUNT = new AtomicLong(); private static final AtomicLong INSERT_COUNT = new AtomicLong();
...@@ -61,13 +61,13 @@ public class StatementLogger { ...@@ -61,13 +61,13 @@ public class StatementLogger {
private static void log(String statement) { private static void log(String statement) {
if (logStatements) { if (logStatements) {
out.println(statement); OUT.println(statement);
} }
} }
public static void printStats() { public static void printStats() {
out.println("JaQu Runtime Statistics"); OUT.println("JaQu Runtime Statistics");
out.println("======================="); OUT.println("=======================");
printStat("CREATE", CREATE_COUNT); printStat("CREATE", CREATE_COUNT);
printStat("INSERT", INSERT_COUNT); printStat("INSERT", INSERT_COUNT);
printStat("UPDATE", UPDATE_COUNT); printStat("UPDATE", UPDATE_COUNT);
...@@ -79,7 +79,7 @@ public class StatementLogger { ...@@ -79,7 +79,7 @@ public class StatementLogger {
private static void printStat(String name, AtomicLong value) { private static void printStat(String name, AtomicLong value) {
if (value.get() > 0) { if (value.get() > 0) {
DecimalFormat df = new DecimalFormat("###,###,###,###"); DecimalFormat df = new DecimalFormat("###,###,###,###");
out.println(name + "=" + df.format(CREATE_COUNT.get())); OUT.println(name + "=" + df.format(CREATE_COUNT.get()));
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论