| CONTENTS | PREV | NEXT | Java Remote Method Invocation |
UID Class
The classUIDis an abstraction for creating identifiers that are unique with respect to the host on which it is generated. AUIDis contained in anObjIDas an address space identifier. AUIDconsists 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. ThisUIDis 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 aUIDthat is globally unique, simply pair aUIDwith 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 defaultUIDconstructor which generates a genuinely unique identifier with respect to this host.The methods
hashCode,equals, andtoStringare defined forUIDs. TwoUIDsare considered equal if they have the same contents.The method
writewrites theUIDto the output stream.The method
readconstructs aUIDwhose contents is read from the specified input stream.
CONTENTS | PREV | NEXT
Copyright © 1997-1999 Sun Microsystems, Inc. All Rights Reserved.