Package org.hcjf.io.fs
Class FileSystemWatcherService
- java.lang.Object
-
- org.hcjf.service.Service<FileSystemWatcherConsumer>
-
- org.hcjf.io.fs.FileSystemWatcherService
-
public final class FileSystemWatcherService extends Service<FileSystemWatcherConsumer>
This class provide an interface in order to register a watcher for a file or directory.- Author:
- javaito
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.hcjf.service.Service
Service.RunnableWrapperComparator, Service.ShutdownStage, Service.StaticServiceThread, Service.ThreadPoolAgent, Service.ThreadPoolAgentMBean
-
-
Field Summary
-
Fields inherited from class org.hcjf.service.Service
SERVICE_LOG_TAG
-
-
Method Summary
Modifier and Type Method Description static FileSystemWatcherServicegetInstance()Return the instance of the singleton.protected voidinit()Start the main thread of the service.voidregisterConsumer(FileSystemWatcherConsumer consumer)This method register the consumer in the service.protected voidshutdown(Service.ShutdownStage stage)Shutdown implementation for the file system watcher service.voidunregisterConsumer(FileSystemWatcherConsumer consumer)Unregister a specific consumer.-
Methods inherited from class org.hcjf.service.Service
call, call, fork, fork, fork, fork, getPriority, getServiceName, run, run, shutdownExecutor, systemShutdown
-
-
-
-
Method Detail
-
getInstance
public static final FileSystemWatcherService getInstance()
Return the instance of the singleton.- Returns:
- Instance of the singleton.
-
registerConsumer
public void registerConsumer(FileSystemWatcherConsumer consumer)
This method register the consumer in the service.- Specified by:
registerConsumerin classService<FileSystemWatcherConsumer>- Parameters:
consumer- Consumer to register.- Throws:
java.lang.NullPointerException- if the consumer is null.
-
unregisterConsumer
public void unregisterConsumer(FileSystemWatcherConsumer consumer)
Description copied from class:ServiceUnregister a specific consumer.- Specified by:
unregisterConsumerin classService<FileSystemWatcherConsumer>- Parameters:
consumer- Consumer to unregister.
-
init
protected void init()
Start the main thread of the service.- Overrides:
initin classService<FileSystemWatcherConsumer>
-
shutdown
protected void shutdown(Service.ShutdownStage stage)
Shutdown implementation for the file system watcher service.- Overrides:
shutdownin classService<FileSystemWatcherConsumer>- Parameters:
stage- Shutdown stage.
-
-