Top Description Inners Fields Constructors Methods
sun.nio.fs

pack-priv abstract Class AbstractPoller

extends Object
implements Runnable
Class Inheritance
All Implemented Interfaces
java.lang.Runnable
Known Direct Subclasses
sun.nio.fs.LinuxWatchService.Poller
Imports
java.nio.file.*, java.security.AccessController, .PrivilegedAction, java.io.IOException, java.util.*

Base implementation of background poller thread used in watch service implementations. A poller thread waits on events from the file system and also services "requests" from clients to register for new events or cancel existing registrations.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
AbstractPoller.Request

Encapsulates a request (command) to the poller thread.

private static enum
AbstractPoller.RequestType

Types of request that the poller thread must handle

Field Summary

Modifier and TypeField and Description
private final ArrayDeque<AbstractPoller.Request>
private boolean

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
pack-priv final void
cancel(WatchKey key)

Cancels, and waits on, poller thread to cancel given key.

pack-priv final void
close()

Shutdown poller thread

pack-priv abstract void
implCancelKey(WatchKey key)

Executed by poller thread to cancel key

pack-priv abstract void
implCloseAll()

Executed by poller thread to shutdown and cancel all keys

pack-priv abstract Object
implRegister(Path path, Set<? extends WatchEvent.Kind<?>> events, WatchEvent.Modifier... modifiers)

Executed by poller thread to register directory for changes

private Object
invoke(AbstractPoller.RequestType type, Object... params)

Enqueues request to poller thread and waits for result

pack-priv boolean

Returns:

true if poller thread should shutdown
processRequests
()

Invoked by poller thread to process all pending requests

pack-priv final WatchKey
register(Path dir, WatchEvent.Kind<?>[] events, WatchEvent.Modifier... modifiers)

Requests, and waits on, poller thread to register given file.

public void
start()

Starts the poller thread

pack-priv abstract void
wakeup()

Wakeup poller thread so that it can service pending requests

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

requestsback to summary
private final ArrayDeque<AbstractPoller.Request> requests
shutdownback to summary
private boolean shutdown

Constructor Detail

AbstractPollerback to summary
protected AbstractPoller()

Method Detail

cancelback to summary
pack-priv final void cancel(WatchKey key)

Cancels, and waits on, poller thread to cancel given key.

closeback to summary
pack-priv final void close() throws IOException

Shutdown poller thread

implCancelKeyback to summary
pack-priv abstract void implCancelKey(WatchKey key)

Executed by poller thread to cancel key

implCloseAllback to summary
pack-priv abstract void implCloseAll()

Executed by poller thread to shutdown and cancel all keys

implRegisterback to summary
pack-priv abstract Object implRegister(Path path, Set<? extends WatchEvent.Kind<?>> events, WatchEvent.Modifier... modifiers)

Executed by poller thread to register directory for changes

invokeback to summary
private Object invoke(AbstractPoller.RequestType type, Object... params) throws IOException

Enqueues request to poller thread and waits for result

processRequestsback to summary
pack-priv boolean processRequests()

Invoked by poller thread to process all pending requests

Returns:boolean

true if poller thread should shutdown

Annotations
@SuppressWarnings:unchecked
registerback to summary
pack-priv final WatchKey register(Path dir, WatchEvent.Kind<?>[] events, WatchEvent.Modifier... modifiers) throws IOException

Requests, and waits on, poller thread to register given file.

startback to summary
public void start()

Starts the poller thread

Annotations
@SuppressWarnings:removal
wakeupback to summary
pack-priv abstract void wakeup() throws IOException

Wakeup poller thread so that it can service pending requests

sun.nio.fs back to summary

private Class AbstractPoller.Request

extends Object
Class Inheritance

Encapsulates a request (command) to the poller thread.

Field Summary

Modifier and TypeField and Description
private boolean
private final Object[]
private Object
private final AbstractPoller.RequestType

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv Object
awaitResult()

Await completion of the request.

pack-priv Object[]
pack-priv void
release(Object result)

pack-priv AbstractPoller.RequestType
type()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

completedback to summary
private boolean completed
paramsback to summary
private final Object[] params
resultback to summary
private Object result
typeback to summary
private final AbstractPoller.RequestType type

Constructor Detail

Requestback to summary
pack-priv Request(AbstractPoller.RequestType type, Object... params)

Method Detail

awaitResultback to summary
pack-priv Object awaitResult()

Await completion of the request. The return value is the result of the request.

parametersback to summary
pack-priv Object[] parameters()
releaseback to summary
pack-priv void release(Object result)
typeback to summary
pack-priv AbstractPoller.RequestType type()
sun.nio.fs back to summary

private final Enum AbstractPoller.RequestType

extends Enum<AbstractPoller.RequestType>
Class Inheritance

Types of request that the poller thread must handle

Field Summary

Modifier and TypeField and Description
public static final AbstractPoller.RequestType
public static final AbstractPoller.RequestType
public static final AbstractPoller.RequestType

Constructor Summary

AccessConstructor and Description
private

Method Summary

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

Field Detail

CANCELback to summary
public static final AbstractPoller.RequestType CANCEL
CLOSEback to summary
public static final AbstractPoller.RequestType CLOSE
REGISTERback to summary
public static final AbstractPoller.RequestType REGISTER

Constructor Detail

RequestTypeback to summary
private RequestType()

Method Detail

valueOfback to summary
public static AbstractPoller.RequestType valueOf(String name)
valuesback to summary
public static AbstractPoller.RequestType[] values()