Class 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 use fd if the epoll_data union to store the actual file descriptor of an AbstractEpollChannel and so be able to map it later.
    • 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 the epoll_event on this index.
      (package private) int fd​(int index)
      Return the file descriptor for the epoll_event on this index.
      (package private) void free()
      Free this EpollEventArray.
      private int getInt​(int index, int offset)  
      (package private) void increase()
      Increase the storage of this EpollEventArray.
      (package private) int length()
      Return the length of the EpollEventArray which represent the maximum number of epoll_events that can be stored in it.
      (package private) long memoryAddress()
      Return the memoryAddress which points to the start of this EpollEventArray.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • EPOLL_EVENT_SIZE

        private static final int EPOLL_EVENT_SIZE
      • EPOLL_DATA_OFFSET

        private static final int EPOLL_DATA_OFFSET
      • memory

        private java.nio.ByteBuffer memory
      • memoryAddress

        private long memoryAddress
      • length

        private int length
    • Constructor Detail

      • EpollEventArray

        EpollEventArray​(int length)
    • Method Detail

      • memoryAddress

        long memoryAddress()
        Return the memoryAddress which points to the start of this EpollEventArray.
      • length

        int length()
        Return the length of the EpollEventArray which represent the maximum number of epoll_events that can be stored in it.
      • free

        void free()
        Free this EpollEventArray. Any usage after calling this method may segfault the JVM!
      • events

        int events​(int index)
        Return the events for the epoll_event on this index.
      • fd

        int fd​(int index)
        Return the file descriptor for the epoll_event on this index.
      • getInt

        private int getInt​(int index,
                           int offset)
      • calculateBufferCapacity

        private static int calculateBufferCapacity​(int capacity)