Package io.microsphere.io
Class StandardFileWatchService
- java.lang.Object
-
- io.microsphere.io.StandardFileWatchService
-
- All Implemented Interfaces:
FileWatchService,java.lang.AutoCloseable
public class StandardFileWatchService extends java.lang.Object implements FileWatchService, java.lang.AutoCloseable
StandardFileWatchServiceimplementation based on JDK 7WatchService- Since:
- 1.0.0
- Author:
- Mercy
- See Also:
WatchService
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_THREAD_NAME_PREFIXThe default thread name prefix : "microsphere-file-watch-service"static java.lang.StringTHREAD_NAME_PREFIXThe thread name prefix , default value : "microsphere-file-watch-service-"static java.lang.StringTHREAD_NAME_PREFIX_PROPERTY_NAMEThe thread name prefix property name : "microsphere.file-watch-service.thread-name-prefix
-
Constructor Summary
Constructors Constructor Description StandardFileWatchService()StandardFileWatchService(java.util.concurrent.Executor eventHandlerExecutor)StandardFileWatchService(java.util.concurrent.Executor eventHandlerExecutor, java.util.concurrent.ExecutorService eventLoopExecutor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidstart()voidstop()voidwatch(java.io.File file, FileChangedListener listener, FileChangedEvent.Kind... kinds)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.microsphere.io.FileWatchService
watch
-
-
-
-
Field Detail
-
DEFAULT_THREAD_NAME_PREFIX
public static final java.lang.String DEFAULT_THREAD_NAME_PREFIX
The default thread name prefix : "microsphere-file-watch-service"- See Also:
- Constant Field Values
-
THREAD_NAME_PREFIX_PROPERTY_NAME
public static final java.lang.String THREAD_NAME_PREFIX_PROPERTY_NAME
The thread name prefix property name : "microsphere.file-watch-service.thread-name-prefix- See Also:
- Constant Field Values
-
THREAD_NAME_PREFIX
public static final java.lang.String THREAD_NAME_PREFIX
The thread name prefix , default value : "microsphere-file-watch-service-"
-
-
Constructor Detail
-
StandardFileWatchService
public StandardFileWatchService()
-
StandardFileWatchService
public StandardFileWatchService(java.util.concurrent.Executor eventHandlerExecutor)
-
StandardFileWatchService
public StandardFileWatchService(java.util.concurrent.Executor eventHandlerExecutor, java.util.concurrent.ExecutorService eventLoopExecutor)
-
-
Method Detail
-
start
public void start() throws java.lang.Exception- Throws:
java.lang.Exception
-
watch
public void watch(java.io.File file, FileChangedListener listener, FileChangedEvent.Kind... kinds)Description copied from interface:FileWatchService- Specified by:
watchin interfaceFileWatchService- Parameters:
file- the file or directorylistener- onelistenerkinds- one or morekinds of File Changed Events, all kinds should be interested if blank
-
stop
public void stop() throws java.lang.Exception- Throws:
java.lang.Exception
-
close
public void close() throws java.lang.Exception- Specified by:
closein interfacejava.lang.AutoCloseable- Throws:
java.lang.Exception
-
-