Interface SocketListener.EventCallback

All Superinterfaces:
FunctionPointer
Enclosing class:
SocketListener
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static interface SocketListener.EventCallback extends FunctionPointer

Functional interface declaration of the EventCallback callback.

Since:
2.22
See Also:
  • Method Details

    • run

      void run(SocketListenerEvent event, @Nullable Socket socket)
      Emitted when listener's activity on socket changes state. Note that when listener is used to listen on both IPv4 and IPv6, a separate set of signals will be emitted for each, and the order they happen in is undefined.
      Since:
      2.46
    • upcall

      default void upcall(MemorySegment sourceSocketListener, int event, MemorySegment socket)
      The upcall method is called from native code. The parameters are marshaled and run(SocketListenerEvent, Socket) is executed.
    • toCallback

      default MemorySegment toCallback(Arena arena)
      Creates a native function pointer to the upcall(MemorySegment, int, MemorySegment) method.
      Specified by:
      toCallback in interface FunctionPointer
      Parameters:
      arena - the arena in which the function pointer is allocated
      Returns:
      the native function pointer