/**
 * Verify that an object that the evictor identifies as abandoned while it
 * is in process of being returned to the pool is not destroyed.
 */
Verify that an object that the evictor identifies as abandoned while it
is in process of being returned to the pool is not destroyed.
/ ** * Verify that an object that the evictor identifies as abandoned while it * is in process of being returned to the pool is not destroyed . * /
func (suit *PoolAbandonedTestSuite) TestRemoveAbandonedWhileReturning() {
	suit.pool.AbandonedConfig.RemoveAbandonedOnBorrow = false
	suit.pool.AbandonedConfig.RemoveAbandonedOnMaintenance = true
	suit.pool.AbandonedConfig.RemoveAbandonedTimeout = 1
	suit.factory.validateLatency = 1000
	n := 10
	suit.pool.Config.MaxTotal = n
	suit.pool.Config.BlockWhenExhausted = false
	suit.pool.Config.TimeBetweenEvictionRunsMillis = 500
	suit.pool.Config.TestOnReturn = true
	suit.pool.StartEvictor()
	obj := suit.NoErrorWithResult(suit.pool.BorrowObject())
	sleep(50)                   
	suit.pool.ReturnObject(obj) 
	obj2 := suit.NoErrorWithResult(suit.pool.BorrowObject())
	suit.Equal(obj, obj2)                             
	suit.True(!obj2.(*AbandonedTestObject).destroyed) 
}
func ( suit * PoolAbandonedTestSuite ) TestRemoveAbandonedWhileReturning ( ) { suit . pool . AbandonedConfig . RemoveAbandonedOnBorrow = false suit . pool . AbandonedConfig . RemoveAbandonedOnMaintenance = true suit . pool . AbandonedConfig . RemoveAbandonedTimeout = 1 suit . factory . validateLatency = 1000 n := 10 suit . pool . Config . MaxTotal = n suit . pool . Config . BlockWhenExhausted = false suit . pool . Config . TimeBetweenEvictionRunsMillis = 500 suit . pool . Config . TestOnReturn = true suit . pool . StartEvictor ( ) obj := suit . NoErrorWithResult ( suit . pool . BorrowObject ( ) ) sleep ( 50 ) suit . pool . ReturnObject ( obj ) obj2 := suit . NoErrorWithResult ( suit . pool . BorrowObject ( ) ) suit . Equal ( obj , obj2 ) suit . True ( ! obj2 . ( * AbandonedTestObject ) . destroyed ) }
Verify that an object that the evictor identifies as abandoned while it
is in process of being returned to the pool is not destroyed.
Verify that an object that the evictor identifies as abandoned while it is in process of being returned to the pool is not destroyed .
// Borrow an object, wait long enough for it to be abandoned // then arrange for evictor to run while it is being returned // validation takes a second, evictor runs every 500 ms // abandon obj // evictor will run during validation // should get original back // and not destroyed