@Override
  public void run() {

    if (file == null) {
      logger.fatal("file is null!");
      return;
    }

    logger.debug("Watching " + file.getAbsolutePath());

    switch (state) {
      case NEW:
        state = State.DELETED;
        fileWatcherService.offer(new JFileWatcherEvent(JFileWatcherEvent.Code.NEW, file));
        if (file.exists()) {
          state = State.MODIFIED;
          lastModified = file.lastModified();
        }
        break;

      case MODIFIED:
        state = State.DELETED;
        if (file.exists()) {
          state = State.MODIFIED;
          if (lastModified < file.lastModified()) {
            fileWatcherService.offer(new JFileWatcherEvent(JFileWatcherEvent.Code.MODIFIED, file));
          }
          lastModified = file.lastModified();
        }
        break;

      case DELETED:
        state = State.DELETED;
        if (!dnotify) {
          fileWatcherService.offer(new JFileWatcherEvent(JFileWatcherEvent.Code.DELETE, file));
          dnotify = true;

          this.fileWatcherService.removeTask(this);	// Seems to work - remove this thread now were done with it
          // JFileWatcherCache.CacheRemove(file);
          cache.CacheRemove(file);
        }
        if (file.exists()) {
          state = State.NEW;
          dnotify = false;
        }
        break;
    }
  }