Enters this monitor if the guard is satisfied. Blocks indefinitely acquiring the lock, but does not wait for the guard to be satisfied, and may be interrupted. @return whether the monitor was entered, which guarantees that the guard is now satisfied @throws InterruptedException if interrupted while
(Guard guard)
| 653 | |
| 654 | |
| 655 | public boolean enterIfInterruptibly(Guard guard) throws InterruptedException { |
| 656 | if (guard.monitor != this) { |
| 657 | throw new IllegalMonitorStateException(); |
| 658 | } |
| 659 | final ReentrantLock lock = this.lock; |
| 660 | lock.lockInterruptibly(); |
| 661 | boolean satisfied = false; |
| 662 | try { |
| 663 | return satisfied = guard.isSatisfied(); |
| 664 | } finally { |
| 665 | if (!satisfied) { |
| 666 | lock.unlock(); |
| 667 | } |
| 668 | } |
| 669 | } |
| 670 | |
| 671 | /** |
| 672 | * Enters this monitor if the guard is satisfied. Blocks at most the given time acquiring the |
nothing calls this directly
no test coverage detected