public void monitor(FileChangeListener listener){
  if (lock.tryLock()) {
    try {
      FileChangeSet fileChangeSet=createFileChangeSet();
      if (fileChangeSet.isEmpty()) {
        return;
      }
      listener.onChanges(fileChangeSet);
    }
  finally {
      lock.unlock();
    }
  }
}

public void monitor ( FileChangeListener listener ) { if ( lock . tryLock ( ) ) { try { FileChangeSet fileChangeSet = createFileChangeSet ( ) ; if ( fileChangeSet . isEmpty ( ) ) { return ; } listener . onChanges ( fileChangeSet ) ; } finally { lock . unlock ( ) ; } } }
monitor the directory and notify the listener .
