Package io.netty.channel.epoll
Class EpollEventArray
java.lang.Object
io.netty.channel.epoll.EpollEventArray
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 use
fd if the epoll_data union to store the actual file descriptor of an
AbstractEpollChannel and so be able to map it later.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final intprivate intprivate ByteBufferprivate long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static intcalculateBufferCapacity(int capacity) (package private) intevents(int index) Return the events for theepoll_eventon this index.(package private) intfd(int index) Return the file descriptor for theepoll_eventon this index.(package private) voidfree()Free thisEpollEventArray.private intgetInt(int index, int offset) (package private) voidincrease()Increase the storage of thisEpollEventArray.(package private) intlength()Return the length of theEpollEventArraywhich represent the maximum number ofepoll_eventsthat can be stored in it.(package private) longReturn thememoryAddresswhich points to the start of thisEpollEventArray.
-
Field Details
-
EPOLL_EVENT_SIZE
private static final int EPOLL_EVENT_SIZE -
EPOLL_DATA_OFFSET
private static final int EPOLL_DATA_OFFSET -
memory
-
memoryAddress
private long memoryAddress -
length
private int length
-
-
Constructor Details
-
EpollEventArray
EpollEventArray(int length)
-
-
Method Details
-
memoryAddress
long memoryAddress()Return thememoryAddresswhich points to the start of thisEpollEventArray. -
length
int length()Return the length of theEpollEventArraywhich represent the maximum number ofepoll_eventsthat 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_eventon this index. -
fd
int fd(int index) Return the file descriptor for theepoll_eventon this index. -
getInt
private int getInt(int index, int offset) -
calculateBufferCapacity
private static int calculateBufferCapacity(int capacity)
-