Java multi-threads usage of tryLock

preview_player
Показать описание
In this tutorial we explain how to use TryLock in java thread programming. Usually Lock is block other thread from entering critical section in the same time. So the thread get blocked until the thread which acquire the lock first release it by calling unlock.

However, tryLock has two ways of definition: without parameters means check the thread can acquire the lock or move to next step. There another way of calling the same method which by send two parameters time as number and time unit. This will block the thread that trying to acquire busy lock for given time.
Рекомендации по теме
Комментарии
Автор

Bro i have one doubt my else block is not executring

KK-hsqr