Package io.netty.channel.epoll
Class EpollEventArray
- java.lang.Object
-
- io.netty.channel.epoll.EpollEventArray
-
@UnstableApi public final class EpollEventArray extends java.lang.Object
This is an internal datastructure which can be directly passed to epoll_wait to reduce the overhead. typedef union epoll_data { void *ptr; int fd; uint32_t u32; uint64_t u64; } epoll_data_t; struct epoll_event { uint32_t events; // Epoll events epoll_data_t data; // User data variable }; We usefd
if theepoll_data union
to store the actual file descriptor of anAbstractEpollChannel
and so be able to map it later.
-
-
Field Summary
Fields Modifier and Type Field Description private static int
EPOLL_DATA_OFFSET
private static int
EPOLL_EVENT_SIZE
private int
length
private java.nio.ByteBuffer
memory
private long
memoryAddress
-
Constructor Summary
Constructors Constructor Description EpollEventArray(int length)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static int
calculateBufferCapacity(int capacity)
(package private) int
events(int index)
Return the events for theepoll_event
on this index.(package private) int
fd(int index)
Return the file descriptor for theepoll_event
on this index.(package private) void
free()
Free thisEpollEventArray
.private int
getInt(int index, int offset)
(package private) void
increase()
Increase the storage of thisEpollEventArray
.(package private) int
length()
Return the length of theEpollEventArray
which represent the maximum number ofepoll_events
that can be stored in it.(package private) long
memoryAddress()
Return thememoryAddress
which points to the start of thisEpollEventArray
.
-
-
-
Method Detail
-
memoryAddress
long memoryAddress()
Return thememoryAddress
which points to the start of thisEpollEventArray
.
-
length
int length()
Return the length of theEpollEventArray
which represent the maximum number ofepoll_events
that can be stored in it.
-
increase
void increase()
Increase the storage of thisEpollEventArray
.
-
free
void free()
Free thisEpollEventArray
. Any usage after calling this method may segfault the JVM!
-
events
int events(int index)
Return the events for theepoll_event
on this index.
-
fd
int fd(int index)
Return the file descriptor for theepoll_event
on this index.
-
getInt
private int getInt(int index, int offset)
-
calculateBufferCapacity
private static int calculateBufferCapacity(int capacity)
-
-