class BatchedPreprocessor extends TrivialPreprocessor
Modifier and Type | Field and Description |
---|---|
(package private) static long |
DEFAULT_DELAY |
_context, _dataCache, _log, IV_SIZE, PREPROCESSED_SIZE
Constructor and Description |
---|
BatchedPreprocessor(RouterContext ctx,
String name) |
Modifier and Type | Method and Description |
---|---|
long |
getDelayAmount()
how long do we want to wait before flushing
|
protected long |
getSendDelay()
Wait up to this long before sending (flushing) a small tunnel message
Warning - overridden in BatchedRouterPreprocessor
|
boolean |
preprocessQueue(List<PendingGatewayMessage> pending,
TunnelGateway.Sender sender,
TunnelGateway.Receiver rec)
Return true if there were messages remaining, and we should queue up
a delayed flush to clear them
NOTE: Unused here, see BatchedPreprocessor override, super is not called.
|
protected void |
send(List<PendingGatewayMessage> pending,
int startAt,
int sendThrough,
TunnelGateway.Sender sender,
TunnelGateway.Receiver rec)
Preprocess the messages from the pending list, grouping items startAt
through sendThrough (though only part of the last one may be fully
sent), delivering them through the sender/receiver.
|
getInstructionAugmentationSize, getInstructionsSize, notePreprocessing, preprocess, writeFirstFragment, writeSubsequentFragment
public BatchedPreprocessor(RouterContext ctx, String name)
protected long getSendDelay()
public long getDelayAmount()
getDelayAmount
in interface TunnelGateway.QueuePreprocessor
getDelayAmount
in class TrivialPreprocessor
public boolean preprocessQueue(List<PendingGatewayMessage> pending, TunnelGateway.Sender sender, TunnelGateway.Receiver rec)
TrivialPreprocessor
preprocessQueue
in interface TunnelGateway.QueuePreprocessor
preprocessQueue
in class TrivialPreprocessor
pending
- list of Pending objects for messages either unsent
or partly sent. This list should be update with any
values removed (the preprocessor owns the lock)
Messages are not removed from the list until actually sent.
The status of unsent and partially-sent messages is stored in
the Pending structure.protected void send(List<PendingGatewayMessage> pending, int startAt, int sendThrough, TunnelGateway.Sender sender, TunnelGateway.Receiver rec)
startAt
- first index in pending to send (inclusive)sendThrough
- last index in pending to send (inclusive)