CONTENTS | PREV | NEXT | Java Remote Method Invocation |
UID
Class
The classUID
is an abstraction for creating identifiers that are unique with respect to the host on which it is generated. AUID
is contained in anObjID
as an address space identifier. AUID
consists of a number that is unique on the host (anint
), a time (along
), and a count (ashort
).
package java.rmi.server; public final class UID implements java.io.Serializable { public UID(); public UID(short num); public int hashCode(); public boolean equals(Object obj); public String toString(); public void write(DataOutput out) throws java.io.IOException; public static UID read(DataInput in) throws java.io.IOException; }The first form of the constructor creates a pure identifier that is unique with respect to the host on which it is generated. ThisUID
is unique under the following conditions: a) the machine takes more than one second to reboot, and b) the machine's clock is never set backward. In order to construct aUID
that is globally unique, simply pair aUID
with anInetAddress
.The second form of the constructor creates a well-known
UID
. There are 216 -1 such possible well-known IDs. An ID generated via this constructor will not clash with any ID generated via the defaultUID
constructor which generates a genuinely unique identifier with respect to this host.The methods
hashCode
,equals
, andtoString
are defined forUIDs
. TwoUIDs
are considered equal if they have the same contents.The method
write
writes theUID
to the output stream.The method
read
constructs aUID
whose contents is read from the specified input stream.
CONTENTS | PREV | NEXT
Copyright © 1997-1999 Sun Microsystems, Inc. All Rights Reserved.