jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r638362 - /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/AbstractConcurrencyTest.java
Date Tue, 18 Mar 2008 13:46:33 GMT
Author: mreutegg
Date: Tue Mar 18 06:46:32 2008
New Revision: 638362

URL: http://svn.apache.org/viewvc?rev=638362&view=rev
Log:
JCR-1478: Perform random operation tests
- use logger instead of System.out for thread dumps

Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/AbstractConcurrencyTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/AbstractConcurrencyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/AbstractConcurrencyTest.java?rev=638362&r1=638361&r2=638362&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/AbstractConcurrencyTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/AbstractConcurrencyTest.java
Tue Mar 18 06:46:32 2008
@@ -17,6 +17,8 @@
 package org.apache.jackrabbit.core;
 
 import org.apache.jackrabbit.test.AbstractJCRTest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import javax.jcr.Session;
 import javax.jcr.Node;
@@ -31,6 +33,11 @@
 public abstract class AbstractConcurrencyTest extends AbstractJCRTest {
 
     /**
+     * Logger instance for this class.
+     */
+    private static final Logger log = LoggerFactory.getLogger(AbstractConcurrencyTest.class);
+
+    /**
      * Runs a task with the given concurrency and creates an individual test
      * node for each thread.
      *
@@ -139,20 +146,22 @@
 
     /**
      * If tests are run in a 1.5 JVM or higher the stack of the given threads
-     * are dumped to system out.
+     * are dumped to the logger with level ERROR.
      */
     protected static void dumpStacks(Thread[] threads) {
         try {
             Method m = Thread.class.getMethod("getStackTrace", null);
+            StringBuffer dumps = new StringBuffer();
             for (int t = 0; t < threads.length; t++) {
                 StackTraceElement[] elements = (StackTraceElement[]) m.invoke(
                         threads[t], null);
-                System.out.println(threads[t]);
+                dumps.append(threads[t].toString()).append('\n');
                 for (int i = 0; i < elements.length; i++) {
-                    System.out.println("\tat " + elements[i]);
+                    dumps.append("\tat " + elements[i]).append('\n');
                 }
-                System.out.println();
+                dumps.append('\n');
             }
+            log.error("Thread dumps:\n{}", dumps);
         } catch (NoSuchMethodException e) {
             // not a 1.5 JVM
         } catch (IllegalAccessException e) {



Mime
View raw message