changeset 6817:3ff488283a24

8028208: (aio) Assertion in clearPendingIoMap when closing at around time file lock is acquired immediately (win) Reviewed-by: chegar
author igerasim
date Thu, 19 Dec 2013 01:55:01 +0400
parents cd2d8f23e93c
children b148babc052a
files src/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java	Thu Dec 19 15:21:08 2013 +0400
+++ b/src/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java	Thu Dec 19 01:55:01 2013 +0400
@@ -230,6 +230,7 @@
         @Override
         public void run() {
             long overlapped = 0L;
+            boolean pending = false;
             try {
                 begin();
 
@@ -243,6 +244,7 @@
                                      overlapped);
                     if (n == IOStatus.UNAVAILABLE) {
                         // I/O is pending
+                        pending = true;
                         return;
                     }
                     // acquired lock immediately
@@ -252,10 +254,10 @@
             } catch (Throwable x) {
                 // lock failed or channel closed
                 removeFromFileLockTable(fli);
-                if (overlapped != 0L)
-                    ioCache.remove(overlapped);
                 result.setFailure(toIOException(x));
             } finally {
+                if (!pending && overlapped != 0L)
+                    ioCache.remove(overlapped);
                 end();
             }