Пример #1
0
        public int CompareTo(IPooledObject <T> other)
        {
            long lastActiveDiff = this.GetLastReturnTime() - other.GetLastReturnTime();

            if (lastActiveDiff == 0)
            {
                // Make sure the natural ordering is broadly consistent with equals
                // although this will break down if distinct objects have the same
                // identity hash code.
                // see java.lang.Comparable Javadocs
                return(this.GetHashCode() - other.GetHashCode());
            }
            // handle int overflow
            return((int)Math.Min(Math.Max(lastActiveDiff, 0x80000000), 0x7fffffff)); // 0x80000000 is the min int
        }