156 |
|
*/ |
157 |
|
public void testWriteLockInterruptibly_Interrupted() { |
158 |
|
final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); |
159 |
– |
lock.writeLock().lock(); |
159 |
|
Thread t = new Thread(new Runnable() { |
160 |
|
public void run() { |
161 |
|
try { |
162 |
|
lock.writeLock().lockInterruptibly(); |
163 |
< |
threadShouldThrow(); |
163 |
> |
lock.writeLock().unlock(); |
164 |
> |
lock.writeLock().lockInterruptibly(); |
165 |
> |
lock.writeLock().unlock(); |
166 |
|
} catch(InterruptedException success){} |
167 |
|
} |
168 |
|
}); |
169 |
|
try { |
170 |
+ |
lock.writeLock().lock(); |
171 |
|
t.start(); |
172 |
|
t.interrupt(); |
173 |
|
lock.writeLock().unlock(); |
178 |
|
} |
179 |
|
|
180 |
|
/** |
181 |
< |
* timed write-trylock is interruptible |
181 |
> |
* timed write-tryLock is interruptible |
182 |
|
*/ |
183 |
|
public void testWriteTryLock_Interrupted() { |
184 |
|
final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); |
211 |
|
public void run() { |
212 |
|
try { |
213 |
|
lock.readLock().lockInterruptibly(); |
212 |
– |
threadShouldThrow(); |
214 |
|
} catch(InterruptedException success){} |
215 |
|
} |
216 |
|
}); |
225 |
|
} |
226 |
|
|
227 |
|
/** |
228 |
< |
* timed read-trylock is interruptible |
228 |
> |
* timed read-tryLock is interruptible |
229 |
|
*/ |
230 |
|
public void testReadTryLock_Interrupted() { |
231 |
|
final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); |
249 |
|
|
250 |
|
|
251 |
|
/** |
252 |
< |
* write-trylock fails if locked |
252 |
> |
* write-tryLock fails if locked |
253 |
|
*/ |
254 |
|
public void testWriteTryLockWhenLocked() { |
255 |
|
final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); |
269 |
|
} |
270 |
|
|
271 |
|
/** |
272 |
< |
* read-trylock fails if locked |
272 |
> |
* read-tryLock fails if locked |
273 |
|
*/ |
274 |
|
public void testReadTryLockWhenLocked() { |
275 |
|
final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); |
379 |
|
|
380 |
|
|
381 |
|
/** |
382 |
< |
* Read trylock succeeds if readlocked but not writelocked |
382 |
> |
* Read tryLock succeeds if readlocked but not writelocked |
383 |
|
*/ |
384 |
|
public void testTryLockWhenReadLocked() { |
385 |
|
final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); |
402 |
|
|
403 |
|
|
404 |
|
/** |
405 |
< |
* write trylock fails when readlocked |
405 |
> |
* write tryLock fails when readlocked |
406 |
|
*/ |
407 |
|
public void testWriteTryLockWhenReadLocked() { |
408 |
|
final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); |
424 |
|
|
425 |
|
|
426 |
|
/** |
427 |
< |
* write timed trylock times out if locked |
427 |
> |
* write timed tryLock times out if locked |
428 |
|
*/ |
429 |
|
public void testWriteTryLock_Timeout() { |
430 |
|
final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); |
448 |
|
} |
449 |
|
|
450 |
|
/** |
451 |
< |
* read timed trylock times out if write-locked |
451 |
> |
* read timed tryLock times out if write-locked |
452 |
|
*/ |
453 |
|
public void testReadTryLock_Timeout() { |
454 |
|
final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); |