单项选择题
在ReentrantLock 中,如何通过构造方法创建一个公平锁?()
A.new ReentrantLock()
B.new ReentrantLock(true)
C.new ReentrantLock(false)
D.new ReentrantLock(ReentrantLock.FAIR)
点击查看答案&解析
相关考题
-
单项选择题
AbstractQueuedSynchronizer 中的tryAcquireShared 方法和tryReleaseShared 方法是哪种同步模式下使用的?()
A.独占模式
B.共享模式
C.互斥模式
D.读写模式 -
单项选择题
AbstractQueuedSynchronizer 使用了()的等待队列机制来实现线程在同步状态上的等待和唤醒操作。
A.先进先出(FIFO)
B.先进后出(FILO)
C.后进先出(LIFO)
D.左进右出(LIRO) -
单项选择题
在Java多线程中,一般推荐使用()替换Random来生成随机数。
A.Math
B.ThreadLocal
C.ThreadLocalRandom
D.LocalRandom
