Class HotSwapFilesModificationsWatcherDefault
java.lang.Object
org.spincast.plugins.hotswap.fileswatcher.HotSwapFilesModificationsWatcherDefault
- All Implemented Interfaces:
ServerStartedListener
,HotSwapFilesModificationsWatcher
public class HotSwapFilesModificationsWatcherDefault
extends Object
implements HotSwapFilesModificationsWatcher
-
Field Summary
-
Constructor Summary
ConstructorDescriptionHotSwapFilesModificationsWatcherDefault
(Set<HotSwapFilesModificationsListener> boundListeners) -
Method Summary
Modifier and TypeMethodDescriptionprotected WatchService
protected WatchService
protected Map<String,
Set<HotSwapFilesModificationsListener>> protected Map<WatchKey,
Set<HotSwapFilesModificationsListener>> void
init()
protected boolean
modifiedFileMatchs
(File modifiedFile, HotSwapFilesModificationsListener listener) void
Add a new listener for modifications to file(s) to watch.void
Removes all listeners.void
Removes a file modifications listener.void
Starts watching registered files when the server is started.protected void
void
Stops the files watching completly.
-
Field Details
-
logger
protected static final org.slf4j.Logger logger
-
-
Constructor Details
-
HotSwapFilesModificationsWatcherDefault
@Inject public HotSwapFilesModificationsWatcherDefault(@Nullable Set<HotSwapFilesModificationsListener> boundListeners)
-
-
Method Details
-
init
@Inject public void init() -
serverStartedSuccessfully
public void serverStartedSuccessfully()Starts watching registered files when the server is started.- Specified by:
serverStartedSuccessfully
in interfaceServerStartedListener
-
getListenersByDirAbsolutePaths
-
getWatchKeysByDirAbsolutePaths
-
getDirAbsolutePathsByWatchKey
-
getFileModificationsWatcherService
-
getListenersByWatchKey
-
createFileModificationsWatcherService
-
registerListener
Description copied from interface:HotSwapFilesModificationsWatcher
Add a new listener for modifications to file(s) to watch.More than one listeners can be added for the same files!
- Specified by:
registerListener
in interfaceHotSwapFilesModificationsWatcher
-
removeAllListeners
public void removeAllListeners()Description copied from interface:HotSwapFilesModificationsWatcher
Removes all listeners.- Specified by:
removeAllListeners
in interfaceHotSwapFilesModificationsWatcher
-
removeListener
Description copied from interface:HotSwapFilesModificationsWatcher
Removes a file modifications listener.- Specified by:
removeListener
in interfaceHotSwapFilesModificationsWatcher
-
startFilesModificationsWatcher
protected void startFilesModificationsWatcher() -
modifiedFileMatchs
-
stopWatching
public void stopWatching()Description copied from interface:HotSwapFilesModificationsWatcher
Stops the files watching completly. Can't be restarted.- Specified by:
stopWatching
in interfaceHotSwapFilesModificationsWatcher
-