public abstract class WatchKey
extends java.lang.Object
WatchKey represents a Watchable's registration for events with a
WatchService. It is created on registration and subsequently used to retreive
WatchEvents.WatchService (that is, undoing registration),
use the cancel() method. Note that this will invalidate the WatchKey, which
should then be discarded (as it cannot be reused).WatchService.poll(),
WatchService.take(),
pollEvents()| Modifier | Constructor and Description |
|---|---|
protected |
WatchKey() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
cancel()
This cancels the registration with the WatchService that this WatchKey
was registered with.
|
abstract boolean |
isValid() |
abstract java.util.List<WatchEvent<?>> |
pollEvents()
Returns the events that have occurred for this WatchKey.
|
abstract boolean |
reset()
Resets this
WatchKey (marks it as non-signalled) so that it's
corresponding WatchService can report it again via it's
WatchService.poll() and WatchService.take() methods. |
public abstract void cancel()
public abstract boolean isValid()
public abstract java.util.List<WatchEvent<?>> pollEvents()
public abstract boolean reset()
WatchKey (marks it as non-signalled) so that it's
corresponding WatchService can report it again via it's
WatchService.poll() and WatchService.take() methods.true if the key could be reset, false
otherwise (typically if the corresponding WatchService has been closed
or if the the key was not signalled).