Skip to content
Ravnary
A Knowledge Platform
Categories
Learn
Cheatsheets
Paths
Favourites
Review
Community
Colour theme
Light
Dark
System
Learn
Java Concurrency
Locks
Quiz
Q 01
/ 05
Advanced
Question 1 of 5. 0 correct, 0 incorrect.
Match each requirement to the locking mechanism that can express it.
Guard a short block, with no chance of forgetting to release
Choose…
`ReentrantLock.tryLock` with a timeout
`ReentrantLock.lockInterruptibly`
`ReentrantLock`
`synchronized`
Give up waiting after five seconds
Choose…
`ReentrantLock.tryLock` with a timeout
`ReentrantLock.lockInterruptibly`
`ReentrantLock`
`synchronized`
Let a waiting thread be interrupted during shutdown
Choose…
`ReentrantLock.tryLock` with a timeout
`ReentrantLock.lockInterruptibly`
`ReentrantLock`
`synchronized`
Acquire in one method and release in another
Choose…
`ReentrantLock.tryLock` with a timeout
`ReentrantLock.lockInterruptibly`
`ReentrantLock`
`synchronized`
Check answer
Home
Learn
Paths
Saved
Community