public class Connection extends Object
Modifier and Type | Field and Description |
---|---|
int |
messageBacklog |
Modifier and Type | Method and Description |
---|---|
void |
close()
Tear down the connection and de-allocate any internal resources.
|
Map<Integer,Conversation> |
conversations()
Provides an unmodifiable view of the ongoing conversations on this
connection.
|
void |
endConversation(Conversation conversation)
Conclude the specified conversation.
|
protected void |
finalize()
Close the connection when we go out of referential scope.
|
InetAddress |
inetAddress()
Get the remote network address to which this connection leads.
|
ConnectionListener |
listener()
Gets the listener delegate on this connection.
|
InetAddress |
localAddress()
Get the local network address on which this connection is bound.
|
int |
port()
Get the remote network port to which this connection leads.
|
ConversationProvider |
provider()
Get the conversation provider associated with this connection.
|
ThroughputTracker |
receivedBytes()
Get throughput tracker for received bytes.
|
ThroughputTracker |
receivedMessages()
Get throughput tracker for received messages.
|
void |
resetMetrics()
Resets all message and bytes trackers.
|
void |
sendMessage(Conversation conversation,
byte[] message)
Send a byte array message in the context of the specified conversation.
|
void |
sendMessage(Conversation conversation,
Writable message)
Send a writable message in the context of the specified conversation.
|
void |
setListener(ConnectionListener listener)
Sets the listener delegate on this connection.
|
Conversation |
startConversation(String topic,
int cid,
int parentId)
Initiate a conversation on the specified topic.
|
ThroughputTracker |
transmittedBytes()
Get throughput tracker for transmitted bytes.
|
ThroughputTracker |
transmittedMessages()
Get throughput tracker for transmitted messages.
|
public ConversationProvider provider()
public InetAddress inetAddress()
public InetAddress localAddress()
public int port()
protected void finalize() throws Throwable
public void close()
public Conversation startConversation(String topic, int cid, int parentId)
topic
- name of the topiccid
- conversation idparentId
- parent conversation idpublic void endConversation(Conversation conversation)
conversation
- conversation to be endedpublic void sendMessage(Conversation conversation, Writable message)
conversation
- conversation contextmessage
- writable message to sendpublic void sendMessage(Conversation conversation, byte[] message)
conversation
- conversation contextmessage
- byte array to transmitpublic ConnectionListener listener()
public void setListener(ConnectionListener listener)
listener
- listener to which notifications will be sentpublic ThroughputTracker receivedBytes()
public ThroughputTracker receivedMessages()
public ThroughputTracker transmittedBytes()
public ThroughputTracker transmittedMessages()
public void resetMetrics()
public Map<Integer,Conversation> conversations()
Copyright © 2015. All Rights Reserved.