Package org.apache.commons.pool.impl
Class GenericKeyedObjectPool.ObjectTimestampPair<T>
- java.lang.Object
-
- org.apache.commons.pool.impl.GenericKeyedObjectPool.ObjectTimestampPair<T>
-
- All Implemented Interfaces:
java.lang.Comparable<T>
- Enclosing class:
- GenericKeyedObjectPool<K,V>
static class GenericKeyedObjectPool.ObjectTimestampPair<T> extends java.lang.Object implements java.lang.Comparable<T>A simple "struct" encapsulating an object instance and a timestamp. Implements Comparable, objects are sorted from old to new. This is also used byGenericObjectPool.
-
-
Constructor Summary
Constructors Constructor Description ObjectTimestampPair(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(java.lang.Object obj)Compares this to another object by casting the argument to an ObjectTimestampPair.intcompareTo(GenericKeyedObjectPool.ObjectTimestampPair<T> other)Compares this to another ObjectTimestampPair, using the timestamp as basis for comparison.longgetTstamp()TgetValue()java.lang.StringtoString()Returns a string representation.
-
-
-
Field Detail
-
value
@Deprecated T value
Deprecated.this field will be made private and final in version 2.0Object instance
-
tstamp
@Deprecated long tstamp
Deprecated.this field will be made private and final in version 2.0timestamp
-
-
Constructor Detail
-
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 Detail
-
toString
public java.lang.String toString()
Returns a string representation.- Overrides:
toStringin classjava.lang.Object- Returns:
- String representing this ObjectTimestampPair
-
compareTo
public int compareTo(java.lang.Object obj)
Compares this to another object by casting the argument to an ObjectTimestampPair.- Specified by:
compareToin interfacejava.lang.Comparable<T>- Parameters:
obj- object to cmpare- Returns:
- result of comparison
-
compareTo
public int compareTo(GenericKeyedObjectPool.ObjectTimestampPair<T> other)
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
public T getValue()
- Returns:
- the value
-
getTstamp
public long getTstamp()
- Returns:
- the tstamp
-
-