src/java.base/windows/classes/sun/nio/fs/WindowsWatchService.java

Print this page
rev 12972 : 8140606: Update library code to use internal Unsafe
Reviewed-by: duke


  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.nio.fs;
  27 
  28 import java.io.IOException;
  29 import java.nio.file.NotDirectoryException;
  30 import java.nio.file.Path;
  31 import java.nio.file.StandardWatchEventKinds;
  32 import java.nio.file.WatchEvent;
  33 import java.nio.file.WatchKey;
  34 import java.util.HashMap;
  35 import java.util.Map;
  36 import java.util.Set;
  37 
  38 import com.sun.nio.file.ExtendedWatchEventModifier;
  39 import sun.misc.Unsafe;
  40 
  41 import static sun.nio.fs.WindowsNativeDispatcher.*;
  42 import static sun.nio.fs.WindowsConstants.*;
  43 
  44 /*
  45  * Win32 implementation of WatchService based on ReadDirectoryChangesW.
  46  */
  47 
  48 class WindowsWatchService
  49     extends AbstractWatchService
  50 {
  51     private static final int WAKEUP_COMPLETION_KEY = 0;
  52 
  53     // background thread to service I/O completion port
  54     private final Poller poller;
  55 
  56     /**
  57      * Creates an I/O completion port and a daemon thread to service it
  58      */
  59     WindowsWatchService(WindowsFileSystem fs) throws IOException {




  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.nio.fs;
  27 
  28 import java.io.IOException;
  29 import java.nio.file.NotDirectoryException;
  30 import java.nio.file.Path;
  31 import java.nio.file.StandardWatchEventKinds;
  32 import java.nio.file.WatchEvent;
  33 import java.nio.file.WatchKey;
  34 import java.util.HashMap;
  35 import java.util.Map;
  36 import java.util.Set;
  37 
  38 import com.sun.nio.file.ExtendedWatchEventModifier;
  39 import jdk.internal.misc.Unsafe;
  40 
  41 import static sun.nio.fs.WindowsNativeDispatcher.*;
  42 import static sun.nio.fs.WindowsConstants.*;
  43 
  44 /*
  45  * Win32 implementation of WatchService based on ReadDirectoryChangesW.
  46  */
  47 
  48 class WindowsWatchService
  49     extends AbstractWatchService
  50 {
  51     private static final int WAKEUP_COMPLETION_KEY = 0;
  52 
  53     // background thread to service I/O completion port
  54     private final Poller poller;
  55 
  56     /**
  57      * Creates an I/O completion port and a daemon thread to service it
  58      */
  59     WindowsWatchService(WindowsFileSystem fs) throws IOException {