public interface Connection extends AutoCloseable
A Connection
is associated to an EndPoint
so that I/O events
happening on the EndPoint
can be processed by the Connection
.
A typical implementation of Connection
overrides onOpen()
to
set read interest
on the EndPoint
,
and when the EndPoint
signals read readyness, this Connection
can
read bytes from the network and interpret them.
Modifier and Type | Interface and Description |
---|---|
static interface |
Connection.Listener |
Modifier and Type | Method and Description |
---|---|
void |
addListener(Connection.Listener listener) |
void |
close()
Performs a logical close of this connection.
|
long |
getBytesIn() |
long |
getBytesOut() |
long |
getCreatedTimeStamp() |
EndPoint |
getEndPoint() |
int |
getMessagesIn() |
int |
getMessagesOut() |
void |
onClose()
Callback method invoked when this
Connection is closed. |
void |
onOpen()
Callback method invoked when this
Connection is opened. |
void addListener(Connection.Listener listener)
void onOpen()
Callback method invoked when this Connection
is opened.
Creators of the connection implementation are responsible for calling this method.
void onClose()
Callback method invoked when this Connection
is closed.
Creators of the connection implementation are responsible for calling this method.
EndPoint getEndPoint()
EndPoint
associated with this Connection
void close()
Performs a logical close of this connection.
For simple connections, this may just mean to delegate the close to the associated
EndPoint
but, for example, SSL connections should write the SSL close message
before closing the associated EndPoint
.
close
in interface AutoCloseable
int getMessagesIn()
int getMessagesOut()
long getBytesIn()
long getBytesOut()
long getCreatedTimeStamp()
Copyright © 1995-2012 Mort Bay Consulting. All Rights Reserved.