public class TCPChannel
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected <any> |
clientChannels
client channels with workerIDs
|
protected <any> |
serverChannels
server channels with workerIDs
|
Constructor and Description |
---|
TCPChannel(Config cfg,
NetworkInfo info)
Start the channel with the given network information
|
Modifier and Type | Method and Description |
---|---|
void |
closeConnection(int workerID) |
TCPMessage |
iRecv(java.nio.ByteBuffer buffer,
int size,
int workerID,
int edge)
Receive a message
|
TCPMessage |
iSend(java.nio.ByteBuffer buffer,
int size,
int workerID,
int edge)
Send a buffer
|
void |
progress()
Progress the communication
|
void |
startConnections(java.util.List<NetworkInfo> workerInfos)
Start the connections to the servers
|
void |
startListening()
Start listening
|
void |
stop()
Stop all the connections
|
void |
waitForConnections(long timeLimit)
Wait for handshakes to happen between servers and clients
|
protected <any> clientChannels
protected <any> serverChannels
public TCPChannel(Config cfg, NetworkInfo info)
cfg
- configurationinfo
- network informationpublic void startListening()
public void startConnections(java.util.List<NetworkInfo> workerInfos)
workerInfos
- information about all the workerspublic TCPMessage iSend(java.nio.ByteBuffer buffer, int size, int workerID, int edge)
buffer
- buffersize
- size of the buffer, we assume start from 0th positionworkerID
- the worker idedge
- the edgpublic TCPMessage iRecv(java.nio.ByteBuffer buffer, int size, int workerID, int edge)
buffer
- buffersize
- size of the buffer, we assume start from 0th positionworkerID
- the worker idedge
- the edgpublic void progress()
public void stop()
public void waitForConnections(long timeLimit)
public void closeConnection(int workerID)