com.jme3.network.kernel
Class AbstractKernel

java.lang.Object
  extended by com.jme3.network.kernel.AbstractKernel
All Implemented Interfaces:
Kernel
Direct Known Subclasses:
SelectorKernel, UdpKernel

public abstract class AbstractKernel
extends java.lang.Object
implements Kernel

Base implementation of the Kernel interface providing several useful default implementations of some methods. This implementation assumes that the kernel will be managing its own internal threads and queuing any results for the caller to retrieve on their own thread.


Field Summary
 
Fields inherited from interface com.jme3.network.kernel.Kernel
EVENTS_PENDING
 
Constructor Summary
protected AbstractKernel()
           
 
Method Summary
protected  void addEnvelope(Envelope env)
           
protected  void addEvent(EndpointEvent e)
           
 boolean hasEnvelopes()
          Returns true if there are waiting envelopes.
protected  long nextEndpointId()
           
 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.
protected  void reportError(java.lang.Exception e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.jme3.network.kernel.Kernel
broadcast, initialize, terminate
 

Constructor Detail

AbstractKernel

protected AbstractKernel()
Method Detail

reportError

protected void reportError(java.lang.Exception e)

nextEndpointId

protected long nextEndpointId()

hasEnvelopes

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

Specified by:
hasEnvelopes in interface Kernel

read

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

Specified by:
read in interface Kernel
Throws:
java.lang.InterruptedException

nextEvent

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

Specified by:
nextEvent in interface Kernel

addEvent

protected void addEvent(EndpointEvent e)

addEnvelope

protected void addEnvelope(Envelope env)