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

WatchService on Windows keeps dir open, parent dir cannot be renamed

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 7
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_7

      Description

      FULL PRODUCT VERSION :
      java version "1.7.0-ea"
      Java(TM) SE Runtime Environment (build 1.7.0-ea-b143)
      Java HotSpot(TM) 64-Bit Server VM (build 21.0-b13, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7600]

      A DESCRIPTION OF THE PROBLEM :
      On Windows, when a dir is registered a with a watch service, it's kept open by the Java process. Then it is impossible to rename its parent dir.

      For example, if we have a program watching a dir tree of source files during development, then the subdirs cannot be renamed meanwhile. That'll be very frustrating to the developer.

      If WatchService prevents dir rename, its scope of application is severely limited, so I'm considering it a bug for now.

        To reproduce, create a dir chain d1\d2\d3, use the tutorial example http://download.oracle.com/javase/tutorial/essential/io/examples/WatchDir.java

      >java WatchDir -r d1

      Then attempt to rename d2 will fail, on command line

      >rename d2 d22
      Access is denied.

      In explorer, the error is "The action can't be completed because the folder or a file in it is open in another program". Indeed procexp reports that all 3 folders are open by the java process.


      REPRODUCIBILITY :
      This bug can be reproduced always.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: