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
ResourceWatcher
ResourceWatcherService
init
in interface ResourceWatcher
IOException
public void checkAndNotify() throws IOException
ResourceWatcher
ResourceWatcherService
so resource watcher can check the resourcecheckAndNotify
in interface ResourceWatcher
IOException
public void addListener(Listener listener)
public void remove(Listener listener)
protected abstract void doInit() throws IOException
IOException
protected abstract void doCheckAndNotify() throws IOException
Implementing watcher should check resource and notify all listeners()
.
IOException
Copyright © 2009–2017. All rights reserved.