Interface Kernel

All Known Implementing Classes:
AbstractKernel, SelectorKernel, UdpKernel

public interface Kernel
Defines the basic byte[] passing messaging kernel.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Envelope
    A marker envelope returned from read() that indicates that there are events pending.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    broadcast(Filter<? super Endpoint> filter, ByteBuffer data, boolean reliable, boolean copy)
    Dispatches the data to all endpoints managed by the kernel that match the specified endpoint filter.
    boolean
    Returns true if there are waiting envelopes.
    void
    Initializes the kernel and starts any internal processing.
    Removes and returns one endpoint event from the event queue or null if there are no endpoint events.
    Removes one envelope from the received messages queue or blocks until one is available.
    void
    Gracefully terminates the kernel and stops any internal daemon processing.
  • Field Details

    • EVENTS_PENDING

      static final Envelope EVENTS_PENDING
      A marker envelope returned from read() that indicates that there are events pending. This allows a single thread to more easily process the envelopes and endpoint events.
  • Method Details

    • initialize

      void initialize()
      Initializes the kernel and starts any internal processing.
    • terminate

      void terminate() throws InterruptedException
      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

      void broadcast(Filter<? super Endpoint> filter, ByteBuffer data, boolean reliable, boolean copy)
      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.
    • hasEnvelopes

      boolean hasEnvelopes()
      Returns true if there are waiting envelopes.
    • read

      Removes one envelope from the received messages queue or blocks until one is available.
      Throws:
      InterruptedException
    • nextEvent

      EndpointEvent nextEvent()
      Removes and returns one endpoint event from the event queue or null if there are no endpoint events.