public class VersionedIdentifier extends Object
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(org.cojen.dirmi.core.AbstractIdentifier id)
Lexicographically compares two identifiers.
|
boolean |
equals(Object obj) |
int |
hashCode() |
static VersionedIdentifier |
identify(Object obj)
Returns a new or existing unique identifier for the given object.
|
int |
localVersion()
Returns the current local version number.
|
int |
nextLocalVersion()
Atomically increments local version number and returns the new value.
|
static VersionedIdentifier |
read(DataInput in)
Returns a deserialized identifier, which may or may not have an object
registered with it.
|
static VersionedIdentifier |
read(InputStream in)
Returns a deserialized identifier, which may or may not have an object
registered with it.
|
static VersionedIdentifier |
readAndUpdateRemoteVersion(DataInput in)
Returns a deserialized identifier, and also updates the remote
version.
|
<T> void |
register(T obj)
Register the given object with this identifier.
|
int |
remoteVersion()
Returns the current remote version number.
|
String |
toString() |
Object |
tryRetrieve()
Returns the identified object, if it exists locally.
|
boolean |
updateRemoteVersion(int value)
Atomically updates the remote version number only if the given value is
greater than the current remote version.
|
void |
write(DataOutput out) |
void |
write(OutputStream out) |
void |
writeWithNextVersion(DataOutput out)
Writes the identifier and also writes the next local version number.
|
public static VersionedIdentifier identify(Object obj)
IllegalArgumentException - if object is nullpublic static VersionedIdentifier read(DataInput in) throws IOException
IOExceptionpublic static VersionedIdentifier read(InputStream in) throws IOException
IOExceptionpublic static VersionedIdentifier readAndUpdateRemoteVersion(DataInput in) throws IOException
IOExceptionpublic void writeWithNextVersion(DataOutput out) throws IOException
IOExceptionpublic int localVersion()
public int nextLocalVersion()
public int remoteVersion()
public boolean updateRemoteVersion(int value)
public Object tryRetrieve()
public <T> void register(T obj)
throws IllegalArgumentException
A registered object cannot be retrieved, but calling identify against a registered object returns the original identifier object.
IllegalArgumentException - if given object is nullpublic void write(DataOutput out) throws IOException
IOExceptionpublic void write(OutputStream out) throws IOException
IOExceptionpublic int compareTo(org.cojen.dirmi.core.AbstractIdentifier id)
compareTo in interface Comparable<org.cojen.dirmi.core.AbstractIdentifier>Copyright © 2006–2015 Cojen. All rights reserved.