public abstract class AbstractResourceWatcher<Listener> extends java.lang.Object implements ResourceWatcher
Constructor and Description |
---|
AbstractResourceWatcher() |
Modifier and Type | Method and Description |
---|---|
void |
addListener(Listener listener)
Registers new listener
|
void |
checkAndNotify()
Called periodically by
ResourceWatcherService so resource watcher can check the resource |
protected abstract void |
doCheckAndNotify()
Will be called periodically
|
protected abstract void |
doInit()
Will be called once on initialization
|
void |
init()
Called once when the resource watcher is added to
ResourceWatcherService |
protected java.util.List<Listener> |
listeners()
Returns a list of listeners
|
void |
remove(Listener listener)
Unregisters a listener
|
public void init() throws java.io.IOException
ResourceWatcher
ResourceWatcherService
init
in interface ResourceWatcher
java.io.IOException
public void checkAndNotify() throws java.io.IOException
ResourceWatcher
ResourceWatcherService
so resource watcher can check the resourcecheckAndNotify
in interface ResourceWatcher
java.io.IOException
public void addListener(Listener listener)
public void remove(Listener listener)
protected java.util.List<Listener> listeners()
protected abstract void doInit() throws java.io.IOException
java.io.IOException
protected abstract void doCheckAndNotify() throws java.io.IOException
Implementing watcher should check resource and notify all listeners()
.
java.io.IOException