com.jme3.network.kernel
Interface Kernel

All Known Implementing Classes:
AbstractKernel, SelectorKernel, UdpKernel

public interface Kernel

Defines the basic byte[] passing messaging kernel.


Field Summary
static Envelope EVENTS_PENDING
          A marker envelope returned from read() that indicates that there are events pending.
 
Method Summary
 void broadcast(Filter<? super Endpoint> filter, java.nio.ByteBuffer data, boolean reliable, boolean copy)
          Dispatches the data to all endpoints managed by the kernel that match the specified endpoint filter..
 boolean hasEnvelopes()
          Returns true if there are waiting envelopes.
 void initialize()
          Initializes the kernel and starts any internal processing.
 EndpointEvent nextEvent()
          Removes and returnsn one endpoint event from the event queue or null if there are no endpoint events.
 Envelope read()
          Removes one envelope from the received messages queue or blocks until one is available.
 void terminate()
          Gracefully terminates the kernel and stops any internal daemon processing.
 

Field Detail

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 Detail

initialize

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


terminate

void terminate()
               throws java.lang.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:
java.lang.InterruptedException

broadcast

void broadcast(Filter<? super Endpoint> filter,
               java.nio.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

Envelope read()
              throws java.lang.InterruptedException
Removes one envelope from the received messages queue or blocks until one is available.

Throws:
java.lang.InterruptedException

nextEvent

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