[logback-dev] [GIT] Logback: the generic, reliable, fast and flexible logging framework. branch master updated. v_1.0.2-10-g56add24

Gitbot git-noreply at pixie.qos.ch
Fri May 4 00:11:43 CEST 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".

The branch, master has been updated
       via  56add24c8e14fe96b7597d18820b7b20c4537acb (commit)
      from  fdd1363fa8fb6798a1aef048f580c82d3a5cdc51 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=56add24c8e14fe96b7597d18820b7b20c4537acb
http://github.com/ceki/logback/commit/56add24c8e14fe96b7597d18820b7b20c4537acb

commit 56add24c8e14fe96b7597d18820b7b20c4537acb
Author: Ceki Gulcu <ceki at qos.ch>
Date:   Fri May 4 00:11:01 2012 +0200

    fixing lbclassic232

diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/issue/lbclassic232/Barebones.java b/logback-classic/src/test/java/ch/qos/logback/classic/issue/lbclassic232/Barebones.java
new file mode 100644
index 0000000..f8cdf56
--- /dev/null
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/issue/lbclassic232/Barebones.java
@@ -0,0 +1,32 @@
+package ch.qos.logback.classic.issue.lbclassic232;
+
+import ch.qos.logback.core.Context;
+import ch.qos.logback.core.ContextBase;
+
+public class Barebones {
+
+  public static void main(String[] args) {
+    Context context = new ContextBase();
+    for(int i = 0; i < 3; i++) {
+      SenderRunnable senderRunnable = new SenderRunnable(""+i);
+      context.getExecutorService().execute(senderRunnable);
+    }
+    System.out.println("done");
+    //System.exit(0);
+  }
+
+  static class SenderRunnable implements Runnable {
+    String id;
+    SenderRunnable(String id) {
+      this.id = id;
+    }
+
+    public void run() {
+      try {
+        Thread.sleep(2000);
+      } catch (InterruptedException e) {
+      }
+      System.out.println("SenderRunnable " +id);
+    }
+  }
+}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/ContextBase.java b/logback-core/src/main/java/ch/qos/logback/core/ContextBase.java
index cd58377..e274179 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/ContextBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/ContextBase.java
@@ -18,6 +18,7 @@ import java.util.Map;
 import java.util.concurrent.*;
 
 import ch.qos.logback.core.status.StatusManager;
+import ch.qos.logback.core.util.EnvUtil;
 
 import static ch.qos.logback.core.CoreConstants.CONTEXT_NAME_KEY;
 
@@ -35,8 +36,10 @@ public class ContextBase implements Context {
 
   Object configurationLock = new Object();
 
-  // 0 idle threads, 2 maximum threads, no idle waiting
-  ExecutorService executorService = new ThreadPoolExecutor(0, 2,
+  private static final int CORE_POOL_SIZE = EnvUtil.isJDK5() ? 1 : 0;
+
+  // 0 (JDK 1,6+) or 1 (JDK 1.5) idle threads, 2 maximum threads, no idle waiting
+  ExecutorService executorService = new ThreadPoolExecutor(CORE_POOL_SIZE, 2,
           0L, TimeUnit.MILLISECONDS,
           new LinkedBlockingQueue<Runnable>());
 
diff --git a/logback-core/src/main/java/ch/qos/logback/core/util/EnvUtil.java b/logback-core/src/main/java/ch/qos/logback/core/util/EnvUtil.java
index 08e0e5e..1f9b7c0 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/util/EnvUtil.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/util/EnvUtil.java
@@ -19,17 +19,18 @@ package ch.qos.logback.core.util;
 public class EnvUtil {
 
 
-  static public boolean isGroovyAvailable() {
-    ClassLoader classLoader = EnvUtil.class.getClassLoader();
-    try {
-      Class bindingClass = classLoader.loadClass("groovy.lang.Binding");
-      return (bindingClass != null);
-    } catch (ClassNotFoundException e) {
+  static public boolean isJDK5() {
+    String javaVersion = System.getProperty("java.version");
+    if (javaVersion == null) {
+      return false;
+    }
+    if (javaVersion.startsWith("1.5")) {
+      return true;
+    } else {
       return false;
     }
   }
 
-
   static public boolean isJaninoAvailable() {
     ClassLoader classLoader = EnvUtil.class.getClassLoader();
     try {

-----------------------------------------------------------------------

Summary of changes:
 .../classic/issue/lbclassic232/Barebones.java      |   32 ++++++++++++++++++++
 .../main/java/ch/qos/logback/core/ContextBase.java |    7 +++-
 .../java/ch/qos/logback/core/util/EnvUtil.java     |   15 +++++----
 3 files changed, 45 insertions(+), 9 deletions(-)
 create mode 100644 logback-classic/src/test/java/ch/qos/logback/classic/issue/lbclassic232/Barebones.java


hooks/post-receive
-- 
Logback: the generic, reliable, fast and flexible logging framework.


More information about the logback-dev mailing list