Package ch.rasc.wamp2spring.util
Class IdGenerator
java.lang.Object
ch.rasc.wamp2spring.util.IdGenerator
Id generator, that generates WAMP compliant identification numbers.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic longnewLinearId(AtomicLong longValue) Creates new linear identification number from the provided parameter.static longnewRandomId(Set<Long> existingIds) Creates a new random generated identification number, that does not collide with an existing ids in the provided Set.
-
Field Details
-
MIN
public static final long MIN- See Also:
-
MAX
public static final long MAX- See Also:
-
-
Constructor Details
-
IdGenerator
public IdGenerator()
-
-
Method Details
-
newRandomId
Creates a new random generated identification number, that does not collide with an existing ids in the provided Set.Used for global scope messages
- Parameters:
existingIds- a collection of existing ids.- Returns:
- a new random identification number
-
newLinearId
Creates new linear identification number from the provided parameter.Used for session scope and router scope ids
- Parameters:
longValue- start address of the identification number. Next number will be this value plus 1- Returns:
- new id
-