27package jau.test.util.parallel;
29import java.io.IOException;
30import java.lang.reflect.InvocationTargetException;
32import org.jau.lang.InterruptSource;
33import org.jau.util.parallel.RunnableTask;
34import org.junit.Assert;
35import org.junit.FixMethodOrder;
37import org.junit.runners.MethodSorters;
39import jau.test.junit.util.JunitTracer;
41@FixMethodOrder(MethodSorters.NAME_ASCENDING)
45 public void testInvokeAndWait00() throws IOException, InterruptedException, InvocationTargetException {
46 final Object syncObject =
new Object();
47 final boolean[] done = {
false};
48 final Runnable clientAction =
new Runnable() {
51 synchronized(syncObject) {
52 System.err.println(
"CA.1: "+syncObject);
54 System.err.println(
"CA.X");
55 syncObject.notifyAll();
60 System.err.println(
"BB.0: "+syncObject);
61 synchronized (syncObject) {
62 System.err.println(
"BB.1: "+syncObject);
63 new InterruptSource.
Thread(
null, clientAction, Thread.currentThread().getName()+
"-clientAction").start();
65 System.err.println(
"BB.2");
67 System.err.println(
"BB.3");
68 }
catch (
final InterruptedException e) {
69 throw new RuntimeException(e);
71 Assert.assertTrue(done[0]);
72 System.err.println(
"BB.X");
77 public void testInvokeAndWait01() throws IOException, InterruptedException, InvocationTargetException {
78 final boolean[] done = {
false};
79 final Runnable clientAction =
new Runnable() {
82 System.err.println(
"CA.1");
84 System.err.println(
"CA.X");
94 System.err.println(
"BB.2");
96 System.err.println(
"BB.3");
97 }
catch (
final InterruptedException e) {
98 throw new RuntimeException(e);
100 Assert.assertTrue(done[0]);
101 System.err.println(
"BB.X");
105 public static void main(
final String args[])
throws IOException {
107 org.junit.runner.JUnitCore.
main(tstname);
static void main(final String args[])
void testInvokeAndWait01()
void testInvokeAndWait00()
java.lang.Thread specialization implementing InterruptSource to track java.lang.Thread#interrupt() ca...
Helper class to provide a Runnable queue implementation with a Runnable wrapper which notifies after ...
final Object getSyncObject()
Return the synchronization object if any.
Interface exposing java.lang.Thread#interrupt() source, intended for java.lang.Thread specializations...