|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.isam.exehda.HierarchicalId | +--org.isam.exehda.ApplicationId
Uniquely identifies an application in the scope os the distributed system. In order to guarantee unicity, a hierarchical approach is used to generate these identifiers. The id itself is built up of two parts:
Constructor Summary | |
ApplicationId()
Deprecated. Generating local id through System.currentTimeMillis() is not very secure. |
|
ApplicationId(long localId)
Creates a new ApplicationId instance using the provided id as
application's local id. |
Method Summary | |
boolean |
equals(java.lang.Object o)
Returns whether this ApplicationId is equals to the given object. |
HostId |
getBaseHost()
Returns the host where the application referred by these ApplicationId was first started (launched). |
protected java.lang.Object |
getLocalId()
Subclasses must overwrite this method and return an Object representation of the local id. |
protected java.lang.String |
getType()
Subclasses must overwrite this method and return a String
representation of the ID's type. |
int |
hashCode()
Returns a hash code for these object suitable for the java.util.Hashtable() semantics. |
Methods inherited from class org.isam.exehda.HierarchicalId |
getParentId, isRoot, toString |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ApplicationId(long localId)
ApplicationId
instance using the provided id as
application's local id. The base host (parent ID) is set to
HostId.getLocalHost().
localId
- a long
valuepublic ApplicationId()
ApplicationId
instance. Equivalent to using:
new ApplicationId(System.currentTimeMillis());
Such approach leads to deterministic ApplicationId generation, so it must
be used for debugging purposes only. Using the
ApplicationId(long)
constructor combined with a strong random
number generator is highly encouraged.
Method Detail |
public HostId getBaseHost()
public boolean equals(java.lang.Object o)
equals
in class HierarchicalId
o
- an Object
value
boolean
valuepublic int hashCode()
java.util.Hashtable()
semantics. This is currently a bitwise xor
between the low 32 bits of the local id and the hash code provided by the base
Host.
hashCode
in class HierarchicalId
protected final java.lang.String getType()
HierarchicalId
String
representation of the ID's type.
getType
in class HierarchicalId
String
valueprotected final java.lang.Object getLocalId()
HierarchicalId
getLocalId()
is invoked.
getLocalId
in class HierarchicalId
Object
value
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |