APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.nio.fs

pack-priv abstract Class AbstractWatchKey

extends Object
implements WatchKey
Class Inheritance
All Implemented Interfaces
java.nio.file.WatchKey
Known Direct Subclasses
sun.nio.fs.PollingWatchService.PollingWatchKey, sun.nio.fs.LinuxWatchService.LinuxWatchKey
Imports
java.nio.file.*, java.util.*, jdk.internal.util.ArraysSupport

Base implementation class for watch keys.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
AbstractWatchKey.Event<T>

WatchEvent implementation

private static enum
AbstractWatchKey.State

Possible key states

Field Summary

Modifier and TypeField and Description
private static final int
private final Path
private List<WatchEvent<?>>
private Map<Object, WatchEvent<?>>
pack-priv static final int
MAX_EVENT_LIST_SIZE

Maximum size of event list before dropping events and signalling OVERFLOW

pack-priv static final AbstractWatchKey.Event<Object>
OVERFLOW_EVENT

Special event to signal overflow

private AbstractWatchKey.State
private final AbstractWatchService

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public final List<WatchEvent<?>>
pollEvents()

Implements java.nio.file.WatchKey.pollEvents.

Retrieves and removes all pending events for this watch key, returning a List of the events that were retrieved.

public final boolean
reset()

Implements java.nio.file.WatchKey.reset.

Resets this watch key.

pack-priv final void
signal()

Enqueues this key to the watch service

pack-priv final void
signalEvent(WatchEvent.Kind<?> kind, Object context)

Adds the event to this key and signals it.

public Path
watchable()

Implements java.nio.file.WatchKey.watchable.

Return the original watchable (Path)

pack-priv final AbstractWatchService
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEFAULT_MAX_EVENT_LIST_SIZEback to summary
private static final int DEFAULT_MAX_EVENT_LIST_SIZE
dirback to summary
private final Path dir
eventsback to summary
private List<WatchEvent<?>> events
lastModifyEventsback to summary
private Map<Object, WatchEvent<?>> lastModifyEvents
MAX_EVENT_LIST_SIZEback to summary
pack-priv static final int MAX_EVENT_LIST_SIZE

Maximum size of event list before dropping events and signalling OVERFLOW

OVERFLOW_EVENTback to summary
pack-priv static final AbstractWatchKey.Event<Object> OVERFLOW_EVENT

Special event to signal overflow

stateback to summary
private AbstractWatchKey.State state
watcherback to summary
private final AbstractWatchService watcher

Constructor Detail

AbstractWatchKeyback to summary
protected AbstractWatchKey(Path dir, AbstractWatchService watcher)

Method Detail

pollEventsback to summary
public final List<WatchEvent<?>> pollEvents()

Implements java.nio.file.WatchKey.pollEvents.

Doc from java.nio.file.WatchKey.pollEvents.

Retrieves and removes all pending events for this watch key, returning a List of the events that were retrieved.

Note that this method does not wait if there are no events pending.

Annotations
@Override
resetback to summary
public final boolean reset()

Implements java.nio.file.WatchKey.reset.

Doc from java.nio.file.WatchKey.reset.

Resets this watch key.

If this watch key has been cancelled or this watch key is already in the ready state then invoking this method has no effect. Otherwise if there are pending events for the object then this watch key is immediately re-queued to the watch service. If there are no pending events then the watch key is put into the ready state and will remain in that state until an event is detected or the watch key is cancelled.

Annotations
@Override
signalback to summary
pack-priv final void signal()

Enqueues this key to the watch service

signalEventback to summary
pack-priv final void signalEvent(WatchEvent.Kind<?> kind, Object context)

Adds the event to this key and signals it.

Annotations
@SuppressWarnings:unchecked
watchableback to summary
public Path watchable()

Implements java.nio.file.WatchKey.watchable.

Return the original watchable (Path)

Annotations
@Override
watcherback to summary
pack-priv final AbstractWatchService watcher()
sun.nio.fs back to summary

private Class AbstractWatchKey.Event<T>

extends Object
implements WatchEvent<T>
Class Inheritance
All Implemented Interfaces
java.nio.file.WatchEvent

WatchEvent implementation

Field Summary

Modifier and TypeField and Description
private final T
private int
private final WatchEvent.Kind<T>

Constructor Summary

AccessConstructor and Description
pack-priv
Event(WatchEvent.Kind<T> type, T context)

Method Summary

Modifier and TypeMethod and Description
public T
context()

Implements java.nio.file.WatchEvent.context.

Returns the context for the event.

public int
count()

Implements java.nio.file.WatchEvent.count.

Returns the event count.

pack-priv void
public WatchEvent.Kind<T>
kind()

Implements java.nio.file.WatchEvent.kind.

Returns the event kind.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contextback to summary
private final T context
countback to summary
private int count
kindback to summary
private final WatchEvent.Kind<T> kind

Constructor Detail

Eventback to summary
pack-priv Event(WatchEvent.Kind<T> type, T context)

Method Detail

contextback to summary
public T context()

Implements java.nio.file.WatchEvent.context.

Doc from java.nio.file.WatchEvent.context.

Returns the context for the event.

In the case of ENTRY_CREATE, ENTRY_DELETE, and ENTRY_MODIFY events the context is a Path that is the relative path between the directory registered with the watch service, and the entry that is created, deleted, or modified.

Annotations
@Override
countback to summary
public int count()

Implements java.nio.file.WatchEvent.count.

Doc from java.nio.file.WatchEvent.count.

Returns the event count. If the event count is greater than 1 then this is a repeated event.

Annotations
@Override
incrementback to summary
pack-priv void increment()
kindback to summary
public WatchEvent.Kind<T> kind()

Implements java.nio.file.WatchEvent.kind.

Doc from java.nio.file.WatchEvent.kind.

Returns the event kind.

Annotations
@Override
sun.nio.fs back to summary

private final Enum AbstractWatchKey.State

extends Enum<AbstractWatchKey.State>
Class Inheritance

Possible key states

Field Summary

Modifier and TypeField and Description
public static final AbstractWatchKey.State
public static final AbstractWatchKey.State

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static AbstractWatchKey.State
public static AbstractWatchKey.State[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

READYback to summary
public static final AbstractWatchKey.State READY
SIGNALLEDback to summary
public static final AbstractWatchKey.State SIGNALLED

Constructor Detail

Stateback to summary
private State()

Method Detail

valueOfback to summary
public static AbstractWatchKey.State valueOf(String name)
valuesback to summary
public static AbstractWatchKey.State[] values()