Original
 1 public boolean enterWhenUninterruptibly(Guard guard, long time, TimeUnit unit) {
 2   if (guard.monitor != this) {
 3     throw new IllegalMonitorStateException();
 4   }
 5   final ReentrantLock lock = this.lock;
 6   boolean reentrant = lock.isHeldByCurrentThread();
 7   long startNanos = System.nanoTime();
 8   long timeoutNanos = unit.toNanos(time);
 9   long remainingNanos = timeoutNanos;
10   boolean interruptIgnored = false;
11   try {
12     while (true) {
13       try {
14         if (lock.tryLock(remainingNanos, TimeUnit.NANOSECONDS)) {
15           break;
16         } else {
17           return false;
18         }
19       } catch (InterruptedException ignored) {
20         interruptIgnored = true;
21       } finally {
22         remainingNanos = (timeoutNanos - (System.nanoTime() - startNanos));
23       }
24     }
25     boolean satisfied;
26     try {
27       satisfied = waitUninterruptibly(guard, remainingNanos, reentrant);
28     } catch (Throwable throwable) {
29       lock.unlock();
30       throw Throwables.propagate(throwable);
31     }
   
   
   
31 
32     if (satisfied) {
33       return true;
34     } else {
35       lock.unlock();
36       return false;
37     }
38   } finally {
39     if (interruptIgnored) {
40       Thread.currentThread().interrupt();
41     }
42   }
43 }
44 
Modified
 1 public boolean enterWhenUninterruptibly(Guard guard, long time, TimeUnit unit) {
 2     if (guard.monitor != this) {
 3       throw new IllegalMonitorStateException();
 4     }
 5     final ReentrantLock lock = this.lock;
 6     boolean reentrant = lock.isHeldByCurrentThread();
 7     long startNanos = System.nanoTime();
 8     long timeoutNanos = unit.toNanos(time);
 9     long remainingNanos = timeoutNanos;
10     boolean interruptIgnored = false;
11     try {
12       while (true) {
13         try {
14           if (lock.tryLock(remainingNanos, TimeUnit.NANOSECONDS)) {
15             break;
16           } else {
17             return false;
18           }
19         } catch (InterruptedException ignored) {
20           interruptIgnored = true;
21         } finally {
22           remainingNanos = (timeoutNanos - (System.nanoTime() - startNanos));
23         }
24       }
25       boolean satisfied = false;
26       try {
27         satisfied = waitUninterruptibly(guard, remainingNanos, reentrant);
28       } 
   
   
28 finally {
29         if (!satisfied) {
30           lock.unlock();
31         }
32       }
   
33       return satisfied;
   
   
   
   
34     } finally {
35       if (interruptIgnored) {
36         Thread.currentThread().interrupt();
37       }
38     }
39   }
40