< prev index next >

src/java.base/solaris/classes/sun/nio/fs/SolarisWatchService.java

Print this page




 255         @Override
 256         void wakeup() throws IOException {
 257             // write to port to wakeup polling thread
 258             try {
 259                 portSend(port, 0);
 260             } catch (UnixException x) {
 261                 throw new IOException(x.errorString());
 262             }
 263         }
 264 
 265         @Override
 266         Object implRegister(Path obj,
 267                             Set<? extends WatchEvent.Kind<?>> events,
 268                             WatchEvent.Modifier... modifiers)
 269         {
 270             // no modifiers supported at this time
 271             if (modifiers.length > 0) {
 272                 for (WatchEvent.Modifier modifier: modifiers) {
 273                     if (modifier == null)
 274                         return new NullPointerException();
 275                     if (modifier instanceof com.sun.nio.file.SensitivityWatchEventModifier)
 276                         continue; // ignore

 277                     return new UnsupportedOperationException("Modifier not supported");
 278                 }
 279             }

 280 
 281             UnixPath dir = (UnixPath)obj;
 282 
 283             // check file is directory
 284             UnixFileAttributes attrs = null;
 285             try {
 286                 attrs = UnixFileAttributes.get(dir, true);
 287             } catch (UnixException x) {
 288                 return x.asIOException(dir);
 289             }
 290             if (!attrs.isDirectory()) {
 291                 return new NotDirectoryException(dir.getPathForExceptionMessage());
 292             }
 293 
 294             // if already registered then update the events and return existing key
 295             UnixFileKey fileKey = attrs.fileKey();
 296             SolarisWatchKey watchKey = fileKey2WatchKey.get(fileKey);
 297             if (watchKey != null) {
 298                 try {
 299                     updateEvents(watchKey, events);




 255         @Override
 256         void wakeup() throws IOException {
 257             // write to port to wakeup polling thread
 258             try {
 259                 portSend(port, 0);
 260             } catch (UnixException x) {
 261                 throw new IOException(x.errorString());
 262             }
 263         }
 264 
 265         @Override
 266         Object implRegister(Path obj,
 267                             Set<? extends WatchEvent.Kind<?>> events,
 268                             WatchEvent.Modifier... modifiers)
 269         {
 270             // no modifiers supported at this time
 271             if (modifiers.length > 0) {
 272                 for (WatchEvent.Modifier modifier: modifiers) {
 273                     if (modifier == null)
 274                         return new NullPointerException();
 275                     if (!ExtendedOptions.SENSITIVITY_HIGH.matches(modifier) &&
 276                             !ExtendedOptions.SENSITIVITY_MEDIUM.matches(modifier) &&
 277                             !ExtendedOptions.SENSITIVITY_LOW.matches(modifier)) {
 278                         return new UnsupportedOperationException("Modifier not supported");
 279                     }
 280                 }
 281             }
 282 
 283             UnixPath dir = (UnixPath)obj;
 284 
 285             // check file is directory
 286             UnixFileAttributes attrs = null;
 287             try {
 288                 attrs = UnixFileAttributes.get(dir, true);
 289             } catch (UnixException x) {
 290                 return x.asIOException(dir);
 291             }
 292             if (!attrs.isDirectory()) {
 293                 return new NotDirectoryException(dir.getPathForExceptionMessage());
 294             }
 295 
 296             // if already registered then update the events and return existing key
 297             UnixFileKey fileKey = attrs.fileKey();
 298             SolarisWatchKey watchKey = fileKey2WatchKey.get(fileKey);
 299             if (watchKey != null) {
 300                 try {
 301                     updateEvents(watchKey, events);


< prev index next >