Author: desruisseaux
Date: Sun Dec 2 14:03:35 2012
New Revision: 1416176
URL: http://svn.apache.org/viewvc?rev=1416176&view=rev
Log:
Group the test threads in their own thread group, for better separation with
SIS threads when debugging.
Modified:
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/collection/CacheTest.java
Modified:
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java?rev=1416176&r1=1416175&r2=1416176&view=diff
==============================================================================
---
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java
(original)
+++
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java
Sun Dec 2 14:03:35 2012
@@ -68,6 +68,11 @@ public final strictfp class TestUtilitie
};
/**
+ * The thread group for every threads created for testing purpose.
+ */
+ public static final ThreadGroup THREADS = new ThreadGroup("SIS-Tests");
+
+ /**
* Do not allow instantiation of this class.
*/
private TestUtilities() {
Modified:
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/collection/CacheTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/collection/CacheTest.java?rev=1416176&r1=1416175&r2=1416176&view=diff
==============================================================================
---
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/collection/CacheTest.java
(original)
+++
sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/collection/CacheTest.java
Sun Dec 2 14:03:35 2012
@@ -117,6 +117,13 @@ public final strictfp class CacheTest ex
Throwable failure;
/**
+ * Creates a new thread.
+ */
+ OtherThread() {
+ super(TestUtilities.THREADS, "CacheTest.testThreadBlocking()");
+ }
+
+ /**
* Reads the value added by the main thread, then adds an other
value.
* The first operation shall block while the main thread holds the
lock.
*/
@@ -209,6 +216,13 @@ public final strictfp class CacheTest ex
int addCount;
/**
+ * Creates a new thread.
+ */
+ WriterThread(final int i) {
+ super(TestUtilities.THREADS, "CacheTest.stress() #" + i);
+ }
+
+ /**
* Put random values in the map.
*/
@Override public void run() {
@@ -237,7 +251,7 @@ public final strictfp class CacheTest ex
}
}
final WriterThread[] threads = new WriterThread[50];
- for (int i=0; i<threads.length; i++) threads[i] = new WriterThread();
+ for (int i=0; i<threads.length; i++) threads[i] = new WriterThread(i);
for (int i=0; i<threads.length; i++) threads[i].start();
for (int i=0; i<threads.length; i++) threads[i].join();
TestUtilities.rethrownIfNotNull(failures.get());