Class 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 by GenericObjectPool.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) long tstamp
      Deprecated.
      this field will be made private and final in version 2.0
      (package private) T value
      Deprecated.
      this field will be made private and final in version 2.0
    • 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
      int compareTo​(java.lang.Object obj)
      Compares this to another object by casting the argument to an ObjectTimestampPair.
      int compareTo​(GenericKeyedObjectPool.ObjectTimestampPair<T> other)
      Compares this to another ObjectTimestampPair, using the timestamp as basis for comparison.
      long getTstamp()  
      T getValue()  
      java.lang.String toString()
      Returns a string representation.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • value

        @Deprecated
        T value
        Deprecated.
        this field will be made private and final in version 2.0
        Object instance
      • tstamp

        @Deprecated
        long tstamp
        Deprecated.
        this field will be made private and final in version 2.0
        timestamp
    • 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 instance
        time - long representation of timestamp
    • Method Detail

      • toString

        public java.lang.String toString()
        Returns a string representation.
        Overrides:
        toString in class java.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:
        compareTo in interface java.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