Package org.apache.commons.pool.impl
Class GenericKeyedObjectPool.ObjectTimestampPair<T>
java.lang.Object
org.apache.commons.pool.impl.GenericKeyedObjectPool.ObjectTimestampPair<T>
- All Implemented Interfaces:
Comparable<T>
- Enclosing class:
GenericKeyedObjectPool<K,V>
A simple "struct" encapsulating an object instance and a timestamp.
Implements Comparable, objects are sorted from old to new.
This is also used by
GenericObjectPool.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionObjectTimestampPair(T val) Create a new ObjectTimestampPair using the given object and the current system time.ObjectTimestampPair(T val, long time) Create a new ObjectTimeStampPair using the given object and timestamp value. -
Method Summary
-
Field Details
-
value
Deprecated.this field will be made private and final in version 2.0Object instance -
tstamp
Deprecated.this field will be made private and final in version 2.0timestamp
-
-
Constructor Details
-
ObjectTimestampPair
ObjectTimestampPair(T val) Create a new ObjectTimestampPair using the given object and the current system time.- Parameters:
val- object instance
-
ObjectTimestampPair
ObjectTimestampPair(T val, long time) Create a new ObjectTimeStampPair using the given object and timestamp value.- Parameters:
val- object instancetime- long representation of timestamp
-
-
Method Details
-
toString
Returns a string representation. -
compareTo
Compares this to another object by casting the argument to an ObjectTimestampPair.- Specified by:
compareToin interfaceComparable<T>- Parameters:
obj- object to cmpare- Returns:
- result of comparison
-
compareTo
Compares this to another ObjectTimestampPair, using the timestamp as basis for comparison. Implementation is consistent with equals.- Parameters:
other- object to compare- Returns:
- result of comparison
-
getValue
- Returns:
- the value
-
getTstamp
public long getTstamp()- Returns:
- the tstamp
-