testEnvironment
Class ReceivalCheck

java.lang.Object
  extended by testEnvironment.ReceivalCheck

final class ReceivalCheck
extends java.lang.Object

Can be used to validate if a message sent, was received as well or dropped for some reason.

For performance reasons, only an identifying integer (4 bytes) is saved for each message for later comparison.

Author:
Karl-Peter Fuchs

Field Summary
private static long checkInterval
          Interval after which a check for lost messages is performed.
private static InternalInformationPortController internalInformationPort
          Reference on component InternalInformationPort.
private static java.util.logging.Logger LOGGER
          Logger used to log and display information.
private static java.util.LinkedList<java.lang.Integer> notYetReceived
          List with messages, that were "sent", but not "received" so far.
private static java.lang.Integer[] notYetReceivedLastly
          Messages, that were "sent" in the last interval, but haven't been "received" yet.
private static int receivedMessages
          Number of messages "received" so far.
private static int sentMessages
          Number of messages "sent" so far.
 
Constructor Summary
private ReceivalCheck()
          Empty constructor.
 
Method Summary
protected static void addReceivedMessage(int messageID)
          Removes the bypassed message identifier from notYetReceived list.
protected static void addSentMessage(int messageID)
          Saves the bypassed message identifier in the notYetReceived list.
private static void checkReceival()
          Checks if messages, which haven't been "received" in the last interval, haven't been "received" it in the actual interval as well (and are therefore considered as lost).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

internalInformationPort

private static InternalInformationPortController internalInformationPort
Reference on component InternalInformationPort. Used to display and/or log data and read general settings.


LOGGER

private static final java.util.logging.Logger LOGGER
Logger used to log and display information.


checkInterval

private static long checkInterval
Interval after which a check for lost messages is performed. If a message isn't received after twice this interval, it is considered as lost.


sentMessages

private static int sentMessages
Number of messages "sent" so far.


receivedMessages

private static int receivedMessages
Number of messages "received" so far.


notYetReceived

private static java.util.LinkedList<java.lang.Integer> notYetReceived
List with messages, that were "sent", but not "received" so far.


notYetReceivedLastly

private static java.lang.Integer[] notYetReceivedLastly
Messages, that were "sent" in the last interval, but haven't been "received" yet. Used to check whether any of these messages hasn't been "received" even after the next interval. In this case a message is considered as lost.

Constructor Detail

ReceivalCheck

private ReceivalCheck()
Empty constructor.

Method Detail

checkReceival

private static void checkReceival()
Checks if messages, which haven't been "received" in the last interval, haven't been "received" it in the actual interval as well (and are therefore considered as lost).


addSentMessage

protected static void addSentMessage(int messageID)
Saves the bypassed message identifier in the notYetReceived list. If the checkInterval is reached, a check for lost messages is performed. Gets called by ClientSimulator every time it sends a new message.

See Also:
checkInterval

addReceivedMessage

protected static void addReceivedMessage(int messageID)
Removes the bypassed message identifier from notYetReceived list. Gets called by ClientSimulator every time it receives a reply.

See Also:
notYetReceived