com.esotericsoftware.kryonet
Class Listener.QueuedListener

java.lang.Object
  extended by com.esotericsoftware.kryonet.Listener
      extended by com.esotericsoftware.kryonet.Listener.QueuedListener
Direct Known Subclasses:
Listener.LagListener, Listener.ThreadedListener
Enclosing class:
Listener

public abstract static class Listener.QueuedListener
extends Listener

Wraps a listener and queues notifications as runnables. This allows the runnables to be processed on a different thread, preventing the connection's update thread from being blocked.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.esotericsoftware.kryonet.Listener
Listener.LagListener, Listener.QueuedListener, Listener.ReflectionListener, Listener.ThreadedListener
 
Constructor Summary
Listener.QueuedListener(Listener listener)
           
 
Method Summary
 void connected(Connection connection)
          Called when the remote end has been connected.
 void disconnected(Connection connection)
          Called when the remote end is no longer connected.
 void received(Connection connection, java.lang.Object object)
          Called when an object has been received from the remote end of the connection.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Listener.QueuedListener

public Listener.QueuedListener(Listener listener)
Method Detail

connected

public void connected(Connection connection)
Description copied from class: Listener
Called when the remote end has been connected. This will be invoked before any objects are received by Listener.received(Connection, Object). This will be invoked on the same thread as Client.update(int) and Server.update(int). This method should not block for long periods as other network activity will not be processed until it returns.

Overrides:
connected in class Listener

disconnected

public void disconnected(Connection connection)
Description copied from class: Listener
Called when the remote end is no longer connected. There is no guarantee as to what thread will invoke this method.

Overrides:
disconnected in class Listener

received

public void received(Connection connection,
                     java.lang.Object object)
Description copied from class: Listener
Called when an object has been received from the remote end of the connection. This will be invoked on the same thread as Client.update(int) and Server.update(int). This method should not block for long periods as other network activity will not be processed until it returns.

Overrides:
received in class Listener