Package com.alibaba.druid.pool.ha.node
Class FileNodeListener
- java.lang.Object
-
- java.util.Observable
-
- com.alibaba.druid.pool.ha.node.NodeListener
-
- com.alibaba.druid.pool.ha.node.FileNodeListener
-
public class FileNodeListener extends NodeListener
A NodeList that monitors the change of a file.- Author:
- DigitalSonic
-
-
Constructor Summary
Constructors Constructor Description FileNodeListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Close the ScheduledExecutorService.StringgetFile()intgetIntervalSeconds()voidinit()Start a Scheduler to check the specified file.List<NodeEvent>refresh()Load the properties file and diff with the stored Properties.voidsetFile(String file)voidsetIntervalSeconds(int intervalSeconds)-
Methods inherited from class com.alibaba.druid.pool.ha.node.NodeListener
getLastUpdateTime, getObserver, getPrefix, getProperties, setLastUpdateTime, setObserver, setPrefix, setProperties, update, update
-
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
-
-
-
-
Method Detail
-
init
public void init()
Start a Scheduler to check the specified file.- Overrides:
initin classNodeListener- See Also:
setIntervalSeconds(int),NodeListener.update()
-
refresh
public List<NodeEvent> refresh()
Load the properties file and diff with the stored Properties.- Specified by:
refreshin classNodeListener- Returns:
- A List of the modification
-
destroy
public void destroy()
Close the ScheduledExecutorService.- Specified by:
destroyin classNodeListener
-
getIntervalSeconds
public int getIntervalSeconds()
-
setIntervalSeconds
public void setIntervalSeconds(int intervalSeconds)
-
getFile
public String getFile()
-
setFile
public void setFile(String file)
-
-