public class SemaphoreRunnable extends Object implements Runnable
Runnable
通过设置信号量,可以限制可以访问某些资源(物理或逻辑的)线程数目。 例如:设置信号量为2,表示最多有两个线程可以同时执行方法逻辑,其余线程等待,直到此线程逻辑执行完毕
SemaphoreRunnable(Runnable runnable, Semaphore semaphore)
Semaphore
getSemaphore()
void
run()
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public SemaphoreRunnable(Runnable runnable, Semaphore semaphore)
runnable
semaphore
public Semaphore getSemaphore()
public void run()
run
Copyright © 2024. All rights reserved.