| |
|
| java.lang.Object org.jboss.test.classloader.test.DeadlockTests32
DeadlockTests32 | public class DeadlockTests32 (Code) | | Additional deadlock scenario tests of the UnifiedClassLoader3
.....................................
: +-------+ +-------+ :
: | TestA | | TestA2| :
: +---+---+ +---+---+ :
'''''''''|'''''''''''''''''''|'''''''
| extends |
''''|'''''' |
......|.........|.............|.........
: +--+----+ +--+----+ +--+----+ :
: | TestB | | TestB3| | TestB2| :
: +-------+ +-------+ +-------+ :
:......................................:
author: Frank.Gamerdinger@Sun.COM author: Scott.Stark@jboss.org version: $Revision: 57211 $ |
Inner Class :public class TestClassLoader extends UnifiedClassLoader3 | |
Method Summary | |
public void | beforeTaskLoop(UnifiedClassLoader3 cl, String clsname) | public void | testDeadLock() Scenario:
Thread T1 Thread T2
classLoader 1 [a.jar] classLoader 2 [b.jar]
. | public void | testDeadLockAndCircularity() Scenario:
Thread T1 Thread T2
classLoader 1 [a.jar] classLoader 2 [b.jar]
. |
DeadlockTests32 | public DeadlockTests32(File libDir) throws Exception(Code) | | [starksm@banshee testsuite]$ jar -tf output/lib/dl-a.jar
org/jboss/test/classloader/test/abc/TestA.class
org/jboss/test/classloader/test/abc/TestA2.class
[starksm@banshee testsuite]$ jar -tf output/lib/dl-b.jar
org/jboss/test/classloader/test/abc/TestB.class
org/jboss/test/classloader/test/abc/TestB2.class
org/jboss/test/classloader/test/abc/TestB3.class
Parameters: libDir - throws: Exception - |
beforeTaskLoop | public void beforeTaskLoop(UnifiedClassLoader3 cl, String clsname)(Code) | | |
testDeadLock | public void testDeadLock() throws Exception(Code) | | Scenario:
Thread T1 Thread T2
classLoader 1 [a.jar] classLoader 2 [b.jar]
. .
t0 ------------------------------------------------------------
| | loadClass(abc.TestB)
| |----+
| +----+ registered,
| |
| |----+
| +----+ wait in beforeTaskLoop
t1 ------------------------------------------------------------
| load abc.TestB2 |
| schedule abc.TestB2 --------->|
| |
|-----+ |
| | nextTask(WAIT_ON_EVENT) |
+-----+ |
t2 ------------------------------------------------------------
| | <--- release beforeTaskLoop lock
t3 ------------------------------------------------------------
| | loadClassLocally(abc.TestB2)
| |
| |
|<+---------- schedule abc.TestA -----|
| |-----+ nextTask
| | |
| +-----+
| |
| | loadClassLocally
|<+---------- schedule abc.TestA2-----| abc.TestB
| |
| |-----+
| | | nextTask
| +-----+ wait
| |
t4 -------------------- Dead-Lock ----------------------------
throws: Exception - |
testDeadLockAndCircularity | public void testDeadLockAndCircularity() throws Exception(Code) | | Scenario:
Thread T1 Thread T2
classLoader 1 [a.jar] classLoader 2 [b.jar]
. .
t0 ------------------------------------------------------------
| | loadClass(abc.TestB)
| |----+
| +----+ registered,
| |
| |----+
| +----+ wait in beforeTaskLoop
t1 ------------------------------------------------------------
| load abc.TestB3 |
| schedule abc.TestB3 --------->|
| |
|-----+ |
| | nextTask(WAIT_ON_EVENT) |
+-----+ |
t2 ------------------------------------------------------------
| | <--- release beforeTaskLoop lock
t3 ------------------------------------------------------------
| | loadClassLocally(abc.TestB3)
| |
| |
|<+---------- schedule abc.TestA -----|
| loadClassLocally(abc.TestA) |
|-----+ |
| | nextTask(WAIT_ON_EVENT) |
+-----+ |
| | loadClassLocally(abc.TestB)
| | CCE(abc.TestA)
| |
| |-----+
| | | nextTask
| +-----+ wait(WAIT_ON_EVENT)
| |
t4 -------------------- Dead-Lock ----------------------------
throws: Exception - |
|
|
|