Пример #1
0
        /// <summary>
        /// RentedElementMonitor constructor
        /// </summary>
        /// <param name="element">Wrapper for pool element</param>
        /// <param name="sourcePool">Source object pool</param>
        /// <param name="memberName">Method name in which the element is rented (for debug purposes)</param>
        /// <param name="filePath">Source code file path in which the element is rented (for debug purposes)</param>
        /// <param name="lineNumber">Source code line number in which the element is rented (for debug purposes)</param>
        internal RentedElementMonitor(PoolElementWrapper <TElem> element, ObjectPoolManager <TElem> sourcePool, string memberName, string filePath, int lineNumber)
            : this(element, sourcePool)
        {
            _memberName = memberName;
            _filePath   = filePath;
            _lineNumber = lineNumber;
            _rentTime   = DateTime.Now;

            if (element != null)
            {
                element.UpdateStatOnRent(memberName, filePath, lineNumber, _rentTime);
            }
        }
Пример #2
0
        /// <summary>
        /// RentedElementMonitor consturctor
        /// </summary>
        /// <param name="element">Wrapper for pool element</param>
        /// <param name="sourcePool">Source object pool</param>
        internal RentedElementMonitor(PoolElementWrapper <TElem> element, ObjectPoolManager <TElem> sourcePool)
        {
            TurboContract.Requires(element == null || (element != null && sourcePool != null), conditionString: "element == null || (element != null && sourcePool != null)");

            if (element == null)
            {
                _elementWrapper = null;
                _sourcePool     = null;
            }
            else
            {
                _elementWrapper = element;
                _sourcePool     = sourcePool;
                this.StartActiveTime();
            }
        }