public class OutputConnectionHandler extends AbstractConnectionHandler implements IOutputConnectionHandler
Modifier and Type | Class and Description |
---|---|
class |
OutputConnectionHandler.DataSendInfo
Info about a sent but not yet acknowledged data message.
|
AbstractConnectionHandler.ConnectionPanel, AbstractConnectionHandler.SendInfo
Modifier and Type | Field and Description |
---|---|
protected int |
ackcnt
The number of received elements after which an ack is sent.
|
protected java.util.TimerTask |
acktimer
The acknowledgement timer.
|
protected boolean |
closereqflag
Close request flag (when a closereq message was received).
|
protected boolean |
closesent
Flag if close was already sent.
|
protected int |
maxqueued
The max number of messages that can be sending concurrently (i.e.
|
protected int |
maxsend
The max number of packets that can be sent without an ack is received.
|
protected jadex.commons.future.Future<java.lang.Void> |
mpfut
The current multipacket future (shared by all write requests that put data in the same multi packet).
|
protected int |
mpmaxsize
The packet size to collect (in bytes).
|
protected long |
mpsendtimeout
The max delay before a multipacket is sent (even if not full).
|
protected java.util.TimerTask |
mpsendtimer
The multipacket send timer.
|
protected int |
mpsize
The current multipacket size.
|
protected java.util.List<byte[]> |
multipacket
The collected data for a packet.
|
protected boolean |
multipackets
Flag if multipackets should be used.
|
protected int |
queuecnt
The number of sending messages (i.e.
|
protected jadex.commons.future.Future<java.lang.Integer> |
readyfuture
Future used in waitForReady().
|
protected java.util.Map<java.lang.Integer,OutputConnectionHandler.DataSendInfo> |
sent
The data sent (not acknowledged).
|
protected int |
seqnumber
The current sequence number.
|
protected jadex.commons.Tuple2<java.lang.Boolean,java.lang.Integer> |
stopflag
Stop flag (is sent in ack from input side) to signal that the rceiver is flooded with data).
|
protected java.util.List<jadex.commons.Tuple2<StreamSendTask,jadex.commons.future.Future<java.lang.Void>>> |
tosend
The data to send.
|
acktimeout, alivetime, con, leasetime, maxresends, ms, nonfunc, unacked
Constructor and Description |
---|
OutputConnectionHandler(MessageService ms,
java.util.Map<java.lang.String,java.lang.Object> nonfunc)
Create a new handler.
|
Modifier and Type | Method and Description |
---|---|
void |
ackDataReceived(AckInfo ackinfo)
Called from message service.
|
protected jadex.commons.future.IFuture<java.lang.Void> |
addMultipacket(byte[] data)
Called internally.
|
protected jadex.commons.future.IFuture<java.lang.Void> |
addMultiPacketChunk(byte[] data)
Called internally.
|
protected void |
checkClose() |
void |
checkResend()
Check resending of unacknowledged messages.
|
protected void |
checkWaitForReady() |
void |
closeRequestReceived()
Received a request to close the connection.
|
protected java.util.TimerTask |
createBulkAckTimer(java.lang.Object id)
Triggers resends of packets if no ack has been received in acktimeout.
|
protected void |
createMultipacketSendTimer(int seqno)
This timer automatically sends non-full multipackets after mpsendtimeout has occurred.
|
jadex.commons.future.IFuture<java.lang.Void> |
doClose()
Called from connection.
|
protected jadex.commons.future.IFuture<java.lang.Void> |
doSendData(StreamSendTask task) |
void |
flush()
Flush the data.
|
int |
getNextSequenceNumber()
Get The next seqnumber.
|
OutputConnection |
getOutputConnection()
Get the output connection.
|
int |
getSequenceNumber()
Get the seqnumber.
|
boolean |
isCloseRequested()
Get the closereq.
|
protected boolean |
isDataAckFinished()
Tests if the data processing of the connection is finished.
|
protected boolean |
isDataSendFinished()
Tests if the data processing of the connection is finished.
|
protected boolean |
isSendAllowed() |
protected boolean |
isStop() |
void |
notifyInited() |
jadex.commons.future.IFuture<java.lang.Void> |
send(byte[] dat)
Called from connection.
|
protected jadex.commons.future.IFuture<java.lang.Void> |
sendAcknowledgedMultiPacket()
Called internally.
|
jadex.commons.future.IFuture<java.lang.Void> |
sendData(StreamSendTask task)
Send or resend a data message.
|
protected void |
sendStored()
Called internally.
|
void |
setClosed()
Set the connection closed.
|
jadex.commons.future.IFuture<java.lang.Integer> |
waitForReady()
Wait until the connection is ready for the next write.
|
ackReceived, close, createAckTimer, createGui, createPanel, createTask, createTask, getCodecIds, getCodecs, getConnection, getConnectionId, getLeasetime, getMessageType, getNonFunctionalProperties, getTransports, initReceived, isClosed, isConnectionAlive, scheduleStep, sendAcknowledgedMessage, sendAlive, sendInit, sendTask, setAliveTime, setConnection, setNonFunctionalProperties
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getNonFunctionalProperties, sendInit, setConnection
protected java.util.Map<java.lang.Integer,OutputConnectionHandler.DataSendInfo> sent
protected java.util.List<jadex.commons.Tuple2<StreamSendTask,jadex.commons.future.Future<java.lang.Void>>> tosend
protected int seqnumber
protected int maxsend
protected int maxqueued
protected int ackcnt
protected int queuecnt
protected java.util.TimerTask acktimer
protected boolean multipackets
protected int mpmaxsize
protected java.util.List<byte[]> multipacket
protected int mpsize
protected jadex.commons.future.Future<java.lang.Void> mpfut
protected long mpsendtimeout
protected java.util.TimerTask mpsendtimer
protected boolean closereqflag
protected jadex.commons.Tuple2<java.lang.Boolean,java.lang.Integer> stopflag
protected boolean closesent
protected jadex.commons.future.Future<java.lang.Integer> readyfuture
public OutputConnectionHandler(MessageService ms, java.util.Map<java.lang.String,java.lang.Object> nonfunc)
public void closeRequestReceived()
public void ackDataReceived(AckInfo ackinfo)
public void notifyInited()
notifyInited
in interface IAbstractConnectionHandler
notifyInited
in class AbstractConnectionHandler
public jadex.commons.future.IFuture<java.lang.Void> doClose()
doClose
in interface IAbstractConnectionHandler
doClose
in class AbstractConnectionHandler
public jadex.commons.future.IFuture<java.lang.Void> send(byte[] dat)
send
in interface IOutputConnectionHandler
public void flush()
flush
in interface IOutputConnectionHandler
public jadex.commons.future.IFuture<java.lang.Integer> waitForReady()
waitForReady
in interface IOutputConnectionHandler
protected void checkWaitForReady()
protected jadex.commons.future.IFuture<java.lang.Void> doSendData(StreamSendTask task)
protected void sendStored()
protected jadex.commons.future.IFuture<java.lang.Void> addMultipacket(byte[] data)
protected jadex.commons.future.IFuture<java.lang.Void> addMultiPacketChunk(byte[] data)
data
- The data.protected jadex.commons.future.IFuture<java.lang.Void> sendAcknowledgedMultiPacket()
public jadex.commons.future.IFuture<java.lang.Void> sendData(StreamSendTask task)
protected java.util.TimerTask createBulkAckTimer(java.lang.Object id)
id
- The message id.protected boolean isSendAllowed()
protected boolean isStop()
public boolean isCloseRequested()
protected boolean isDataSendFinished()
protected boolean isDataAckFinished()
public void setClosed()
public OutputConnection getOutputConnection()
public int getSequenceNumber()
public int getNextSequenceNumber()
protected void createMultipacketSendTimer(int seqno)
protected void checkClose()
public void checkResend()