summaryrefslogtreecommitdiff
path: root/jurt
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2003-05-22 08:16:00 +0000
committerVladimir Glazounov <vg@openoffice.org>2003-05-22 08:16:00 +0000
commit265428fc2373f91e8ff9132e22a506e5ca02b67d (patch)
tree1f4c572b918e2fce42208b9026944ff744316c77 /jurt
parent7067376f0da44ea693cb8ab043fd661136a8d201 (diff)
INTEGRATION: CWS uno4 (1.9.2); FILE MERGED
2003/05/07 12:37:33 sb 1.9.2.1: #108642# Cleaned up tests.
Diffstat (limited to 'jurt')
-rw-r--r--jurt/test/com/sun/star/lib/uno/environments/remote/ThreadPool_Test.java687
1 files changed, 192 insertions, 495 deletions
diff --git a/jurt/test/com/sun/star/lib/uno/environments/remote/ThreadPool_Test.java b/jurt/test/com/sun/star/lib/uno/environments/remote/ThreadPool_Test.java
index 7174bcbe51a1..c5c6a7837bbd 100644
--- a/jurt/test/com/sun/star/lib/uno/environments/remote/ThreadPool_Test.java
+++ b/jurt/test/com/sun/star/lib/uno/environments/remote/ThreadPool_Test.java
@@ -2,9 +2,9 @@
*
* $RCSfile: ThreadPool_Test.java,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: rt $ $Date: 2003-04-23 17:07:53 $
+ * last change: $Author: vg $ $Date: 2003-05-22 09:16:00 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -61,140 +61,29 @@
package com.sun.star.lib.uno.environments.remote;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-import java.util.Hashtable;
-import java.util.Enumeration;
-import java.util.Vector;
-
-
import com.sun.star.lib.uno.typedesc.TypeDescription;
+import complexlib.ComplexTestCase;
+import java.util.Enumeration;
+import java.util.Hashtable;
-import com.sun.star.uno.IEnvironment;
-import com.sun.star.uno.Type;
-import com.sun.star.uno.UnoRuntime;
-
-
-class MyWorkAt implements IWorkAt
-{
- private static boolean DEBUG = false;
- protected ThreadId _id;
- protected WorkAt _async_WorkAt;
- protected boolean _success = false;
- public MyWorkAt( WorkAt async_WorkAt )
- {
- _async_WorkAt = async_WorkAt;
- }
- public void syncCall() throws Throwable
- {
- if( DEBUG ) System.out.println( "reaching syncCall" );
- IMessage iMessage = new MyMessage(true, ThreadPool_Test.__workAt_td, "oid", ThreadPoolFactory.getThreadId(), null, null, null);
-
- // marshal reply
- ThreadPool_Test.__iThreadPool.putJob(new Job(this, ThreadPool_Test. __iReceiver, iMessage));
- }
- public void asyncCall() throws Throwable
- {
-
- for( int i = 0 ; i < 5 ; i ++ )
- {
- if( DEBUG ) System.out.println( "starting asyncCall" + _async_WorkAt._async_counter);
- ThreadPool_Test.__iThreadPool.attach();
- ThreadPool_Test.putJob(
- this , true ,
- ThreadPoolFactory.getThreadId() , "syncCall" );
- // wait for reply
- ThreadPool_Test.__iThreadPool.enter();
- ThreadPool_Test.__iThreadPool.detach();
- if( DEBUG ) System.out.println( "finishing asyncCall" + _async_WorkAt._async_counter);
- }
- // async must have waited for this call
- _success = _async_WorkAt._async_counter == 2;
- }
-
- public void increment() throws Throwable
- {
-
- }
-
- public void notifyme()
- {
-
- }
-
-}
-
-public class ThreadPool_Test {
- /**
- * When set to true, enables various debugging output.
- */
- private static final boolean DEBUG = false;
-
- static IThreadPool __iThreadPool = null;
- static IReceiver __iReceiver = new MyReceiver();
- static TypeDescription __workAt_td = TypeDescription.getTypeDescription(IWorkAt.class);
- static Object __disposeId = new Object();
-
-
- static class TestThread extends Thread {
- ThreadId _threadId;
- Object _disposeId = new Object();
- String _message;
- IThreadPool _iThreadPool;
-
- TestThread() {
- this(__iThreadPool);
- }
-
- TestThread(IThreadPool iThreadPool) {
- _iThreadPool = iThreadPool;
- }
-
- public void run() {
- _threadId = ThreadPoolFactory.getThreadId();
-
-
- try {
- synchronized(this) {
- // notify that we are running
- notify();
-
- _iThreadPool.attach();
-
- // wait until we should continue
- wait();
- }
-
- if(DEBUG) System.err.println("entering queue");
-
- _iThreadPool.enter();
- }
- catch(Throwable throwable) {
- if(DEBUG) throwable.printStackTrace();
-
- _message = throwable.getMessage();
- }
-
- _iThreadPool.detach();
-
- synchronized(this) {
- if(DEBUG) System.err.println("dying");
-
- // notify the listeners that we are dying
- notifyAll();
- }
- }
+public class ThreadPool_Test extends ComplexTestCase {
+ public String getTestObjectName() {
+ return getClass().getName();
}
- static void putJob(IWorkAt iWorkAt, boolean synchron, ThreadId threadId, String operation) {
- IMessage iMessage = new MyMessage(synchron, __workAt_td, "oid", threadId, null, operation, null);
-
- __iThreadPool.putJob(new Job(iWorkAt, __iReceiver, iMessage));
+ public String[] getTestMethodNames() {
+ return new String[] { "testBrokenImplementation",
+ "testDispose",
+ "testThreadAsync",
+ "testDynamicThreadSync",
+ "testStaticThreadSync",
+ "testDynamicThreadAsyncSyncOrder",
+ "testStaticThreadAsyncSyncOrder",
+ "testStress",
+ "testAsyncSync" };
}
- private static void test_brokenImplementation() {
+ public void testBrokenImplementation() {
// The implementation of JavaThreadPoolFactory (rev. 1.2) and JobQueue
// (rev. 1.15) contains the following code as a race condition:
// 1 A call to JobQueue.acquire leads to
@@ -207,27 +96,20 @@ public class ThreadPool_Test {
// _jobQueues.remove call; the use of the return value of the
// following Enumeration.nextElement results in a
// NullPointerException.
- // (Detected once while running test_stress.)
+ // (Detected once while running testStress.)
+ // The following code checks that Hashtable and Enumeration indeed
+ // interact in this way:
Hashtable ht = new Hashtable();
String key = "key";
Object entry = new Object();
ht.put(key, entry);
Enumeration e = ht.elements();
- if (!e.hasMoreElements()) {
- throw new IllegalStateException();
- }
+ assure("", e.hasMoreElements());
ht.remove(key);
- if (e.nextElement() != null) {
- throw new IllegalStateException();
- }
+ assure("", e.nextElement() == null);
}
- static boolean test_dispose(Vector vector, boolean silent) throws Throwable {
- boolean passed = true;
-
- if(!silent)
- System.err.println("\t\ttest_dispose:");
-
+ public void testDispose() throws InterruptedException {
IThreadPool iThreadPool = ThreadPoolFactory.createThreadPool();
TestThread testThread = new TestThread(iThreadPool);
@@ -249,8 +131,6 @@ public class ThreadPool_Test {
// terminate the test thread
synchronized(testThread) {
- if(DEBUG) System.err.println("waiting for TestThread to die");
-
// put reply job
iThreadPool.dispose(new RuntimeException(message));
@@ -259,30 +139,16 @@ public class ThreadPool_Test {
testThread.join();
-
- passed = testThread._message.equals(message);
-
- if(!silent)
- System.err.println("\t\tpassed? " + passed);
-
- return passed;
+ assure("", testThread._message.equals(message));
}
-
-
- static boolean test_thread_async(Vector vector, boolean silent) throws Throwable {
- boolean passed = true;
-
- if(!silent)
- System.err.println("\t\ttest_thread_async:");
-
- WorkAt workAt = new WorkAt();
-
+ public void testThreadAsync() throws InterruptedException {
+ TestWorkAt workAt = new TestWorkAt();
ThreadId threadId = new ThreadId();
// queue asyncs
- for(int i = 0; i < WorkAt.MESSAGES; ++ i) {
+ for(int i = 0; i < TestWorkAt.MESSAGES; ++ i) {
Thread.yield(); // force scheduling
putJob(workAt, false, threadId, "increment");
}
@@ -294,27 +160,16 @@ public class ThreadPool_Test {
workAt.wait();
}
- passed = workAt._counter == WorkAt.MESSAGES;
-
- if(!silent)
- System.err.println("\t\tpassed? " + passed);
-
- return passed;
+ assure("", workAt._counter == TestWorkAt.MESSAGES);
}
- static boolean test_dynamic_thread_sync(Vector vector, boolean silent) throws Throwable {
- boolean passed = true;
-
- if(!silent)
- System.err.println("\t\t test_dynamic_thread_sync:");
-
- WorkAt workAt = new WorkAt();
-
+ public void testDynamicThreadSync() throws InterruptedException {
+ TestWorkAt workAt = new TestWorkAt();
ThreadId threadId = new ThreadId();
// queue asyncs
- for(int i = 0; i < WorkAt.MESSAGES; ++ i) {
+ for(int i = 0; i < TestWorkAt.MESSAGES; ++ i) {
Thread.yield(); // force scheduling
putJob(workAt, true, threadId, "increment");
}
@@ -326,21 +181,11 @@ public class ThreadPool_Test {
workAt.wait();
}
- passed = workAt._counter == WorkAt.MESSAGES;
-
- if(!silent)
- System.err.println("\t\tpassed? " + passed);
-
- return passed;
+ assure("", workAt._counter == TestWorkAt.MESSAGES);
}
- static boolean test_static_thread_sync(Vector vector, boolean silent) throws Throwable {
- boolean passed = true;
-
- if(!silent)
- System.err.println("\t\t test_static_thread_sync:");
-
- WorkAt workAt = new WorkAt();
+ public void testStaticThreadSync() throws InterruptedException {
+ TestWorkAt workAt = new TestWorkAt();
TestThread testThread = new TestThread();
@@ -358,18 +203,14 @@ public class ThreadPool_Test {
testThread.notifyAll();
}
-
// queue syncs
- for(int i = 0; i < WorkAt.MESSAGES; ++ i) {
+ for(int i = 0; i < TestWorkAt.MESSAGES; ++ i) {
Thread.yield(); // force scheduling
putJob(workAt, true, threadId, "increment");
}
-
// terminate the test thread
synchronized(testThread) {
- if(DEBUG) System.err.println("waiting for TestThread to die");
-
// put reply job
putJob(workAt, true, threadId, null);
@@ -378,39 +219,26 @@ public class ThreadPool_Test {
testThread.join();
-
- passed = workAt._counter == WorkAt.MESSAGES;
-
- if(!silent)
- System.err.println("\t\tpassed? " + passed);
-
- return passed;
+ assure("", workAt._counter == TestWorkAt.MESSAGES);
}
- static boolean test_dynamic_thread_async_sync_order(Vector vector, boolean silent) throws Throwable {
- boolean passed = true;
-
- if(!silent)
- System.err.println("\t\ttest_dynamic_thread_async_sync_order:");
-
- WorkAt workAt = new WorkAt();
-
+ public void testDynamicThreadAsyncSyncOrder() throws InterruptedException {
+ TestWorkAt workAt = new TestWorkAt();
ThreadId threadId = new ThreadId();
// queue asyncs
- for(int i = 0; i < WorkAt.MESSAGES; ++ i) {
+ for(int i = 0; i < TestWorkAt.MESSAGES; ++ i) {
Thread.yield(); // force scheduling
putJob(workAt, false, threadId, "asyncCall");
}
// queue syncs
- for(int i = 0; i < WorkAt.MESSAGES; ++ i) {
+ for(int i = 0; i < TestWorkAt.MESSAGES; ++ i) {
Thread.yield(); // force scheduling
putJob(workAt, true, threadId, "syncCall");
}
-
synchronized(workAt) {
putJob(workAt, true, threadId, "notifyme");
@@ -418,23 +246,11 @@ public class ThreadPool_Test {
workAt.wait();
}
- passed = workAt.passedAsyncTest(vector);
-
- if(!silent)
- System.err.println("\t\tpassed? " + passed);
-
- return passed;
+ assure("", workAt.passedAsyncTest());
}
-
-
- static boolean test_static_thread_async_sync_order(Vector vector, boolean silent) throws Throwable {
- boolean passed = true;
-
- if(!silent)
- System.err.println("\t\ttest_static_thread_async_sync_order:");
-
- WorkAt workAt = new WorkAt();
+ public void testStaticThreadAsyncSyncOrder() throws InterruptedException {
+ TestWorkAt workAt = new TestWorkAt();
TestThread testThread = new TestThread();
@@ -448,29 +264,24 @@ public class ThreadPool_Test {
ThreadId threadId = testThread._threadId;
// queue asyncs
- for(int i = 0; i < WorkAt.MESSAGES; ++ i) {
+ for(int i = 0; i < TestWorkAt.MESSAGES; ++ i) {
Thread.yield(); // force scheduling
putJob(workAt, false, threadId, "asyncCall");
}
-
// let the thread attach and enter the threadpool
synchronized(testThread) {
testThread.notifyAll();
}
-
// queue syncs
- for(int i = 0; i < WorkAt.MESSAGES; ++ i) {
+ for(int i = 0; i < TestWorkAt.MESSAGES; ++ i) {
Thread.yield(); // force scheduling
putJob(workAt, true, threadId, "syncCall");
}
-
// terminate the test thread
synchronized(testThread) {
- if(DEBUG) System.err.println("waiting for TestThread to die");
-
// put reply job
putJob(workAt, true, threadId, null);
@@ -479,327 +290,213 @@ public class ThreadPool_Test {
testThread.join();
- passed = workAt.passedAsyncTest(vector);
-
- if(!silent)
- System.err.println("\t\tpassed? " + passed);
-
- return passed;
- }
-
- static boolean test_async_sync( Vector vector , boolean silent ) throws InterruptedException
- {
- boolean passed = true;
-
- if(!silent)
- System.err.println("\t\ttest_async_sync:");
-
- WorkAt workAt = new WorkAt();
- ThreadId threadId = new ThreadId();
- MyWorkAt myWorkAt = new MyWorkAt( workAt );
-
- // queue asyncs
- for(int i = 0; i < WorkAt.MESSAGES; ++ i) {
- if( i == 2 )
- {
- putJob( myWorkAt, false , threadId, "asyncCall" );
- }
- putJob(workAt, false, threadId, "asyncCall");
- }
-
- synchronized(workAt) {
- putJob(workAt, false, threadId, "notifyme");
-
- while(!workAt._notified)
- workAt.wait();
- }
-
- passed = workAt._async_counter == WorkAt.MESSAGES && myWorkAt._success;
-
- if(!silent)
- System.err.println("\t\tpassed? " + passed);
-
- return passed;
+ assure("", workAt.passedAsyncTest());
}
- static boolean test_stress(Vector vector) throws Throwable {
- boolean passed = true;
-
- System.err.println("\t\ttest_stress:");
-
- WorkAt workAt = new WorkAt();
-
- for(int i = 0; i < WorkAt.MESSAGES; ++ i) {
+ public void testStress() throws InterruptedException {
+ TestWorkAt workAt = new TestWorkAt();
+ for (int i = 0; i < TestWorkAt.MESSAGES; ++i) {
Thread.yield(); // force scheduling
ThreadId threadID = new ThreadId();
-
putJob(workAt, true, threadID, "increment");
putJob(workAt, false, threadID, "increment");
}
-
-
- synchronized(workAt) {
- while(workAt._counter < (2 * WorkAt.MESSAGES))
+ synchronized (workAt) {
+ while (workAt._counter < 2 * TestWorkAt.MESSAGES) {
workAt.wait();
+ }
}
-
- class Stress1 extends Thread {
- Vector _vector;
- boolean _passed = true;
-
- Stress1(Vector vector) {
- _vector = vector;
+ abstract class Stress extends Thread {
+ public Stress(int count) {
+ this.count = count;
}
public void run() {
try {
- for(int i = 0; i < 50; ++ i) {
- boolean tmp_passed = test_thread_async(_vector, true);
-
- _passed = _passed && tmp_passed;
+ for (int i = 0; i < count; ++i) {
+ runTest();
}
- }
- catch(Throwable throwable) {
- System.err.println(throwable);
- throwable.printStackTrace();
+ } catch (Throwable e) {
+ e.printStackTrace(System.err);
}
}
- };
+ protected abstract void runTest() throws InterruptedException;
- Stress1 stress1 = new Stress1(vector);
- stress1.start();
-
- class Stress2 extends Thread {
- Vector _vector;
- boolean _passed = true;
-
- Stress2(Vector vector) {
- _vector = vector;
- }
-
- public void run() {
- try {
- for(int i = 0; i < 50; ++ i) {
- boolean tmp_passed = test_dynamic_thread_sync(_vector, true);
-
- _passed = _passed && tmp_passed;
- }
- }
- catch(Throwable throwable) {
- System.err.println(throwable);
- throwable.printStackTrace();
- }
- }
+ private final int count;
};
+ Stress stress1 = new Stress(50) {
+ protected void runTest() throws InterruptedException {
+ testThreadAsync();
+ }
+ };
+ stress1.start();
- Stress2 stress2 = new Stress2(vector);
+ Stress stress2 = new Stress(50) {
+ protected void runTest() throws InterruptedException {
+ testDynamicThreadSync();
+ }
+ };
stress2.start();
-
-
- class Stress3 extends Thread {
- Vector _vector;
- boolean _passed = true;
-
- Stress3(Vector vector) {
- _vector = vector;
- }
-
- public void run() {
- try {
- for(int i = 0; i < 50; ++ i) {
- boolean tmp_passed = test_static_thread_sync(_vector, true);
-
- _passed = _passed && tmp_passed;
- }
+ Stress stress3 = new Stress(50) {
+ protected void runTest() throws InterruptedException {
+ testStaticThreadSync();
}
- catch(Throwable throwable) {
- System.err.println(throwable);
- throwable.printStackTrace();
- }
- }
- };
-
-
- Stress3 stress3 = new Stress3(vector);
- stress3.start();
-
-
-
- class Stress4 extends Thread {
- Vector _vector;
- boolean _passed = true;
-
- Stress4(Vector vector) {
- _vector = vector;
- }
+ };
+ stress3.start();
- public void run() {
- try {
- for(int i = 0; i < 50; ++ i) {
- boolean tmp_passed = test_dynamic_thread_async_sync_order(_vector, true);
-
- _passed = _passed && tmp_passed;
- }
- }
- catch(Throwable throwable) {
- System.err.println(throwable);
- throwable.printStackTrace();
+ Stress stress4 = new Stress(50) {
+ protected void runTest() throws InterruptedException {
+ testDynamicThreadAsyncSyncOrder();
}
- }
- };
-
-
- Stress4 stress4 = new Stress4(vector);
- stress4.start();
+ };
+ stress4.start();
-
- class Stress5 extends Thread {
- Vector _vector;
- boolean _passed = true;
-
- Stress5(Vector vector) {
- _vector = vector;
- }
-
- public void run() {
- try {
- for(int i = 0; i < 50; ++ i) {
- boolean tmp_passed = test_static_thread_async_sync_order(_vector, true);
-
- _passed = _passed && tmp_passed;
- }
+ Stress stress5 = new Stress(50) {
+ protected void runTest() throws InterruptedException {
+ testStaticThreadAsyncSyncOrder();
}
- catch(Throwable throwable) {
- System.err.println(throwable);
- throwable.printStackTrace();
- }
- }
- };
-
-
- Stress5 stress5 = new Stress5(vector);
+ };
stress5.start();
-
- class Stress6 extends Thread {
- Vector _vector;
- boolean _passed = true;
-
- Stress6(Vector vector) {
- _vector = vector;
- }
-
- public void run() {
- for(int i = 0; i < 500; ++ i) {
-// Thread.sleep(500);
- try {
- boolean tmp_passed = test_dispose(_vector, true);
-
- _passed = _passed && tmp_passed;
- }
- catch(Throwable throwable) {
- System.err.println(throwable);
- throwable.printStackTrace();
-
- _passed = false;
- _vector.addElement("Stress6 - exception:" + throwable);
- }
+ Stress stress6 = new Stress(500) {
+ protected void runTest() throws InterruptedException {
+ testDispose();
}
- }
- };
-
-
- Stress6 stress6 = new Stress6(vector);
- stress6.start();
-
-
-
+ };
+ stress6.start();
stress1.join();
stress2.join();
stress3.join();
stress4.join();
stress5.join();
+ stress6.join();
+ }
- if(!stress1._passed)
- vector.addElement("Stress1 not passed");
-
- if(!stress2._passed)
- vector.addElement("Stress2 not passed");
+ public void testAsyncSync() throws InterruptedException {
+ TestWorkAt workAt = new TestWorkAt();
+ ThreadId threadId = new ThreadId();
+ MyWorkAt myWorkAt = new MyWorkAt( workAt );
- if(!stress3._passed)
- vector.addElement("Stress3 not passed");
+ // queue asyncs
+ for(int i = 0; i < TestWorkAt.MESSAGES; ++ i) {
+ if( i == 2 )
+ {
+ putJob( myWorkAt, false , threadId, "asyncCall" );
+ }
+ putJob(workAt, false, threadId, "asyncCall");
+ }
- if(!stress4._passed)
- vector.addElement("Stress4 not passed");
+ synchronized(workAt) {
+ putJob(workAt, false, threadId, "notifyme");
- if(!stress5._passed)
- vector.addElement("Stress5 not passed");
+ while(!workAt._notified)
+ workAt.wait();
+ }
- if(!stress6._passed)
- vector.addElement("Stress6 not passed");
+ assure("",
+ workAt._async_counter == TestWorkAt.MESSAGES
+ && myWorkAt._success);
+ }
- passed = passed && stress1._passed;
- passed = passed && stress2._passed;
- passed = passed && stress3._passed;
- passed = passed && stress4._passed;
- passed = passed && stress5._passed;
- passed = passed && stress6._passed;
+ private static void putJob(TestIWorkAt iWorkAt, boolean synchron,
+ ThreadId threadId, String operation) {
+ __iThreadPool.putJob(
+ new Job(iWorkAt, __iReceiver,
+ new TestMessage(synchron, __workAt_td, "oid", threadId,
+ null, operation, null)));
+ }
- System.err.println("\t\tpassed? " + passed);
+ private static final class TestThread extends Thread {
+ ThreadId _threadId;
+ Object _disposeId = new Object();
+ String _message;
+ IThreadPool _iThreadPool;
- return passed;
- }
+ TestThread() {
+ this(__iThreadPool);
+ }
- static public boolean test(Vector vector) throws Throwable {
- __iThreadPool = ThreadPoolFactory.createThreadPool();
+ TestThread(IThreadPool iThreadPool) {
+ _iThreadPool = iThreadPool;
+ }
- System.err.println("\tThreadPool test:");
+ public void run() {
+ _threadId = ThreadPoolFactory.getThreadId();
- boolean passed = true;
- boolean tmp_passed = false;
- test_brokenImplementation();
+ try {
+ synchronized(this) {
+ // notify that we are running
+ notify();
- tmp_passed = test_dispose(vector, false);
- passed = passed && tmp_passed;
+ _iThreadPool.attach();
- tmp_passed = test_thread_async(vector, false);
- passed = passed && tmp_passed;
+ // wait until we should continue
+ wait();
+ }
- tmp_passed = test_dynamic_thread_sync(vector, false);
- passed = passed && tmp_passed;
+ _iThreadPool.enter();
+ }
+ catch(Throwable throwable) {
+ _message = throwable.getMessage();
+ }
- tmp_passed = test_static_thread_sync(vector, false);
- passed = passed && tmp_passed;
+ _iThreadPool.detach();
- tmp_passed = test_dynamic_thread_async_sync_order(vector, false);
- passed = passed && tmp_passed;
+ synchronized(this) {
+ // notify the listeners that we are dying
+ notifyAll();
+ }
+ }
+ }
- tmp_passed = test_static_thread_async_sync_order(vector, false);
- passed = passed && tmp_passed;
+ private static final class MyWorkAt implements TestIWorkAt {
+ public MyWorkAt( TestWorkAt async_WorkAt ) {
+ _async_WorkAt = async_WorkAt;
+ }
- tmp_passed = test_stress(vector);
- passed = passed && tmp_passed;
+ public void syncCall() throws Throwable
+ {
+ IMessage iMessage = new TestMessage(
+ true, ThreadPool_Test.__workAt_td, "oid",
+ ThreadPoolFactory.getThreadId(), null, null, null);
- tmp_passed = test_async_sync(vector,false);
- passed = passed && tmp_passed;
+ // marshal reply
+ ThreadPool_Test.__iThreadPool.putJob(
+ new Job(this, ThreadPool_Test. __iReceiver, iMessage));
+ }
+ public void asyncCall() throws Throwable {
+ for (int i = 0 ; i < 5 ; ++i) {
+ ThreadPool_Test.__iThreadPool.attach();
+ ThreadPool_Test.putJob(this, true,
+ ThreadPoolFactory.getThreadId(),
+ "syncCall");
+ // wait for reply
+ ThreadPool_Test.__iThreadPool.enter();
+ ThreadPool_Test.__iThreadPool.detach();
+ }
+ // async must have waited for this call
+ _success = _async_WorkAt._async_counter == 2;
+ }
- System.err.println("\tpassed? " + passed);
- return passed;
- }
+ public void increment() throws Throwable {}
- static public void main(String args[]) throws Throwable {
- Vector vector = new Vector();
+ public void notifyme() {}
- test(vector);
+ public boolean _success = false;
- for(int i = 0; i < vector.size(); ++ i)
- System.err.println("---:" + vector.elementAt(i));
+ private final TestWorkAt _async_WorkAt;
}
+
+ private static final IThreadPool __iThreadPool
+ = ThreadPoolFactory.createThreadPool();
+ private static final IReceiver __iReceiver = new TestReceiver();
+ private static final TypeDescription __workAt_td
+ = TypeDescription.getTypeDescription(TestIWorkAt.class);
}