// InvalidateObject invalidates an object from the pool.
// By contract, object must have been obtained
// using BorrowObject.
// This method should be used when an object that has been borrowed is
// determined (due to an exception or other problem) to be invalid.
InvalidateObject invalidates an object from the pool.
By contract, object must have been obtained
using BorrowObject.
This method should be used when an object that has been borrowed is
determined (due to an exception or other problem) to be invalid.
// InvalidateObject invalidates an object from the pool . // By contract object must have been obtained // using BorrowObject . // This method should be used when an object that has been borrowed is // determined ( due to an exception or other problem ) to be invalid .
func (pool *ObjectPool) InvalidateObject(object interface{}) error {
	p, ok := pool.allObjects.Get(object).(*PooledObject)
	if !ok {
		if pool.isAbandonedConfig() {
			return nil
		}
		return NewIllegalStateErr(
			"Invalidated object not currently part of pool")
	}
	p.lock.Lock()
	if p.state != StateInvalid {
		pool.doDestroy(p, true)
	}
	p.lock.Unlock()
	pool.ensureIdle(1, false)
	return nil
}
func ( pool * ObjectPool ) InvalidateObject ( object interface { } ) error { p , ok := pool . allObjects . Get ( object ) . ( * PooledObject ) if ! ok { if pool . isAbandonedConfig ( ) { return nil } return NewIllegalStateErr ( " " ) } p . lock . Lock ( ) if p . state != StateInvalid { pool . doDestroy ( p , true ) } p . lock . Unlock ( ) pool . ensureIdle ( 1 , false ) return nil }
InvalidateObject invalidates an object from the pool.
InvalidateObject invalidates an object from the pool .