public class NicKey
extends java.lang.Object
implements java.lang.Comparable
NicKey
represents the key object passed to all the
lookup methods defined in the NIC or the SaeLocator interface.Modifier and Type | Field and Description |
---|---|
static long |
FOREVER
max time to live, means key does not expire
|
static long |
IGNORE_TIME
default max time to live, will be ignored in comparison
|
Constructor and Description |
---|
NicKey(java.lang.String aKey)
Constructs a NicKey object given the string representation of the key value.
|
Modifier and Type | Method and Description |
---|---|
void |
addConstraint(java.lang.String name,
java.lang.String value)
Associates the passed-in constraint information
to the current key object.
|
int |
compareTo(java.lang.Object anotherKey)
Compares to NicKeys by their time to live attribute.
|
boolean |
equals(java.lang.Object o)
NicKeys are equal if they have equal keys
and equal constraints
|
java.util.SortedMap |
getConstraints()
Returns all the constraints associated
with the current key object.
|
static long |
getCurrentTimeGMT()
Returns the current time in milliseconds (UTC) in the GMT timezone.
|
java.lang.String |
getKey()
Returns the string representation of the key value.
|
long |
getTimeToLive()
Returns time to live
|
int |
hashCode()
Returns hash code for this NicKey
|
boolean |
isOutdated()
Returns true if value is outdated
|
long |
setTimeToLive(long keyTimeToLive,
long proxyTimeToLive)
Sets time to live to a min value out of key time and the proxy time to live.
|
java.lang.String |
toString()
Returns the string representation for the key and constraints
|
public static final long IGNORE_TIME
public static final long FOREVER
public NicKey(java.lang.String aKey)
aKey
- java.lang.Stringpublic void addConstraint(java.lang.String name, java.lang.String value)
name
- java.lang.String the constraint name
(should correspond to a NIC data type)value
- String the constraint string valuepublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- the object to which to test equalitypublic java.util.SortedMap getConstraints()
public java.lang.String getKey()
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public long getTimeToLive()
public long setTimeToLive(long keyTimeToLive, long proxyTimeToLive)
keyTimeToLive
- longproxyTimeToLive
- longpublic static long getCurrentTimeGMT()
#System.currentTimeMillis
public boolean isOutdated()
proxyTime
- long time to live set on the NicProxypublic int compareTo(java.lang.Object anotherKey)
compareTo
in interface java.lang.Comparable