aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJames Moger <james.moger@gmail.com>2011-08-15 17:40:48 -0400
committerJames Moger <james.moger@gmail.com>2011-08-15 17:40:48 -0400
commit6d5c75b52005620858d0c5231440f578d9222c7e (patch)
tree836bea698ee89e62b28daaae0e5f0680784ca88f /src
parent66e810aaf212c5e37b0a1702b6c33480595408ce (diff)
downloadiciql-6d5c75b52005620858d0c5231440f578d9222c7e.tar.gz
iciql-6d5c75b52005620858d0c5231440f578d9222c7e.zip
Improving performance documentation.
Diffstat (limited to 'src')
-rw-r--r--src/com/iciql/util/StatementLogger.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/com/iciql/util/StatementLogger.java b/src/com/iciql/util/StatementLogger.java
index 95d644a..0504c98 100644
--- a/src/com/iciql/util/StatementLogger.java
+++ b/src/com/iciql/util/StatementLogger.java
@@ -18,6 +18,8 @@ package com.iciql.util;
import java.text.DecimalFormat;
import java.util.Set;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicLong;
/**
@@ -43,6 +45,7 @@ public class StatementLogger {
void logStatement(StatementType type, String statement);
}
+ private static final ExecutorService EXEC = Executors.newSingleThreadExecutor();
private static final Set<StatementListener> LISTENERS = Utils.newHashSet();
private static final StatementListener CONSOLE = new StatementListener() {
@@ -121,12 +124,13 @@ public class StatementLogger {
logStatement(StatementType.SELECT, statement);
}
- private static void logStatement(StatementType type, String statement) {
- for (StatementListener listener : LISTENERS) {
- try {
- listener.logStatement(type, statement);
- } catch (Throwable t) {
- }
+ private static void logStatement(final StatementType type, final String statement) {
+ for (final StatementListener listener : LISTENERS) {
+ EXEC.execute(new Runnable() {
+ public void run() {
+ listener.logStatement(type, statement);
+ }
+ });
}
}