|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectmessageProcessor.ReplayDetection
class ReplayDetection
Detects whether a message has already been processed, or not. Detection is done using timestamps and hash tables.
This class is thread-safe (but parallel execution won't increase performance).
Field Summary | |
---|---|
private static NetworkClockController |
clock
Reference on component NetworkClock used to validate
timestamps. |
private float |
DB_LOAD_FACTOR
The load factor for the hash tables replayDatabase1 and
replayDatabase2 . |
private int |
INITIAL_DB_CAPACITY
Number of items the database for replay detection should approximately hold. |
private static InternalInformationPortController |
internalInformationPort
Reference on InternalInformationPort . |
private long |
lastDBSwitch
Point of time, the databases were switched (and one got replaced) lastly. |
private static java.util.logging.Logger |
LOGGER
Logger used to log and display information. |
private long |
MAX_DELAY
Time after which a message is considered as out of date in ms. |
private java.util.Hashtable<java.lang.Integer,byte[]> |
replayDatabase1
First replay database. |
private java.util.Hashtable<java.lang.Integer,byte[]> |
replayDatabase2
Second replay database. |
private long |
TOLERANCE
Maximum divergence between mix' and client's clock in ms. |
private boolean |
writeToDB1
Indicates weather to write in the first or second replay database. |
Constructor Summary | |
---|---|
protected |
ReplayDetection()
Loads values from property file and initializes hash tables. |
Method Summary | |
---|---|
private boolean |
isAlreadyInDB(java.lang.Integer key,
byte[] value)
Detects whether a key is in one of the databases or not. |
protected boolean |
isReplay(BasicMessage basicMessage)
Detects whether a message has already been processed, or not. |
private boolean |
isReplay(java.lang.Integer key,
byte[] value,
long timestamp)
Detects whether a message has already been processed, or not. |
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
NetworkClock
used to validate
timestamps.
private final int INITIAL_DB_CAPACITY
private final float DB_LOAD_FACTOR
replayDatabase1
and
replayDatabase2
.
private final long TOLERANCE
private final long MAX_DELAY
private java.util.Hashtable<java.lang.Integer,byte[]> replayDatabase1
private java.util.Hashtable<java.lang.Integer,byte[]> replayDatabase2
private long lastDBSwitch
private boolean writeToDB1
Constructor Detail |
---|
protected ReplayDetection()
Method Detail |
---|
protected boolean isReplay(BasicMessage basicMessage)
basicMessage
- The message to be checked.
private boolean isReplay(java.lang.Integer key, byte[] value, long timestamp)
key
- The message's key in the hash table.value
- The message's value in the hash table.timestamp
- The message's timestamp.
private boolean isAlreadyInDB(java.lang.Integer key, byte[] value)
key
- The key to be checked.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |