Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6357433

FileInputStream.open(String) should use FILE_SHARE_DELETE share flag (win)

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P3 P3
    • None
    • 1.2.0, 1.2.2, 1.3.0, 1.3.1, 1.4.2, 7
    • core-libs
    • None
    • Cause Known
    • generic, x86
    • generic, windows_98, windows_nt, windows_2000

      A customer has pointed out on the java.net forums that opening a file on Windows using a FileInputStream causes other processes to be unable to delete the file. This is intended behavior as the code is currently written, as the sharing flags specified during the opening of the file are FILE_SHARE_READ and FILE_SHARE_WRITE. See io_util_md.c, fileOpen. However, Windows 2000 supplies a new flag, FILE_SHARE_DELETE, which allows another process to delete the file while it is still open. The customer would like to have this functionality available because they are parsing logs generated by another process and when the second process attempts to rotate its logs it can not delete the old log because the JVM has it open. There are really no convenient workarounds for this problem as all approaches ultimately involve using a FileInputStream at least briefly to get the current data from the log and if the target process attempts to delete the file while it is open it will be unable to do so.

      The associated thread is
      http://forums.java.net/jive/thread.jspa?threadID=2150&tstart=0

            alanb Alan Bateman
            kbr Kenneth Russell (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: