Package java.nio.file

Examples of java.nio.file.WatchKey.reset()


                //TODO: unregister deleted directories?
                task.updateProgress(++count);
              }
             
            }
            if (!key.reset()) {
              // exit loop if the key is not valid
              // e.g. if the directory was deleted
              break;
            }
          }
View Full Code Here


                    x.printStackTrace();
                }
            }

            // reset key and remove from set if directory no longer accessible
            boolean valid = key.reset();
            if (!valid) {
                debug("Removing key " + key + " and dir " + dir + " from keys");
                keys.remove(key);

                // all directories are inaccessible
View Full Code Here

                                log.error("Unexpected event type: {}", kind);
                                continue;
                            }
                        }
                    } finally {
                        if (!key.reset()) {
                            pathTable.remove(key);
                        }
                    }
                } catch (InterruptedException | ClosedWatchServiceException e) {
                    log.trace("shutting down...");
View Full Code Here

                }

            }

            // reset watchKey and remove from set if directory no longer accessible
            boolean valid = watchKey.reset();
            if (!valid) {
                mapOfWatchKeysToPaths.remove(watchKey);

                // all directories are inaccessible
                if (mapOfWatchKeysToPaths.isEmpty()) {
View Full Code Here

          importer.setDir(fullPath.toString());
          DomainResults result = importer.importFile();
          result.saveResult(fullPath.toFile().getName().toString().replace(".dat", ""), dirOut);
        }
      }
      boolean valid = key.reset();
      if (!valid) {
        break;
      }

    }
View Full Code Here

          WatchEvent<Path> ev = (WatchEvent<Path>) event;
          if(dir.resolve(ev.context()).equals(inputPath)) {
            generate();
          }
        }
        valid = key.reset();
      }
    } catch (IOException | InterruptedException e) {
      throw new MojoExecutionException(e.getMessage(), e);
    }
  }
View Full Code Here

                            fireEntryDeleted(connectorChangeSet, resolvedPath);
                        } else if (kind == ENTRY_MODIFY) {
                            fireEntryModified(connectorChangeSet, resolvedPath);
                        }
                    }
                    watchKey.reset();
                    connectorChangeSet.publish(null);
                } catch (InterruptedException e) {
                    Thread.interrupted();
                    watchService.close();
                    break;
View Full Code Here

    if (keyEvents.size() == expected.size() || alternate.isEmpty()) {
      assertThat(keyEvents).containsExactlyElementsIn(expected);
    } else {
      assertThat(keyEvents).containsExactlyElementsIn(alternate);
    }
    key.reset();
  }

  private static void ensureTimeToPoll() {
    Uninterruptibles.sleepUninterruptibly(40, MILLISECONDS);
  }
View Full Code Here

                    } else {
                        if (kind == ENTRY_CREATE || kind == ENTRY_MODIFY)
                            LOG.warn("Filesystem monitor: A non-jar item " + child.getFileName() + " has been placed in the modules directory " + moduleDir);
                    }
                }
                if (!key.reset())
                    throw new IOException("Directory " + moduleDir + " is no longer accessible");
            }
        } catch (Exception e) {
            LOG.error("Filesystem monitor thread terminated with an exception", e);
            throw Exceptions.rethrow(e);
View Full Code Here

                    }
                }
            }

            // reset key and remove from set if directory no longer accessible
            boolean valid = key.reset();
            if (!valid) {
                monitoredKeys.remove(key);
                monitoredDirs.remove(dir.toString());

                // all directories are inaccessible
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.