16
Sarcină
Java Multithreading, nivel, lecţie
Producer–consumer
In the TransferObject class, arrange calls to the wait/notify/notifyAll methods
to ensure the sequential production and consumption of objects.
In the run methods of the ConsumerTask and ProducerTask classes, create the necessary synchronized blocks.
16
Sarcină
Java Multithreading, nivel, lecţie
Arrange wait and notify methods
Arrange wait and notify methods.
Example output:
Thread-0 MailServer received: [Person [Thread-1] wrote an email 'AAA'] in 1001 ms.
16
Sarcină
Java Multithreading, nivel, lecţie
CountDownLatch
You are given a standard implementation of the wait-notify pattern.
Read about CountDownLatch and use the latch field to rewrite the body of the someMethod method.
Remove all unnecessary code from the class.