diff options
author | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-01-10 20:14:34 +0000 |
---|---|---|
committer | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-01-10 20:14:34 +0000 |
commit | 8a996c69ad5ce5e47bce725f3b1ebe2378ef8d7b (patch) | |
tree | a6fc69d760a2fdb032a1dc1f8d00d5e101a09849 /java/tests/Concurrency | |
parent | 08f7761a4e9cc2f7fea455441edf45fe284c1292 (diff) | |
download | ATCD-main_to_poa_merge_8.tar.gz |
This commit was manufactured by cvs2svn to create tagmain_to_poa_merge_8
'main_to_poa_merge_8'.
Diffstat (limited to 'java/tests/Concurrency')
-rw-r--r-- | java/tests/Concurrency/Condition/Condition.dsp | 88 | ||||
-rw-r--r-- | java/tests/Concurrency/Condition/Consumer.java | 73 | ||||
-rw-r--r-- | java/tests/Concurrency/Condition/JoinableThreadGroup.java | 24 | ||||
-rw-r--r-- | java/tests/Concurrency/Condition/Makefile | 25 | ||||
-rw-r--r-- | java/tests/Concurrency/Condition/Producer.java | 67 | ||||
-rw-r--r-- | java/tests/Concurrency/Condition/QueueTest.java | 64 | ||||
-rw-r--r-- | java/tests/Concurrency/Condition/SimpleMessageQueue.java | 86 | ||||
-rw-r--r-- | java/tests/Concurrency/Makefile | 23 | ||||
-rw-r--r-- | java/tests/Concurrency/MutexTest.dsp | 72 | ||||
-rw-r--r-- | java/tests/Concurrency/MutexTest.java | 154 | ||||
-rw-r--r-- | java/tests/Concurrency/RWMutexTest.dsp | 73 | ||||
-rw-r--r-- | java/tests/Concurrency/RWMutexTest.java | 93 | ||||
-rw-r--r-- | java/tests/Concurrency/SemaphoreTest.dsp | 73 | ||||
-rw-r--r-- | java/tests/Concurrency/SemaphoreTest.java | 102 | ||||
-rw-r--r-- | java/tests/Concurrency/TokenTest.dsp | 72 | ||||
-rw-r--r-- | java/tests/Concurrency/TokenTest.java | 73 |
16 files changed, 0 insertions, 1162 deletions
diff --git a/java/tests/Concurrency/Condition/Condition.dsp b/java/tests/Concurrency/Condition/Condition.dsp deleted file mode 100644 index 2775a9cded6..00000000000 --- a/java/tests/Concurrency/Condition/Condition.dsp +++ /dev/null @@ -1,88 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Condition" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 5.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Java Virtual Machine Java Project" 0x0809
-
-CFG=Condition - Java Virtual Machine Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "Condition.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "Condition.mak" CFG="Condition - Java Virtual Machine Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "Condition - Java Virtual Machine Release" (based on\
- "Java Virtual Machine Java Project")
-!MESSAGE "Condition - Java Virtual Machine Debug" (based on\
- "Java Virtual Machine Java Project")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-JAVA=jvc.exe
-
-!IF "$(CFG)" == "Condition - Java Virtual Machine Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir ""
-# PROP BASE Intermediate_Dir ""
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\..\classes-r"
-# PROP Intermediate_Dir ""
-# PROP Target_Dir ""
-# ADD BASE JAVA /O
-# ADD JAVA /O
-
-!ELSEIF "$(CFG)" == "Condition - Java Virtual Machine Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir ""
-# PROP BASE Intermediate_Dir ""
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\..\classes"
-# PROP Intermediate_Dir ""
-# PROP Target_Dir ""
-# ADD BASE JAVA /g
-# ADD JAVA /g
-
-!ENDIF
-
-# Begin Target
-
-# Name "Condition - Java Virtual Machine Release"
-# Name "Condition - Java Virtual Machine Debug"
-# Begin Source File
-
-SOURCE=.\Consumer.java
-# End Source File
-# Begin Source File
-
-SOURCE=.\JoinableThreadGroup.java
-# End Source File
-# Begin Source File
-
-SOURCE=.\Producer.java
-# End Source File
-# Begin Source File
-
-SOURCE=.\QueueTest.java
-# End Source File
-# Begin Source File
-
-SOURCE=.\SimpleMessageQueue.java
-# End Source File
-# End Target
-# End Project
diff --git a/java/tests/Concurrency/Condition/Consumer.java b/java/tests/Concurrency/Condition/Consumer.java deleted file mode 100644 index ff4f5ff4a4b..00000000000 --- a/java/tests/Concurrency/Condition/Consumer.java +++ /dev/null @@ -1,73 +0,0 @@ -//File: Consumer.java -//Seth Widoff 8/8/96 -//This class attempts at random intervals to dequeue random elements -//from a queue. If the queue is empty the thread waits until an element -//has been enqueued and another thread has invoked the notify() method. - -package tests.Concurrency.Condition; - -import JACE.ASX.TimeValue; -import java.util.Random; - -public class Consumer implements Runnable -{ - //Maximum pause between dequeues (in milliseconds) - private static final int MAX_PAUSE = 1000; - - private SimpleMessageQueue queue_; - private boolean stop_requested_ = false; - private String name_; - private int iterations_; - private TimeValue timeout_; - - public Consumer(String name, - SimpleMessageQueue queue, - int iterations, - TimeValue timeout) - { - name_ = "Consumer " + name; - queue_ = queue; - iterations_ = iterations; - timeout_ = timeout; - } - - public void run() - { - //Set the random number generator seed to the current time in - //milliseconds. - - Random random = new Random(System.currentTimeMillis()); - Integer element; - - for (int i = 0; i < iterations_; ) - { - try - { - element = (Integer)queue_.dequeue(timeout_); - if (element != null) - { - - System.out.print("Consumer::run() " + name_ + " dequeued " + element.toString()); - System.out.println(" Queue size: " + queue_.size()); - - Thread.sleep(random.nextLong() % MAX_PAUSE); - } - else - { - System.out.println ("Null"); - } - i++; - } - catch(Exception excp) - { - System.out.print ("Consumer::run() Exception: "); - System.out.println(excp); - } - } - } - - public void requestStop() - { - stop_requested_ = true; - } -} diff --git a/java/tests/Concurrency/Condition/JoinableThreadGroup.java b/java/tests/Concurrency/Condition/JoinableThreadGroup.java deleted file mode 100644 index c878eb026d3..00000000000 --- a/java/tests/Concurrency/Condition/JoinableThreadGroup.java +++ /dev/null @@ -1,24 +0,0 @@ -package tests.Concurrency.Condition; - -public class JoinableThreadGroup extends ThreadGroup -{ - public JoinableThreadGroup(String name) - { - super(name); - } - - public JoinableThreadGroup(ThreadGroup parent, String name) - { - super(parent, name); - } - - public void join() throws InterruptedException - { - Thread list[] = new Thread[activeCount()]; - - enumerate(list, true); - - for (int i = 0; i < list.length; i++) - list[i].join(); - } -} diff --git a/java/tests/Concurrency/Condition/Makefile b/java/tests/Concurrency/Condition/Makefile deleted file mode 100644 index fd1e6a93677..00000000000 --- a/java/tests/Concurrency/Condition/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -# Makefile - -.SUFFIXES: .java .class - -JACE_WRAPPER = ../../.. -CLASSDIR = $(JACE_WRAPPER)/classes - -CLASSPATH := $(CLASSDIR):$(CLASSPATH) - -all: - javac -d ${JACE_WRAPPER}/classes $(files) -doc: - javadoc -d ${JACE_WRAPPER}/doc $(files) $(packages) - -files = \ - QueueTest.java \ - JoinableThreadGroup.java \ - SimpleMessageQueue.java \ - Producer.java \ - Consumer.java - -packages = tests.Concurrency.Condition; - -realclean: - find ${JACE_WRAPPER}/classes/tests/Concurrency/Condition -name '*.class' -print | xargs ${RM} diff --git a/java/tests/Concurrency/Condition/Producer.java b/java/tests/Concurrency/Condition/Producer.java deleted file mode 100644 index ed6da2251ba..00000000000 --- a/java/tests/Concurrency/Condition/Producer.java +++ /dev/null @@ -1,67 +0,0 @@ -//File: Producer.java -//Seth Widoff 8/8/96 -//This class attempts at random intervals to enqueue random elements -//into a queue. If the queue is full the thread waits until an element -//has been dequeued and another thread has invoked the notify() method. - -package tests.Concurrency.Condition; - -import JACE.ASX.TimeValue; -import java.util.Random; - -public class Producer implements Runnable -{ - //Maximum pause between enqueues (in milliseconds) - private static final int MAX_PAUSE = 1000; - - private SimpleMessageQueue queue_; - private boolean stop_requested_ = false; - private String name_; - private int iterations_; - private TimeValue timeout_; - - public Producer(String name, - SimpleMessageQueue queue, - int iterations, - TimeValue timeout) - { - name_ = "Producer " + name; - queue_ = queue; - iterations_ = iterations; - timeout_ = timeout; - } - - public void run() - { - //Set the random number generator seed to the current time in milliseconds. - Random random = new Random(System.currentTimeMillis()); - int element = 1; - - for (int i = 0; i < iterations_; ) - { - try - { - // element = random.nextInt(); - - queue_.enqueue((Object)new Integer(element), timeout_); - System.out.print("Producer::run() " + name_ + " enqueued " + element); - System.out.println(" Queue size: " + queue_.size()); - - Thread.sleep(random.nextLong() % MAX_PAUSE); - i++; - element++; - } - catch(Exception excp) - { - System.out.print("Producer::run() Exception: "); - System.out.println(excp); - } - } - } - - public void requestStop() - { - stop_requested_ = true; - } -} - diff --git a/java/tests/Concurrency/Condition/QueueTest.java b/java/tests/Concurrency/Condition/QueueTest.java deleted file mode 100644 index 87e7d57bbbd..00000000000 --- a/java/tests/Concurrency/Condition/QueueTest.java +++ /dev/null @@ -1,64 +0,0 @@ -//File: QueueTest.java -//Seth Widoff, 8/8/96 -//This class is a test method for the Producer and Consumer classes. -//The main method takes as arguments the number of producers, the -//number of consumers and the number of elements in the queue. It then -//spawn the specified threads and starts them. - -package tests.Concurrency.Condition; - -import JACE.ASX.TimeValue; - -public class QueueTest -{ - public static void main(String[] args) - { - if (args.length < 5) - { - System.out.println("Usage: java QueueTest <# producers> <# consumers> <# elements> <#iterations> <#timeout secs> <#timeout nano secs>"); - System.exit(1); - } - - int num_producers = Integer.parseInt(args[0]), - num_consumers = Integer.parseInt(args[1]), - num_elements = Integer.parseInt(args[2]), - num_iterations = Integer.parseInt(args[3]), - num_timeout_secs = Integer.parseInt(args[4]), - num_timeout_nano_secs = Integer.parseInt(args[5]); - - if (num_elements < 1 - || num_consumers < 1 - || num_producers < 1) - { - System.out.println("All the parameters must be larger than zero."); - System.exit(1); - } - - SimpleMessageQueue queue = new SimpleMessageQueue(num_elements); - Consumer[] consumers = new Consumer[num_consumers]; - Producer[] producers = new Producer[num_producers]; - JoinableThreadGroup thread_group = new JoinableThreadGroup("Producer Consumer"); - - for (int i = 0; i < num_producers; i++) - { - producers[i] = new Producer("Number " + (i + 1), queue, num_iterations, new TimeValue (num_timeout_secs, num_timeout_nano_secs)); - new Thread(thread_group, producers[i]).start(); - } - - for (int i = 0; i < num_consumers; i++) - { - consumers[i] = new Consumer("Number " + (i + 1), queue, num_iterations, new TimeValue (num_timeout_secs, num_timeout_nano_secs)); - new Thread(thread_group, consumers[i]).start(); - } - - try - { - thread_group.join(); - } - catch(InterruptedException excp) - { - System.out.println("QueueTest::main"); - System.out.println(excp); - } - } -} diff --git a/java/tests/Concurrency/Condition/SimpleMessageQueue.java b/java/tests/Concurrency/Condition/SimpleMessageQueue.java deleted file mode 100644 index bb703516858..00000000000 --- a/java/tests/Concurrency/Condition/SimpleMessageQueue.java +++ /dev/null @@ -1,86 +0,0 @@ -package tests.Concurrency.Condition; - -import JACE.ASX.TimeoutException; -import JACE.ASX.TimeValue; -import JACE.Concurrency.*; - -public class SimpleMessageQueue -{ - private int num_items_ = 0; - private int head_ = 0, tail_ = 0; - private Object[] queue_; - - private Mutex lock_ = new Mutex (); - private Condition notFull_ = new Condition (lock_); - private Condition notEmpty_ = new Condition (lock_); - - public SimpleMessageQueue(int size) - { - queue_ = new Object[size]; - } - - public void enqueue(Object element, TimeValue timeout) - throws TimeoutException, InterruptedException - { - try - { - lock_.acquire (); - while (this.isFull ()) - notFull_.Wait (timeout); - - if (tail_ == queue_.length) - tail_ = 0; - queue_[tail_] = element; - tail_++; - - num_items_++; - notEmpty_.signal (); - } - finally - { - lock_.release (); - } - } - - public Object dequeue (TimeValue timeout) - throws TimeoutException, InterruptedException - { - Object return_value = null; - - try - { - lock_.acquire (); - while (this.isEmpty ()) - notEmpty_.Wait (timeout); - - return_value = queue_[head_]; - head_++; - if (head_ == queue_.length) - head_ = 0; - - num_items_--; - notFull_.signal (); - } - finally - { - lock_.release (); - } - return return_value; - } - - public boolean isEmpty() - { - return num_items_ == 0; - } - - public boolean isFull() - { - return num_items_ == queue_.length; - } - - public int size() - { - return num_items_; - } -} - diff --git a/java/tests/Concurrency/Makefile b/java/tests/Concurrency/Makefile deleted file mode 100644 index f967dffb92f..00000000000 --- a/java/tests/Concurrency/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -# Makefile - -.SUFFIXES: .java .class - -JACE_WRAPPER = ../.. -CLASSDIR = $(JACE_WRAPPER)/classes - -CLASSPATH := $(CLASSDIR):$(CLASSPATH) - -all: - javac -d ${JACE_WRAPPER}/classes $(files) -doc: - javadoc -d ${JACE_WRAPPER}/doc $(files) $(packages) - -files = MutexTest.java \ - SemaphoreTest.java \ - RWMutexTest.java \ - TokenTest.java - -packages = tests.Concurrency - -realclean: - find ${JACE_WRAPPER}/classes/tests/Concurrency -name '*.class' -print | xargs ${RM} diff --git a/java/tests/Concurrency/MutexTest.dsp b/java/tests/Concurrency/MutexTest.dsp deleted file mode 100644 index 1d5e933af09..00000000000 --- a/java/tests/Concurrency/MutexTest.dsp +++ /dev/null @@ -1,72 +0,0 @@ -# Microsoft Developer Studio Project File - Name="MutexTest" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 5.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Java Virtual Machine Java Project" 0x0809
-
-CFG=MutexTest - Java Virtual Machine Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "MutexTest.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "MutexTest.mak" CFG="MutexTest - Java Virtual Machine Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "MutexTest - Java Virtual Machine Release" (based on\
- "Java Virtual Machine Java Project")
-!MESSAGE "MutexTest - Java Virtual Machine Debug" (based on\
- "Java Virtual Machine Java Project")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-JAVA=jvc.exe
-
-!IF "$(CFG)" == "MutexTest - Java Virtual Machine Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir ""
-# PROP BASE Intermediate_Dir ""
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\classes-r"
-# PROP Intermediate_Dir ""
-# PROP Target_Dir ""
-# ADD BASE JAVA /O
-# ADD JAVA /O
-
-!ELSEIF "$(CFG)" == "MutexTest - Java Virtual Machine Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir ""
-# PROP BASE Intermediate_Dir ""
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\classes"
-# PROP Intermediate_Dir ""
-# PROP Target_Dir ""
-# ADD BASE JAVA /g
-# ADD JAVA /g
-
-!ENDIF
-
-# Begin Target
-
-# Name "MutexTest - Java Virtual Machine Release"
-# Name "MutexTest - Java Virtual Machine Debug"
-# Begin Source File
-
-SOURCE=.\MutexTest.java
-# End Source File
-# End Target
-# End Project
diff --git a/java/tests/Concurrency/MutexTest.java b/java/tests/Concurrency/MutexTest.java deleted file mode 100644 index 680266ef071..00000000000 --- a/java/tests/Concurrency/MutexTest.java +++ /dev/null @@ -1,154 +0,0 @@ -/************************************************* - * - * = PACKAGE - * tests.Concurrency - * - * = FILENAME - * MutexTest.java - * - *@author Prashant Jain - * - *************************************************/ -package tests.Concurrency; - -import java.io.*; -import JACE.OS.*; -import JACE.Concurrency.*; - -class MutexReader extends Thread -{ - MutexReader (int nIterations, Mutex mutex) - { - this.nIterations_ = nIterations; - this.mutex_ = mutex; - } - - public void run () - { - for (int i = 1; i <= this.nIterations_; i++) - { - // Acquire the mutex (will block until it gets it) - try - { - this.mutex_.acquire (); - } - catch (InterruptedException e) - { - ACE.ERROR (e); - } - - MutexTest.count++; - ACE.DEBUG (Thread.currentThread ().toString () + - " reader acquired mutex in iteration " + i + - ", count = " + MutexTest.count); - - try - { - Thread.sleep (1); - } - catch (InterruptedException e) - { - } - // Release the mutex - this.mutex_.release (); - try - { - Thread.sleep (1); - } - catch (InterruptedException e) - { - } - - } - } - - int nIterations_; - Mutex mutex_; -} - -class MutexWriter extends Thread -{ - MutexWriter (int nIterations, Mutex mutex) - { - this.nIterations_ = nIterations; - this.mutex_ = mutex; - } - - public void run () - { - for (int i = 1; i <= this.nIterations_; i++) - { - // Acquire the mutex (will block until it gets it) - try - { - this.mutex_.acquire (); - } - catch (InterruptedException e) - { - ACE.ERROR (e); - } - - MutexTest.count++; - ACE.DEBUG (Thread.currentThread ().toString () + - " writer acquired mutex in iteration " + i + - ", count = " + MutexTest.count); - - try - { - Thread.sleep (1); - } - catch (InterruptedException e) - { - } - - // Release the mutex - this.mutex_.release (); - try - { - Thread.sleep (1); - } - catch (InterruptedException e) - { - } - - } - } - - int nIterations_; - Mutex mutex_; -} - -public class MutexTest -{ - public static void main (String args[]) - { - int nReaders = 1; - int nWriters = 1; - int nIterations = 100; - int i; - try - { - if (args.length == 3) - { - nReaders = Integer.parseInt (args[0]); - nWriters = Integer.parseInt (args[1]); - nIterations = Integer.parseInt (args[2]); - } - } - catch (NumberFormatException e) - { - ACE.ERROR ("Illegal argument."); - } - - // Create a lock - Mutex mutex = new Mutex (); - - // Now spawn off the readers and writers - for (i = 0; i < nReaders; i++) - new MutexReader (nIterations, mutex).start (); - - for (i = 0; i < nWriters; i++) - new MutexWriter (nIterations, mutex).start (); - } - public static int count; -} diff --git a/java/tests/Concurrency/RWMutexTest.dsp b/java/tests/Concurrency/RWMutexTest.dsp deleted file mode 100644 index 44602766c52..00000000000 --- a/java/tests/Concurrency/RWMutexTest.dsp +++ /dev/null @@ -1,73 +0,0 @@ -# Microsoft Developer Studio Project File - Name="RWMutexTest" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 5.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Java Virtual Machine Java Project" 0x0809
-
-CFG=RWMutexTest - Java Virtual Machine Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "RWMutexTest.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "RWMutexTest.mak"\
- CFG="RWMutexTest - Java Virtual Machine Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "RWMutexTest - Java Virtual Machine Release" (based on\
- "Java Virtual Machine Java Project")
-!MESSAGE "RWMutexTest - Java Virtual Machine Debug" (based on\
- "Java Virtual Machine Java Project")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-JAVA=jvc.exe
-
-!IF "$(CFG)" == "RWMutexTest - Java Virtual Machine Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir ""
-# PROP BASE Intermediate_Dir ""
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\classes-r"
-# PROP Intermediate_Dir ""
-# PROP Target_Dir ""
-# ADD BASE JAVA /O
-# ADD JAVA /O
-
-!ELSEIF "$(CFG)" == "RWMutexTest - Java Virtual Machine Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir ""
-# PROP BASE Intermediate_Dir ""
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\classes"
-# PROP Intermediate_Dir ""
-# PROP Target_Dir ""
-# ADD BASE JAVA /g
-# ADD JAVA /g
-
-!ENDIF
-
-# Begin Target
-
-# Name "RWMutexTest - Java Virtual Machine Release"
-# Name "RWMutexTest - Java Virtual Machine Debug"
-# Begin Source File
-
-SOURCE=.\RWMutexTest.java
-# End Source File
-# End Target
-# End Project
diff --git a/java/tests/Concurrency/RWMutexTest.java b/java/tests/Concurrency/RWMutexTest.java deleted file mode 100644 index ab28c9a83fd..00000000000 --- a/java/tests/Concurrency/RWMutexTest.java +++ /dev/null @@ -1,93 +0,0 @@ -/************************************************* - * - * = PACKAGE - * tests.Concurrency - * - * = FILENAME - * RWMutexTest.java - * - *@author Ross Dargahi (rossd@krinfo.com) - * - *************************************************/ -package tests.Concurrency; - -import JACE.OS.*; -import JACE.Concurrency.*; - -class TestThread extends Thread -{ - TestThread(String name, - boolean writer, - RWMutex lock) - { - super (name); - mWriter = writer; - mLock = lock; - } - - public void run() - { - for (int i = 0; i < 10; i++) - { - try - { - if (!mWriter) - { - mLock.acquireRead(); - ACE.DEBUG (getName() + ": Acquired Read Lock"); - - int sleepTime = i * 100; - sleep (sleepTime); - - mLock.release (); - ACE.DEBUG (getName () + ": Released Read Lock"); - } - else - { - mLock.acquireWrite (); - ACE.DEBUG (getName () + ": Acquired Write Lock"); - - int sleepTime = i * 100; - sleep (sleepTime); - - mLock.release (); - ACE.DEBUG (getName () + ": Released Write Lock"); - } - } - catch (InterruptedException ex) - { - ACE.ERROR ("InterruptedException"); - } - } - } - - RWMutex mLock; - boolean mWriter; -} - -public class RWMutexTest -{ - public static void main(String [] args) - { - RWMutex lock = new RWMutex(); - - TestThread t1 = new TestThread ("1", false, lock); - TestThread t2 = new TestThread ("2", false, lock); - TestThread t3 = new TestThread ("3", false, lock); - TestThread t4 = new TestThread ("4", true, lock); - TestThread t5 = new TestThread ("5", false, lock); - TestThread t6 = new TestThread ("6", false, lock); - TestThread t7 = new TestThread ("7", false, lock); - TestThread t8 = new TestThread ("8", true, lock); - - t1.start (); - t2.start (); - t3.start (); - t4.start (); - t5.start (); - t6.start (); - t7.start (); - t8.start (); - } -} - diff --git a/java/tests/Concurrency/SemaphoreTest.dsp b/java/tests/Concurrency/SemaphoreTest.dsp deleted file mode 100644 index 546ad0e11be..00000000000 --- a/java/tests/Concurrency/SemaphoreTest.dsp +++ /dev/null @@ -1,73 +0,0 @@ -# Microsoft Developer Studio Project File - Name="SemaphoreTest" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 5.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Java Virtual Machine Java Project" 0x0809
-
-CFG=SemaphoreTest - Java Virtual Machine Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "SemaphoreTest.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "SemaphoreTest.mak"\
- CFG="SemaphoreTest - Java Virtual Machine Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "SemaphoreTest - Java Virtual Machine Release" (based on\
- "Java Virtual Machine Java Project")
-!MESSAGE "SemaphoreTest - Java Virtual Machine Debug" (based on\
- "Java Virtual Machine Java Project")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-JAVA=jvc.exe
-
-!IF "$(CFG)" == "SemaphoreTest - Java Virtual Machine Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir ""
-# PROP BASE Intermediate_Dir ""
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\classes-r"
-# PROP Intermediate_Dir ""
-# PROP Target_Dir ""
-# ADD BASE JAVA /O
-# ADD JAVA /O
-
-!ELSEIF "$(CFG)" == "SemaphoreTest - Java Virtual Machine Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir ""
-# PROP BASE Intermediate_Dir ""
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\classes"
-# PROP Intermediate_Dir ""
-# PROP Target_Dir ""
-# ADD BASE JAVA /g
-# ADD JAVA /g
-
-!ENDIF
-
-# Begin Target
-
-# Name "SemaphoreTest - Java Virtual Machine Release"
-# Name "SemaphoreTest - Java Virtual Machine Debug"
-# Begin Source File
-
-SOURCE=.\SemaphoreTest.java
-# End Source File
-# End Target
-# End Project
diff --git a/java/tests/Concurrency/SemaphoreTest.java b/java/tests/Concurrency/SemaphoreTest.java deleted file mode 100644 index b45929daa55..00000000000 --- a/java/tests/Concurrency/SemaphoreTest.java +++ /dev/null @@ -1,102 +0,0 @@ -/************************************************* - * - * = PACKAGE - * tests.Concurrency - * - * = FILENAME - * SemaphoreTest.java - * - *@author Prashant Jain - * - *************************************************/ -package tests.Concurrency; - -import java.io.*; -import JACE.OS.*; -import JACE.Concurrency.*; - -class SemaphoreWriter extends Thread -{ - SemaphoreWriter (int nIterations, Semaphore s) - { - this.nIterations_ = nIterations; - this.s_ = s; - } - - public void run () - { - for (int i = 1; i <= this.nIterations_; i++) - { - // Acquire the semaphore (will block until it gets it) - try - { - this.s_.acquire (); - } - catch (InterruptedException e) - { - ACE.ERROR (e); - } - - SemaphoreTest.counter++; - ACE.DEBUG (Thread.currentThread ().toString () + - " acquired semaphore in iteration " + i + - ", counter = " + SemaphoreTest.counter); - - try - { - Thread.sleep (1); - } - catch (InterruptedException e) - { - } - - // Release the semaphore - this.s_.release (); - ACE.DEBUG (Thread.currentThread ().toString () + - " released semaphore in iteration " + i); - try - { - Thread.sleep (1); - } - catch (InterruptedException e) - { - } - - } - } - - int nIterations_; - Semaphore s_; -} - -public class SemaphoreTest -{ - public static void main (String args[]) - { - int nThreads = 1; - int count = 1; - int nIterations = 100; - int i; - try - { - if (args.length == 3) - { - nThreads = Integer.parseInt (args[0]); - count = Integer.parseInt (args[1]); - nIterations = Integer.parseInt (args[2]); - } - } - catch (NumberFormatException e) - { - ACE.ERROR ("Illegal argument."); - } - - // Create a lock - Semaphore s = new Semaphore (count); - - // Spawn off n_threads - for (i = 0; i < nThreads; i++) - new SemaphoreWriter (nIterations, s).start (); - } - public static int counter; -} diff --git a/java/tests/Concurrency/TokenTest.dsp b/java/tests/Concurrency/TokenTest.dsp deleted file mode 100644 index 2fd69ce5ee5..00000000000 --- a/java/tests/Concurrency/TokenTest.dsp +++ /dev/null @@ -1,72 +0,0 @@ -# Microsoft Developer Studio Project File - Name="TokenTest" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 5.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Java Virtual Machine Java Project" 0x0809
-
-CFG=TokenTest - Java Virtual Machine Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "TokenTest.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "TokenTest.mak" CFG="TokenTest - Java Virtual Machine Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "TokenTest - Java Virtual Machine Release" (based on\
- "Java Virtual Machine Java Project")
-!MESSAGE "TokenTest - Java Virtual Machine Debug" (based on\
- "Java Virtual Machine Java Project")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-JAVA=jvc.exe
-
-!IF "$(CFG)" == "TokenTest - Java Virtual Machine Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir ""
-# PROP BASE Intermediate_Dir ""
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\classes-r"
-# PROP Intermediate_Dir ""
-# PROP Target_Dir ""
-# ADD BASE JAVA /O
-# ADD JAVA /O
-
-!ELSEIF "$(CFG)" == "TokenTest - Java Virtual Machine Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir ""
-# PROP BASE Intermediate_Dir ""
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\classes"
-# PROP Intermediate_Dir ""
-# PROP Target_Dir ""
-# ADD BASE JAVA /g
-# ADD JAVA /g
-
-!ENDIF
-
-# Begin Target
-
-# Name "TokenTest - Java Virtual Machine Release"
-# Name "TokenTest - Java Virtual Machine Debug"
-# Begin Source File
-
-SOURCE=.\TokenTest.java
-# End Source File
-# End Target
-# End Project
diff --git a/java/tests/Concurrency/TokenTest.java b/java/tests/Concurrency/TokenTest.java deleted file mode 100644 index ededed9fed9..00000000000 --- a/java/tests/Concurrency/TokenTest.java +++ /dev/null @@ -1,73 +0,0 @@ -/************************************************* - * - * = PACKAGE - * tests.Concurrency - * - * = FILENAME - * TokenTest.java - * - *@author Prashant Jain - * - *************************************************/ -package tests.Concurrency; - -import java.io.*; -import JACE.OS.*; -import JACE.Concurrency.*; - -class MyToken extends Token -{ - public void sleepHook () - { - ACE.DEBUG (Thread.currentThread () + " blocking, sleepHook called"); - } -} - -public class TokenTest implements Runnable -{ - public void run () - { - try - { - this.token_.acquire (); - ACE.DEBUG (Thread.currentThread () + " acquired token"); - this.token_.acquire (); - ACE.DEBUG (Thread.currentThread () + " acquired token"); - Thread.sleep (100); - - this.token_.renew (1); - - this.token_.release (); - ACE.DEBUG (Thread.currentThread () + " released token"); - this.token_.release (); - ACE.DEBUG (Thread.currentThread () + " released token"); - } - catch (InterruptedException e) - { - this.token_.release (); - } - } - - public static void main (String args []) - { - ThreadManager tm = new ThreadManager (); - int n = 1; - try - { - if (args.length == 1) - { - n = Integer.parseInt (args[0]); - } - } - catch (NumberFormatException e) - { - ACE.ERROR ("Illegal argument."); - } - - tm.spawnN (n, - new TokenTest (), - false); - } - - private MyToken token_ = new MyToken (); -} |