Package org.apache.activemq.util
Class IdGenerator
java.lang.Object
org.apache.activemq.util.IdGenerator
Generator for Globally unique Strings.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intDoes a proper compare on the idsGenerate a unique idGenerate a unique ID - that is friendly for a URL or file systemstatic StringAs we have to find the hostname as a side-affect of generating a unique stub, we allow it's easy retrieval herestatic StringgetSeedFromId(String id) From a generated id - return the seed (i.e. minus the count)static longFrom a generated id - return the generator countstatic StringsanitizeHostName(String hostName)
-
Field Details
-
PROPERTY_IDGENERATOR_HOSTNAME
- See Also:
-
PROPERTY_IDGENERATOR_LOCALPORT
- See Also:
-
PROPERTY_IDGENERATOR_PORT
- See Also:
-
-
Constructor Details
-
IdGenerator
Construct an IdGenerator -
IdGenerator
public IdGenerator()
-
-
Method Details
-
getHostName
As we have to find the hostname as a side-affect of generating a unique stub, we allow it's easy retrieval here- Returns:
- the local host name
-
generateId
Generate a unique id- Returns:
- a unique id
-
sanitizeHostName
-
generateSanitizedId
Generate a unique ID - that is friendly for a URL or file system- Returns:
- a unique id
-
getSeedFromId
From a generated id - return the seed (i.e. minus the count)- Parameters:
id- the generated identifier- Returns:
- the seed
-
getSequenceFromId
From a generated id - return the generator count- Parameters:
id-- Returns:
- the count
-
compare
Does a proper compare on the ids- Parameters:
id1-id2-- Returns:
- 0 if equal else a positive if id1 is > id2 ...
-