Package org.apache.commons.jci.monitor

Examples of org.apache.commons.jci.monitor.FilesystemAlterationObserver


    delay = pDelay;
  }
 
  public void addListener(final File pRoot, final FilesystemAlterationListener pListener) {
   
    FilesystemAlterationObserver observer;
   
    synchronized (observersLock) {
      observer = (FilesystemAlterationObserver) observers.get(pRoot);
     
      if (observer == null) {
        final Map newObservers = new HashMap(observers);
        observer = new FilesystemAlterationObserverImpl(pRoot);
        newObservers.put(pRoot, observer);
        observers = Collections.unmodifiableMap(newObservers);
      }
    }
   
    observer.addListener(pListener);
  }
View Full Code Here


  }
 
  public void removeListener(final FilesystemAlterationListener pListener) {
    synchronized (observersLock) {
      for (Iterator it = observers.values().iterator(); it.hasNext();) {
        final FilesystemAlterationObserver observer = (FilesystemAlterationObserver) it.next();
        observer.removeListener(pListener);
        // FIXME: remove observer if there are no listeners?
      }
    }
  }
View Full Code Here

      }
    }
  }
 
  public FilesystemAlterationListener[] getListenersFor(final File pRoot) {
    final FilesystemAlterationObserver observer = (FilesystemAlterationObserver) observers.get(pRoot);
   
    if (observer == null) {
      return new FilesystemAlterationListener[0];
    }
   
    return observer.getListeners();
  }
View Full Code Here

      }
     
      final Map currentObservers = observers;
     
      for (Iterator it = currentObservers.values().iterator(); it.hasNext();) {
        final FilesystemAlterationObserver observer = (FilesystemAlterationObserver) it.next();
        observer.checkAndNotify();
      }
     
      if (!running)
        break;
      try {
View Full Code Here

TOP

Related Classes of org.apache.commons.jci.monitor.FilesystemAlterationObserver

Copyright © 2018 www.massapicom. 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.