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.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 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 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 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<Tuple2<StreamPacket,Future<java.lang.Void>>> |
tosend
The data to send.
|
ACKCLOSE, ACKCLOSE_INPUT_INITIATOR, ACKCLOSE_OUTPUT_PARTICIPANT, ACKCLOSEREQ, ACKCLOSEREQ_INPUT_PARTICIPANT, ACKCLOSEREQ_OUTPUT_INITIATOR, ACKDATA, ACKDATA_INPUT_INITIATOR, ACKDATA_OUTPUT_PARTICIPANT, ACKINIT, ACKINIT_INPUT_PARTICIPANT, ACKINIT_OUTPUT_PARTICIPANT, acktimeout, ALIVE, ALIVE_INITIATOR, ALIVE_PARTICIPANT, alivetime, CLOSE, CLOSE_INPUT_PARTICIPANT, CLOSE_OUTPUT_INITIATOR, CLOSEREQ, CLOSEREQ_INPUT_INITIATOR, CLOSEREQ_OUTPUT_PARTICIPANT, component, con, DATA, DATA_INPUT_PARTICIPANT, DATA_OUTPUT_INITIATOR, EMPTY_BYTE_ARRAY, INIT, INIT_INPUT_INITIATOR, INIT_OUTPUT_INITIATOR, leasetime, maxresends, MESSAGE_TYPE_STREAM, MESSAGETYPES, nonfunc, timer, unacked
Constructor and Description |
---|
OutputConnectionHandler(IInternalAccess component,
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 IFuture<java.lang.Void> |
addMultipacket(byte[] data)
Called internally.
|
protected 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.
|
IFuture<java.lang.Void> |
doClose()
Called from connection.
|
protected IFuture<java.lang.Void> |
doSendData(StreamPacket 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() |
IFuture<java.lang.Void> |
send(byte[] dat)
Called from connection.
|
protected IFuture<java.lang.Void> |
sendAcknowledgedMultiPacket()
Called internally.
|
IFuture<java.lang.Void> |
sendData(StreamPacket task)
Send or resend a data message.
|
protected void |
sendStored()
Called internally.
|
void |
setClosed()
Set the connection closed.
|
IFuture<java.lang.Integer> |
waitForReady()
Wait until the connection is ready for the next write.
|
ackReceived, close, createAckTimer, createTask, createTask, getComponent, getConnection, getConnectionId, getExecutionFeature, getLeasetime, getMessageFeature, getMessageType, getMessageType, getNonFunctionalProperties, initReceived, isClosed, isConnectionAlive, scheduleStep, sendAcknowledgedMessage, sendAlive, sendInit, sendTask, setAliveTime, setConnection, setNonFunctionalProperties, waitForRealDelay
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<Tuple2<StreamPacket,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 Future<java.lang.Void> mpfut
protected long mpsendtimeout
protected java.util.TimerTask mpsendtimer
protected boolean closereqflag
protected Tuple2<java.lang.Boolean,java.lang.Integer> stopflag
protected boolean closesent
protected Future<java.lang.Integer> readyfuture
public OutputConnectionHandler(IInternalAccess component, 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 IFuture<java.lang.Void> doClose()
doClose
in interface IAbstractConnectionHandler
doClose
in class AbstractConnectionHandler
public IFuture<java.lang.Void> send(byte[] dat)
send
in interface IOutputConnectionHandler
public void flush()
flush
in interface IOutputConnectionHandler
public IFuture<java.lang.Integer> waitForReady()
waitForReady
in interface IOutputConnectionHandler
protected void checkWaitForReady()
protected IFuture<java.lang.Void> doSendData(StreamPacket task)
protected void sendStored()
protected IFuture<java.lang.Void> addMultipacket(byte[] data)
protected IFuture<java.lang.Void> addMultiPacketChunk(byte[] data)
data
- The data.protected IFuture<java.lang.Void> sendAcknowledgedMultiPacket()
public IFuture<java.lang.Void> sendData(StreamPacket 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()