akka.remote
Class AckedSendBuffer<T extends HasSequenceNumber>

java.lang.Object
  extended by akka.remote.AckedSendBuffer<T>
All Implemented Interfaces:
java.io.Serializable, scala.Equals, scala.Product

public class AckedSendBuffer<T extends HasSequenceNumber>
extends java.lang.Object
implements scala.Product, scala.Serializable

Implements an immutable resend buffer that buffers messages until they have been acknowledged. Properly removes messages when an ack is received. This buffer works together with AckedReceiveBuffer on the receiving end.

param: capacity Maximum number of messages the buffer is willing to accept. If reached ResendBufferCapacityReachedException is thrown. param: nonAcked Sequence of messages that has not yet been acknowledged. param: nacked Sequence of messages that has been explicitly negative acknowledged. param: maxSeq The maximum sequence number that has been stored in this buffer. Messages having lower sequence number will be not stored but rejected with IllegalArgumentException

See Also:
Serialized Form

Constructor Summary
AckedSendBuffer(int capacity, scala.collection.immutable.IndexedSeq<T> nonAcked, scala.collection.immutable.IndexedSeq<T> nacked, SeqNo maxSeq)
           
 
Method Summary
 AckedSendBuffer<T> acknowledge(Ack ack)
          Processes an incoming acknowledgement and returns a new buffer with only unacknowledged elements remaining.
 AckedSendBuffer<T> buffer(T msg)
          Puts a new message in the buffer.
 int capacity()
           
 SeqNo maxSeq()
           
 scala.collection.immutable.IndexedSeq<T> nacked()
           
 scala.collection.immutable.IndexedSeq<T> nonAcked()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface scala.Product
productArity, productElement, productIterator, productPrefix
 
Methods inherited from interface scala.Equals
canEqual, equals
 

Constructor Detail

AckedSendBuffer

public AckedSendBuffer(int capacity,
                       scala.collection.immutable.IndexedSeq<T> nonAcked,
                       scala.collection.immutable.IndexedSeq<T> nacked,
                       SeqNo maxSeq)
Method Detail

capacity

public int capacity()

nonAcked

public scala.collection.immutable.IndexedSeq<T> nonAcked()

nacked

public scala.collection.immutable.IndexedSeq<T> nacked()

maxSeq

public SeqNo maxSeq()

acknowledge

public AckedSendBuffer<T> acknowledge(Ack ack)
Processes an incoming acknowledgement and returns a new buffer with only unacknowledged elements remaining.

Parameters:
ack - The received acknowledgement
Returns:
An updated buffer containing the remaining unacknowledged messages

buffer

public AckedSendBuffer<T> buffer(T msg)
Puts a new message in the buffer. Throws IllegalArgumentException if an out-of-sequence message is attempted to be stored.

Parameters:
msg - The message to be stored for possible future retransmission.
Returns:
The updated buffer

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object