14
Задача
Java Multithreading, ниво, урок
The world is boring for boring people
Analyze BlockingQueue.
In the image and likeness of the Producer class, create a Consumer class that will output data from a BlockingQueue to the console.
14
Задача
Java Multithreading, ниво, урок
The world doesn't change, we change
Analyze ConcurrentHashMap.
In a separate file, create a Producer class that will:
1. every half second, add a key and value to a ConcurrentHashMap, where the key is the counter starting from 1, and the value is a phrase like "Some text for i", e.g. "Some text for 1".
14
Задача
Java Multithreading, ниво, урок
The whole world is a comedy
Read more about java.util.concurrent.locks.Lock at http://docs.oracle.com/ (Everything there is in Javadocs!)
Write the implementation of the someMethod() method:
1. try to acquire the lock;
1.1. if the lock is busy, then call the actionIfLockIsBusy() method;
1.2. if the lock is free, then.