/**
* Make sure that our locks don't throw interrupted exceptions.
*/
private void testLockInterrupt(final ReadWriteLock lock) {
JobQueue jobQueue = new JobQueue();
Thread jobQueueThread = new Thread(jobQueue);
jobQueueThread.start();
lock.writeLock().lock();
// interrupt that thread
jobQueueThread.interrupt();
// create a thread that will block waiting on Lock.lock()
JobQueue.Job result = jobQueue.invokeLater(new LockALockRunnable(lock.writeLock()));
// make sure there's contention on the lock
sleep(1000);
// release the lock, this will cause our other job to finish
lock.writeLock().unlock();
// flush the queue
jobQueue.flush();
// validate that our thread didn't throw interrupted exception
assertNull(result.getThrown());
// validate that the thread is still interrupted
jobQueue.invokeAndWait(new FailIfNotInterruptedRunnable());
}