|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface ConnectionListener
Receives asynchronous notification of events from an associated
Connection. The connected method is invoked when the
connection is established, either actively from a Connector or
passively by an Acceptor. The bytesReceived method is
invoked when data arrives on the connection. The exceptionThrown
method is invoked to forward asynchronous network exceptions. The
disconnected method is invoked when the connection has been
closed, or if the connection could not be initiated at all (e.g., when a
connector fails to connect).
The IO framework ensures that only one notification is processed at a
time for each instance of Connection. Thus, a
ConnectionListener does not need to take special steps to ensure
thread safety so long as it does not access resources shared among the
listeners of other connections.
| Method Summary | |
|---|---|
void |
bytesReceived(Connection conn,
byte[] message)
Notifies this listener that data arrives on a connection. |
void |
connected(Connection conn)
Notifies this listener that the connection is established, either actively from a Connector or passively
by an Acceptor. |
void |
disconnected(Connection conn)
Notifies this listener that the connection has been closed, or that it could not be initiated (e.g., when a Connector fails to connect). |
void |
exceptionThrown(Connection conn,
Throwable exception)
Notifies this listener that a network exception has occurred on the connection. |
| Method Detail |
|---|
void connected(Connection conn)
Connector or passively
by an Acceptor. This indicates that the connection is
ready for use, and data may be sent and received on it.
conn - the Connection that has become connected.
void bytesReceived(Connection conn,
byte[] message)
message is not guaranteed to be a single, whole
message; this method is responsible for message reassembly
unless the connection itself guarantees that only complete
messages are delivered.
conn - the Connection on which the message arrivedmessage - the received message bytes
void exceptionThrown(Connection conn,
Throwable exception)
conn - the Connection on which the exception occuredexception - the thrown exceptionvoid disconnected(Connection conn)
Connector fails to connect).
conn - the Connection that has disconnected
|
Project Darkstar, Version 0.9.9.6 2013-07-29 20:55:54 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||