Class AbstractWatchService.Key
java.lang.Object
com.google.common.jimfs.AbstractWatchService.Key
- All Implemented Interfaces:
WatchKey
- Enclosing class:
AbstractWatchService
Implementation of
WatchKey for an AbstractWatchService.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BlockingQueue<WatchEvent<?>> (package private) static final intprivate final AtomicIntegerprivate final AtomicReference<AbstractWatchService.Key.State> private final com.google.common.collect.ImmutableSet<WatchEvent.Kind<?>> private final AtomicBooleanprivate final Watchableprivate final AbstractWatchService -
Constructor Summary
ConstructorsConstructorDescriptionKey(AbstractWatchService watcher, @Nullable Watchable watchable, Iterable<? extends WatchEvent.Kind<?>> subscribedTypes) -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()booleanisValid()private static WatchEvent<Object> overflowEvent(int count) List<WatchEvent<?>> voidpost(WatchEvent<?> event) Posts the given event to this key.booleanreset()voidsignal()Sets the state to SIGNALLED and enqueues this key with the watcher if it was previously in the READY state.(package private) AbstractWatchService.Key.Statestate()Gets the current state of this key, State.READY or SIGNALLED.booleansubscribesTo(WatchEvent.Kind<?> eventType) Gets whether or not this key is subscribed to the given type of event.
-
Field Details
-
MAX_QUEUE_SIZE
static final int MAX_QUEUE_SIZE- See Also:
-
watcher
-
watchable
-
subscribedTypes
-
state
-
valid
-
overflow
-
events
-
-
Constructor Details
-
Key
public Key(AbstractWatchService watcher, @Nullable Watchable watchable, Iterable<? extends WatchEvent.Kind<?>> subscribedTypes)
-
-
Method Details
-
overflowEvent
-
state
AbstractWatchService.Key.State state()Gets the current state of this key, State.READY or SIGNALLED. -
subscribesTo
Gets whether or not this key is subscribed to the given type of event. -
post
Posts the given event to this key. After posting one or more events,signal()must be called to cause the key to be enqueued with the watch service. -
signal
public void signal()Sets the state to SIGNALLED and enqueues this key with the watcher if it was previously in the READY state. -
isValid
-
pollEvents
- Specified by:
pollEventsin interfaceWatchKey
-
reset
-
cancel
-
watchable
-