com.esotericsoftware.kryonet
Class Listener.QueuedListener
java.lang.Object
com.esotericsoftware.kryonet.Listener
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.
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 |
Listener.QueuedListener
public Listener.QueuedListener(Listener listener)
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