|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectoutputStrategy.Batch
final class Batch
Data structure used to stores processed messages until output is requested
(see putOutBatch()
). Then, all messages in the buffer are
submitted to the InputOutputHandler
, which sends them to their
destination. Messages are added in sorted manner (alphabetic, ascending
order) to prevent linkability of (incoming and outgoing) messages due to
their position in the input and output stream.
This class is thread-safe.
Field Summary | |
---|---|
private boolean |
BELONGS_TO_LAST_MIX
Indicates whether this Batch belongs to the last mix of a
cascade or not. |
private java.util.ArrayList<Message> |
buffer
ArrayList containing the messages. |
private int |
correctPosition
Position, the message currently processed shall be saved to (in buffer ). |
private InputOutputHandlerController |
inputOutputHandler
Reference on InputOutputHandler used to send messages to
their destination when putOutBatch() was called. |
private boolean |
IS_REQUEST_BATCH
Indicates whether this Batch is used to collect
Request s or Reply ies. |
Constructor Summary | |
---|---|
protected |
Batch(int initialMessageBufferSize,
boolean isRequestBatch,
boolean belongsToLastMix,
InputOutputHandlerController inputOutputHandlerController)
Constructs a new Batch that can be used to stores processed
messages until output is requested (see putOutBatch() ). |
Method Summary | |
---|---|
protected void |
addMessage(Message message)
Adds the bypassed message to the local buffer (at the correct position according to alphabetic, ascending order). |
private void |
findCorrectPosition(Message message,
int startIndex,
int endIndex)
Finds the correct position (alphabetic, ascending order) the bypassed message shall be saved to (in buffer ). |
protected void |
putOutBatch()
Puts out the current batch, by submitting all messages in buffer to the InputOutputHandler , which sends them to their
destination. |
protected int |
size()
Returns the total number of messages currently in this Batch . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final boolean IS_REQUEST_BATCH
Batch
is used to collect
Request
s or Reply
ies.
private final boolean BELONGS_TO_LAST_MIX
Batch
belongs to the last mix of a
cascade or not.
private java.util.ArrayList<Message> buffer
private int correctPosition
buffer
). Calculated by findCorrectPosition(Message
message, int startIndex, int endIndex)
.
buffer
,
findCorrectPosition(Message, int, int)
private InputOutputHandlerController inputOutputHandler
InputOutputHandler
used to send messages to
their destination when putOutBatch()
was called.
Constructor Detail |
---|
protected Batch(int initialMessageBufferSize, boolean isRequestBatch, boolean belongsToLastMix, InputOutputHandlerController inputOutputHandlerController)
Batch
that can be used to stores processed
messages until output is requested (see putOutBatch()
).
initialMessageBufferSize
- Initial size for the data structure
(ArrayList
) used to
store messages.isRequestBatch
- Indicates whether this
Batch
is used to
collect Request
s or
Reply
ies.belongsToLastMix
- Indicates whether this
Batch
belongs to the
last mix of a cascade or not.inputOutputHandlerController
- Reference on component
InputOutputHandler
(used to send messages to their
destination when
putOutBatch()
was
called).Method Detail |
---|
protected int size()
Batch
.
Batch
.protected void addMessage(Message message)
message
- Message to be added to local buffer.private void findCorrectPosition(Message message, int startIndex, int endIndex)
buffer
). (Recursive;
divide and conquer).
correctPosition
,
buffer
,
Message.compareTo(Message)
protected void putOutBatch()
InputOutputHandler
, which sends them to their
destination.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |