Class PollingFileWatcher
- java.lang.Object
-
- br.pucrio.tecgraf.soma.job.log.watcher.impl.PollingFileWatcher
-
- All Implemented Interfaces:
IFileWatcher,IWatcher,Closeable,AutoCloseable
public class PollingFileWatcher extends Object implements IFileWatcher
-
-
Constructor Summary
Constructors Constructor Description PollingFileWatcher(Integer pollingIntervalMillis)PollingFileWatcher(List<IFileWatchEventListener> listeners, Integer pollingIntervalMillis)Construtor para os testes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFileWatchEventListener(IFileWatchEventListener listener)voidclose()booleanisWatching()protected voidprocessEvent(File file)voidregister(String dirStrPath, FileFilter fileFilter)voidremoveFileWatchEventListener(IFileWatchEventListener listener)voidstartWatch()voidstopWatch()
-
-
-
Constructor Detail
-
PollingFileWatcher
public PollingFileWatcher(Integer pollingIntervalMillis) throws IOException
- Throws:
IOException
-
PollingFileWatcher
public PollingFileWatcher(List<IFileWatchEventListener> listeners, Integer pollingIntervalMillis)
Construtor para os testes.- Parameters:
listeners- lista de ouvintespollingIntervalMillis- intervalo de polling em milissegundos
-
-
Method Detail
-
register
public void register(String dirStrPath, FileFilter fileFilter) throws IOException
- Specified by:
registerin interfaceIFileWatcher- Throws:
IOException
-
startWatch
public void startWatch() throws InterruptedException- Specified by:
startWatchin interfaceIFileWatcher- Throws:
InterruptedException
-
stopWatch
public void stopWatch() throws Exception- Specified by:
stopWatchin interfaceIFileWatcher- Throws:
Exception
-
isWatching
public boolean isWatching()
- Specified by:
isWatchingin interfaceIFileWatcher
-
addFileWatchEventListener
public void addFileWatchEventListener(IFileWatchEventListener listener)
- Specified by:
addFileWatchEventListenerin interfaceIFileWatcher
-
removeFileWatchEventListener
public void removeFileWatchEventListener(IFileWatchEventListener listener)
- Specified by:
removeFileWatchEventListenerin interfaceIFileWatcher
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
processEvent
protected void processEvent(File file)
-
-