Examples of pollEvents()


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

  private void checkForChanges() {
    final WatchKey key = folderWatcher.poll();

    if (key != null) {
      for (WatchEvent<?> watchEvent : key.pollEvents()) {
        final Path filePath = (Path) watchEvent.context();
        final WatchEvent.Kind<?> kind = watchEvent.kind();
        log.fine(kind + " : " + filePath);
        handleFileChange(kind,
                         new File(iosServerConfiguration.getAppFolderToMonitor(),
View Full Code Here

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

  protected void checkCreated()
  {
    WatchKey watchKey = watchService.poll();
    if (watchKey != null)
    {
      List<WatchEvent<?>> events = watchKey.pollEvents();
      for (WatchEvent<?> event : events)
      {
        WatchEvent.Kind<?> eventKind = event.kind();
        Path eventPath = (Path) event.context();
View Full Code Here

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

          }

          synchronized (changedFiles) {
            Path containingDirectory = pathsByWatchKey.get(watchKey);

            for (WatchEvent<?> watchEvent : watchKey.pollEvents()) {
              WatchEvent.Kind<?> eventKind = watchEvent.kind();

              if (eventKind == StandardWatchEventKinds.OVERFLOW) {
                setFailed(
                    new RuntimeException("Changes occurred faster than they could be recorded."));
View Full Code Here

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

  public void run() {
        while (active) {
      try {
        WatchKey watchKey = watchService.poll(sleepTime, TimeUnit.MILLISECONDS);
        if(watchKey!=null){
          List<WatchEvent<?>> watchEvents = watchKey.pollEvents();
          for(WatchEvent<?> watchEvent : watchEvents){
            WatchEvent.Kind<?> kind = watchEvent.kind();
                    if (kind == StandardWatchEventKinds.OVERFLOW) {
                      // TODO how is this supposed to be handled? I think the best thing to do is ignore it, but I'm not positive
                      LOG.warn("WatchService Overflow occurred");
View Full Code Here

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

         }
         catch (InterruptedException e)
         {
            break;
         }
         List<WatchEvent<?>> pollEvents = key.pollEvents();
         for (WatchEvent<?> event : pollEvents)
         {
            WatchEvent.Kind<?> kind = event.kind();
            if (kind == OVERFLOW)
            {
View Full Code Here

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

         }
         catch (InterruptedException e)
         {
            break;
         }
         List<WatchEvent<?>> pollEvents = key.pollEvents();
         for (WatchEvent<?> event : pollEvents)
         {
            WatchEvent.Kind<?> kind = event.kind();
            if (kind == OVERFLOW)
            {
View Full Code Here

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

    while (running) {
      try {
        WatchKey wk = this.ws.poll(15l, TimeUnit.SECONDS);
        if (wk != null) {
          try {
            List<WatchEvent<?>> events = wk.pollEvents();
            for (WatchEvent<?> event : events) {
              if (StandardWatchEventKinds.ENTRY_CREATE
                  .equals(event.kind())) {
                /*
                 * resolve full path to source file
View Full Code Here

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

                    ENTRY_MODIFY);
           
            do {
                watchKey = watchService.take();

                for (WatchEvent<?> event : watchKey.pollEvents()) {
                    System.out.println(String.format("%s event on %s",
                            event.kind(), event.context()));
                }
            } while (watchKey.reset());
        } catch (Exception e) {
View Full Code Here

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

                Path path = FileSystems.getDefault().getPath(this.modulePath);
                WatchKey key = path.getParent().register(watcher, ENTRY_MODIFY);

                for (;;) {
                    key = watcher.take();
                    for (WatchEvent event: key.pollEvents()) {
                        if (event.kind() == ENTRY_MODIFY){
                            WatchEvent<Path> ev = (WatchEvent<Path>)event;
                            Path filename = ev.context();
                            if (filename.equals(path.getFileName())){
                                this.strategy.reloadPythonModule();
View Full Code Here

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

          Path root = Paths.get(path);
          WatchService watcher = root.getFileSystem().newWatchService();
          register(root, watcher, StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_DELETE);
          while (true) {
            final WatchKey key = watcher.take();
            for (WatchEvent<?> event : key.pollEvents()) {
             
              @SuppressWarnings("unchecked")
              Path item = ((WatchEvent<Path>) event).context();
              Path dir = keys.get(key);
              File file = new File(dir.toString(), item.toString()).getAbsoluteFile();
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.