一、前言
关于apache的commons-pool2包中org.apache.commons.pool2.impl.InterruptibleReentrantLock多线程并发同步队列锁,继承java.util.concurrent.locks.ReentrantLock分类,并定义针对指定java.util.concurrent.locks.Condition的等待线程中断停止操作。
二、源码说明
package org.apache.commons.pool2.impl;@b@@b@import java.util.Collection;@b@import java.util.concurrent.locks.Condition;@b@import java.util.concurrent.locks.ReentrantLock;@b@@b@class InterruptibleReentrantLock extends ReentrantLock@b@{@b@ private static final long serialVersionUID = 1L;@b@@b@ public void interruptWaiters(Condition condition)@b@ {@b@ Collection threads = getWaitingThreads(condition);@b@ for (Thread thread : threads)@b@ thread.interrupt();@b@ }@b@}