Top Description Inners Fields Constructors Methods
sun.nio.ch

pack-priv final Class EPollPort

extends Port
Class Inheritance
Imports
java.nio.channels.spi.AsynchronousChannelProvider, java.io.IOException, java.util.concurrent.ArrayBlockingQueue, .RejectedExecutionException, java.util.concurrent.atomic.AtomicInteger

AsynchronousChannelGroup implementation based on the Linux epoll facility.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
private class
EPollPort.EventHandlerTask

Task to process events from epoll and dispatch to the channel's onEvent handler.

Field Summary

Modifier and TypeField and Description
private final long
private boolean
private static final int
private final int
private final EPollPort.Event
private static final int
private final EPollPort.Event
private final ArrayBlockingQueue<EPollPort.Event>
private final int[]
private final AtomicInteger
Inherited from sun.nio.ch.Port:
fdToChannelfdToChannelLock

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv void
executeOnHandlerTask(Runnable task)

Implements abstract sun.nio.ch.AsynchronousChannelGroupImpl.executeOnHandlerTask.

Wakes up a thread waiting for I/O events to execute the given task.
private void
implClose()

Release all resources

pack-priv void
shutdownHandlerTasks()

Implements abstract sun.nio.ch.AsynchronousChannelGroupImpl.shutdownHandlerTasks.

Shutdown all tasks waiting for I/O events.
pack-priv EPollPort
pack-priv void
startPoll(int fd, int events)

Implements abstract sun.nio.ch.Port.startPoll.

Register file descriptor with polling mechanism for given events.
private void
Inherited from sun.nio.ch.Port:
attachForeignChannelcloseAllChannelsdetachForeignChannelisEmptypreUnregisterregisterunregister

Field Detail

addressback to summary
private final long address
closedback to summary
private boolean closed
ENOENTback to summary
private static final int ENOENT
epfdback to summary
private final int epfd
EXECUTE_TASK_OR_SHUTDOWNback to summary
private final EPollPort.Event EXECUTE_TASK_OR_SHUTDOWN
MAX_EPOLL_EVENTSback to summary
private static final int MAX_EPOLL_EVENTS
NEED_TO_POLLback to summary
private final EPollPort.Event NEED_TO_POLL
queueback to summary
private final ArrayBlockingQueue<EPollPort.Event> queue
spback to summary
private final int[] sp
wakeupCountback to summary
private final AtomicInteger wakeupCount

Constructor Detail

EPollPortback to summary
pack-priv EPollPort(AsynchronousChannelProvider provider, ThreadPool pool) throws IOException

Method Detail

executeOnHandlerTaskback to summary
pack-priv void executeOnHandlerTask(Runnable task)

Implements abstract sun.nio.ch.AsynchronousChannelGroupImpl.executeOnHandlerTask.

Doc from sun.nio.ch.AsynchronousChannelGroupImpl.executeOnHandlerTask.

Wakes up a thread waiting for I/O events to execute the given task.

Annotations
@Override
implCloseback to summary
private void implClose()

Release all resources

shutdownHandlerTasksback to summary
pack-priv void shutdownHandlerTasks()

Implements abstract sun.nio.ch.AsynchronousChannelGroupImpl.shutdownHandlerTasks.

Doc from sun.nio.ch.AsynchronousChannelGroupImpl.shutdownHandlerTasks.

Shutdown all tasks waiting for I/O events.

Annotations
@Override
startback to summary
pack-priv EPollPort start()
startPollback to summary
pack-priv void startPoll(int fd, int events)

Implements abstract sun.nio.ch.Port.startPoll.

Doc from sun.nio.ch.Port.startPoll.

Register file descriptor with polling mechanism for given events. The implementation should translate the events as required.

Annotations
@Override
wakeupback to summary
private void wakeup()
sun.nio.ch back to summary

pack-priv Class EPollPort.Event

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final Port.PollableChannel
pack-priv final int

Constructor Summary

AccessConstructor and Description
pack-priv
Event(Port.PollableChannel channel, int events)

Method Summary

Modifier and TypeMethod and Description
pack-priv Port.PollableChannel
pack-priv int
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

channelback to summary
pack-priv final Port.PollableChannel channel
eventsback to summary
pack-priv final int events

Constructor Detail

Eventback to summary
pack-priv Event(Port.PollableChannel channel, int events)

Method Detail

channelback to summary
pack-priv Port.PollableChannel channel()
eventsback to summary
pack-priv int events()
sun.nio.ch back to summary

private Class EPollPort.EventHandlerTask

extends Object
implements Runnable
Class Inheritance
All Implemented Interfaces
java.lang.Runnable

Task to process events from epoll and dispatch to the channel's onEvent handler. Events are retrieved from epoll in batch and offered to a BlockingQueue where they are consumed by handler threads. A special "NEED_TO_POLL" event is used to signal one consumer to re-poll when all events have been consumed.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private EPollPort.Event
poll()

public void
run()

Implements java.lang.Runnable.run.

Runs this operation.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

EventHandlerTaskback to summary
private EventHandlerTask()

Method Detail

pollback to summary
private EPollPort.Event poll() throws IOException
runback to summary
public void run()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.