Package java.nio.file

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


            }
          });

        }

        final boolean valid = key.reset();
        if (!valid) {
          break;
        }
      }
View Full Code Here


        {
          entryModified(eventPath, log);
        }
      }

      watchKey.reset();
    }
  }

  /**
   * A callback method called when a new Path entry is modified
View Full Code Here

        WatchEvent<Path> ev = (WatchEvent<Path>) watchEvent;

        paths.add(ev.context());

      }
      watchKey.reset();
    }

  }

}
View Full Code Here

        Path child = dir.resolve(name);
        File f = child.toFile();
        updateFile(event, f);
      }
     
      key.reset();
    }
  }

}
View Full Code Here

          System.out.println(event.count());
        }
      }

      // reset the key
      boolean valid = key.reset();
      if (!valid) {
        // object no longer registered
        map.remove(key);
      }
    }
View Full Code Here

            List<WatchEvent<?>> watchEvents = key.pollEvents();
            for (WatchEvent<?> event : watchEvents) {
              WatchEvent<Path> ev = cast(event);
              if(ev.context().equals(messages)) {
                generate();
                key.reset();
              }
            }
          } else {
            try {
              Thread.sleep(100);
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

    WatchKey watchKey;
    while (true) {
      watchKey = watchService.take();
      processEvenKey(watchKey);
      watchKey.reset();
    }
  }
 
  private static void processEvenKey(WatchKey watchKey) {
    for(WatchEvent<?> event : watchKey.pollEvents()) {
View Full Code Here

                }

            }

            // Reset
            if (!key.reset()) {
                pathByKey.remove(key);
            }

        }
    }
View Full Code Here

                  {
                     logger.log(Level.INFO, "Detected changes in repository [" + events.iterator().next().context()
                              + "].");
                     dirty = true;
                  }
                  key.reset();
                  key = watcher.poll();
               }

               if (dirty)
               {
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.