public abstract class AbstractResourceWatcher<Listener> extends 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 List<Listener> |
listeners()
Returns a list of listeners
|
void |
remove(Listener listener)
Unregisters a listener
|
public void init()
throws IOException
ResourceWatcherResourceWatcherServiceinit in interface ResourceWatcherIOExceptionpublic void checkAndNotify()
throws IOException
ResourceWatcherResourceWatcherService so resource watcher can check the resourcecheckAndNotify in interface ResourceWatcherIOExceptionpublic void addListener(Listener listener)
public void remove(Listener listener)
protected abstract void doInit()
throws IOException
IOExceptionprotected abstract void doCheckAndNotify()
throws IOException
Implementing watcher should check resource and notify all listeners().
IOExceptionCopyright © 2009–2017. All rights reserved.