Class SelectorKernel

java.lang.Object
com.jme3.network.kernel.AbstractKernel
com.jme3.network.kernel.tcp.SelectorKernel
All Implemented Interfaces:
Kernel

public class SelectorKernel extends AbstractKernel
A Kernel implementation based on NIO selectors.
  • Constructor Details

  • Method Details

    • createSelectorThread

      protected SelectorKernel.SelectorThread createSelectorThread()
    • initialize

      public void initialize()
      Description copied from interface: Kernel
      Initializes the kernel and starts any internal processing.
    • terminate

      public void terminate() throws InterruptedException
      Description copied from interface: Kernel
      Gracefully terminates the kernel and stops any internal daemon processing. This method will not return until all internal threads have been shut down.
      Throws:
      InterruptedException
    • broadcast

      public void broadcast(Filter<? super Endpoint> filter, ByteBuffer data, boolean reliable, boolean copy)
      Description copied from interface: Kernel
      Dispatches the data to all endpoints managed by the kernel that match the specified endpoint filter. If 'copy' is true then the implementation will copy the byte buffer before delivering it to endpoints. This allows the caller to reuse the data buffer. Though it is important that the buffer not be changed by another thread while this call is running. Only the bytes from data.position() to data.remaining() are sent.
    • addEndpoint

      protected NioEndpoint addEndpoint(SocketChannel c)
    • removeEndpoint

      protected void removeEndpoint(NioEndpoint p, SocketChannel c)
    • closeEndpoint

      protected void closeEndpoint(NioEndpoint p) throws IOException
      Called by the endpoints when they need to be closed.
      Throws:
      IOException
    • wakeupSelector

      protected void wakeupSelector()
      Used internally by the endpoints to wake up the selector when they have data to send.
    • newData

      protected void newData(NioEndpoint p, SocketChannel c, ByteBuffer shared, int size)