Java Reference
In-Depth Information
The notify() or notifyAll() method can only be called from a method or code block
that is synchronized to the same object as the method or block that contains the wait()
method that halted the thread.
You can modify the relative priority of a thread by calling its setPriority() method. This
only has an effect on execution in environments that support priority scheduling.
Exercises
1.
Modify the last example in the chapter so that each transaction is a debit or a credit at random.
2.
Modify the result of the previous exercise to incorporate an array of clerks, each running in
their own thread, and each able to handle both debits and credits.
3.
Extend the result of the previous exercise to incorporate two supervisors for two teams of
clerks, where the supervisors each run in their own thread. The supervisor threads should
originate transactions and pass them to the clerks they supervise.
Search WWH ::




Custom Search