|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectinputOutputHandler.ReplyDecision
final class ReplyDecision
Decides about the optimal reply size and time depending on the current traffic situation (only used by last mix of cascade).
"Traffic situation" means the amount of data available to reply (for each channel/user) at a given point of time.
"Optimal size" means the best tradeoff between padding and the total amount of (available) data actually sent. A "perfect size" is only possible if all channels contain the same amount of data. In any other situation, optimizing one parameter will have a negative effect on the other. So, "the best tradeoff" depends on situational conditions and therefore can't be generalized.
"Optimal time" means the best point of time for returning the data available which again is a tradeoff and depends on situational conditions and therefore can't be generalized.
Field Summary | |
---|---|
private long |
batchBegin
Timestamp of the first validation (of the traffic situation) for the current decision. |
private int |
CIPHER_BLOCK_SIZE
Block size of the cryptographic algorithm used to encrypt Reply ies in byte. |
private static NetworkClockController |
clock
|
private double |
g
Tradeoff-indicator between padding and the total amount of (available) data actually sent. |
private InputOutputHandlerController |
inputOutputHandler
Reference on InputOutputHandlerController (used to add
unprocessed Reply ies). |
private static InternalInformationPortController |
internalInformationPort
Reference on component InternalInformationPort . |
private boolean |
isNewDecision
Indicates whether the first validation (of the traffic situation) for the current decision has already taken place or not (used to calculate timeout condition). |
private static java.util.logging.Logger |
LOGGER
Logger used to log and display information. |
private int |
MAX_REPLY_LENGTH
Maximum size a Reply may have in byte. |
private float |
MIN_FILLED_CHANNELS
Minimum number of channels with data available to be returned (before replying is allowed). |
private int |
MIN_VOLUME_PER_CHANNEL
Minimum amount of data per Reply in byte (before replying
is allowed). |
private long |
TIMEOUT
Timeout for reply size decision in ms. |
private long |
VOLUME_DECISSION_CHECK_RATE
Amount of time between validations of the traffic situation. |
Constructor Summary | |
---|---|
protected |
ReplyDecision(InputOutputHandlerController inputOutputHandler)
Creates a new ReplyDecision object which can be used to
decides about the optimal reply size and time depending on the current
traffic situation by the last mix of a cascade. |
Method Summary | |
---|---|
private int |
adjustBlockSizeToCryptographicBlockSize(int blockSize)
Adjusts the "optimal size" to the CIPHER_BLOCK_SIZE (only
multiples of the CIPHER_BLOCK_SIZE are useful). |
private void |
generateReplyBatch(User[] channels)
Decides about the optimal reply size and time depending on the current traffic situation for the bypassed channels/users. |
private static java.lang.String |
getProperty(java.lang.String key)
Simply used to shorten method calls (calls internalInformationPort.getProperty(key) ). |
private int[] |
getVolumeForEachChannel(User[] channels)
Returns an array containing the amount of data currently available in each bypassed channel. |
private int |
getWeightedMedian(int[] bytesReadSoFar)
Decides about the "optimal size" of the reply batch (in byte). |
private boolean |
isEnoughDataAvailable(int[] bytesReadSoFar)
Decides whether "enough" data is available for replying or not. |
protected void |
manageReplyProcess(User[] channels)
Decides about the optimal reply size and time depending on the current traffic situation for the bypassed channels/users. |
private void |
processMessages(int replySize,
User[] channels)
Generates Reply ies and passes them to the
InputOutputHandlerController . |
private boolean |
shallMixReply(int[] bytesReadSoFar)
Decides whether it's time to reply or not ("true" when timeout reached or isEnoughDataAvailable() == true ). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static InternalInformationPortController internalInformationPort
InternalInformationPort
.
Used to display and/or log data and read general settings.
private static final java.util.logging.Logger LOGGER
private static NetworkClockController clock
private InputOutputHandlerController inputOutputHandler
InputOutputHandlerController
(used to add
unprocessed Reply
ies).
InputOutputHandlerController.addUnprocessedReply(ReplyMessage)
private final long TIMEOUT
private final int MAX_REPLY_LENGTH
Reply
may have in byte.
private final int CIPHER_BLOCK_SIZE
Reply
ies in byte.
private final int MIN_VOLUME_PER_CHANNEL
Reply
in byte (before replying
is allowed).
MIN_FILLED_CHANNELS
private final float MIN_FILLED_CHANNELS
MIN_VOLUME_PER_CHANNEL
private final long VOLUME_DECISSION_CHECK_RATE
private double g
private long batchBegin
private boolean isNewDecision
Constructor Detail |
---|
protected ReplyDecision(InputOutputHandlerController inputOutputHandler)
ReplyDecision
object which can be used to
decides about the optimal reply size and time depending on the current
traffic situation by the last mix of a cascade.
"Traffic situation" means the amount of data available to reply (for each channel/user) at a given point of time.
"Optimal size" means the best tradeoff between padding and the total amount of (available) data actually sent. A "perfect size" is only possible if all channels contain the same amount of data. In any other situation, optimizing one parameter will have a negative effect on the other. So, "the best tradeoff" depends on situational conditions and therefore can't be generalized.
"Optimal time" means the best point of time for returning the data available which again is a tradeoff and depends on situational conditions and therefore can't be generalized.
inputOutputHandler
- Reference on
InputOutputHandlerController
(used to add unprocessed
Reply
ies).Method Detail |
---|
protected void manageReplyProcess(User[] channels)
channels
- The channels/users to be observed.private void generateReplyBatch(User[] channels)
channels
- The channels/users to be observed.private int[] getVolumeForEachChannel(User[] channels)
channels
- The channels/users to be observed.
private boolean shallMixReply(int[] bytesReadSoFar)
isEnoughDataAvailable() == true
).
bytesReadSoFar
- Amount of data currently available in each
channel.
private boolean isEnoughDataAvailable(int[] bytesReadSoFar)
MIN_VOLUME_PER_CHANNEL
data in
MIN_FILLED_CHANNELS
channels available.
bytesReadSoFar
- Amount of data currently available in each
channel.
MIN_FILLED_CHANNELS
,
MIN_VOLUME_PER_CHANNEL
private int getWeightedMedian(int[] bytesReadSoFar)
bytesReadSoFar
- Amount of data currently available in each
channel (in byte).
private int adjustBlockSizeToCryptographicBlockSize(int blockSize)
CIPHER_BLOCK_SIZE
(only
multiples of the CIPHER_BLOCK_SIZE
are useful).
blockSize
- "Optimal size" (not adjusted).
CIPHER_BLOCK_SIZE
private void processMessages(int replySize, User[] channels)
Reply
ies and passes them to the
InputOutputHandlerController
.
replySize
- Size the replies shall have.channels
- Channels/users to send replies to.private static java.lang.String getProperty(java.lang.String key)
internalInformationPort.getProperty(key)
). Returns the
property with the specified key from the property file.
key
- The property key.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |