Package com.google.common.jimfs
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 int
private final AtomicInteger
private final AtomicReference
<AbstractWatchService.Key.State> private final com.google.common.collect.ImmutableSet
<WatchEvent.Kind<?>> private final AtomicBoolean
private final Watchable
private final AbstractWatchService
-
Constructor Summary
ConstructorsConstructorDescriptionKey
(AbstractWatchService watcher, @Nullable Watchable watchable, Iterable<? extends WatchEvent.Kind<?>> subscribedTypes) -
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
boolean
isValid()
private static WatchEvent
<Object> overflowEvent
(int count) List
<WatchEvent<?>> void
post
(WatchEvent<?> event) Posts the given event to this key.boolean
reset()
void
signal()
Sets the state to SIGNALLED and enqueues this key with the watcher if it was previously in the READY state.(package private) AbstractWatchService.Key.State
state()
Gets the current state of this key, State.READY or SIGNALLED.boolean
subscribesTo
(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
public boolean isValid() -
pollEvents
- Specified by:
pollEvents
in interfaceWatchKey
-
reset
@CanIgnoreReturnValue public boolean reset() -
cancel
public void cancel() -
watchable
-