|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.rit.m2mi.Eoid
public class Eoid
Class Eoid encapsulates an exported object identifier (EOID). An EOID uniquely identifies an object that has been exported to the M2MI layer. An EOID is a 128-bit value consisting of the following fields (from most significant to least significant): a 48-bit sequence number, a 48-bit device ID, and a 32-bit process ID. The wildcard EOID, which designates all objects that implement a certain target interface, has a value of 0.
Class Eoid provides the next() method to generate a series of EOIDs.
The first generated EOID has its sequence number initialized from the system
clock (System.currentTimeMillis()); has its device ID initialized to
the device's globally unique device ID from the device properties file (see
class DeviceProperties
); and has its
process ID initialized to that of the current process (see class
Platform
). Thereafter, each successively
generated EOID has a sequence number 1 greater than the previous EOID and has
the same device ID and process ID.
Class Eoid also provides the increment() method to generate an EOID that is "1 greater" than an existing EOID. The new EOID's sequence number is set to 1 greater than the existing EOID's sequence number. The new EOID's device ID and process ID are set to those of the current device and process. Class Eoid further provides the compareTo method for determining the order of two EOIDs and the max() and min() methods for choosing the larger or smaller of two EOIDs. Thus, EOIDs can be used as Lamport timestamp values for a logical clock in a distributed system.
Field Summary | |
---|---|
static Eoid |
WILDCARD
The wildcard EOID. |
Constructor Summary | |
---|---|
Eoid()
Construct a new EOID. |
Method Summary | |
---|---|
int |
compareTo(Object obj)
Compare this EOID with the given object. |
boolean |
equals(Object obj)
Determine if this EOID is equal to the given object. |
int |
hashCode()
Returns a hash code for this EOID. |
Eoid |
increment()
Generate the next EOID after this EOID. |
static Eoid |
max(Eoid eoid1,
Eoid eoid2)
Determine the larger of the two given EOIDs. |
static Eoid |
min(Eoid eoid1,
Eoid eoid2)
Determine the smaller of the two given EOIDs. |
static Eoid |
next()
Generate the next EOID in the series of generated EOIDs. |
void |
read(DataInput theDataInput)
Read this EOID from the given data input stream. |
void |
readExternal(ObjectInput theObjectInput)
Read this EOID from the given object input stream. |
String |
toString()
Returns a string version of this EOID. |
void |
write(DataOutput theDataOutput)
Write this EOID to the given data output stream. |
void |
writeExternal(ObjectOutput theObjectOutput)
Write this EOID to the given object output stream. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Eoid WILDCARD
Constructor Detail |
---|
public Eoid()
Method Detail |
---|
public static Eoid next()
public Eoid increment()
public static Eoid max(Eoid eoid1, Eoid eoid2)
eoid1
- First EOID.eoid2
- Second EOID.
NullPointerException
- (unchecked exception) Thrown if eoid1 is null or
eoid2 is null.public static Eoid min(Eoid eoid1, Eoid eoid2)
eoid1
- First EOID.eoid2
- Second EOID.
NullPointerException
- (unchecked exception) Thrown if eoid1 is null or
eoid2 is null.public int compareTo(Object obj)
compareTo
in interface Comparable
obj
- Object to compare to. It must be a non-null instance of
class Eoid.
NullPointerException
- (unchecked exception) Thrown if obj is null.
ClassCastException
- (unchecked exception) Thrown if obj is not an instance of
class Eoid.public boolean equals(Object obj)
equals
in class Object
obj
- Object to test.
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
public void write(DataOutput theDataOutput) throws IOException
theDataOutput
- Data output stream.
IOException
- Thrown if an I/O error occurred.public void read(DataInput theDataInput) throws IOException
write()
.
theDataInput
- Data input stream.
IOException
- Thrown if an I/O error occurred.public void writeExternal(ObjectOutput theObjectOutput) throws IOException
writeExternal
in interface Externalizable
theObjectOutput
- Object output stream.
IOException
- Thrown if an I/O error occurred.public void readExternal(ObjectInput theObjectInput) throws IOException
writeExternal()
.
readExternal
in interface Externalizable
theObjectInput
- Object input stream.
IOException
- Thrown if an I/O error occurred.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |