Package arc.net
Class NetListener.QueuedListener
java.lang.Object
arc.net.NetListener.QueuedListener
- All Implemented Interfaces:
NetListener
- Direct Known Subclasses:
NetListener.LagListener
,NetListener.ThreadedListener
- Enclosing interface:
- NetListener
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 interface arc.net.NetListener
NetListener.LagListener, NetListener.QueuedListener, NetListener.ThreadedListener
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
connected
(Connection connection) Called when the remote end has been connected.void
disconnected
(Connection connection, DcReason reason) Called when the remote end is no longer connected.void
idle
(Connection connection) Called when the connection is below theidle threshold
.protected abstract void
void
received
(Connection connection, Object object) Called when an object has been received from the remote end of the connection.
-
Constructor Details
-
QueuedListener
-
-
Method Details
-
connected
Description copied from interface:NetListener
Called when the remote end has been connected. This will be invoked before any objects are received byNetListener.received(Connection, Object)
. This will be invoked on the same thread asClient.update(int)
andServer.update(int)
. This method should not block for long periods as other network activity will not be processed until it returns.- Specified by:
connected
in interfaceNetListener
-
disconnected
Description copied from interface:NetListener
Called when the remote end is no longer connected. There is no guarantee as to what thread will invoke this method.- Specified by:
disconnected
in interfaceNetListener
-
received
Description copied from interface:NetListener
Called when an object has been received from the remote end of the connection. This will be invoked on the same thread asClient.update(int)
andServer.update(int)
. This method should not block for long periods as other network activity will not be processed until it returns.- Specified by:
received
in interfaceNetListener
-
idle
Description copied from interface:NetListener
Called when the connection is below theidle threshold
.- Specified by:
idle
in interfaceNetListener
-
queue
-