Ejemplo n.º 1
0
func (this *PooledObject) EndEvictionTest(idleQueue *collections.LinkedBlockingDeque) bool {
	this.lock.Lock()
	defer this.lock.Unlock()
	if this.state == EVICTION {
		this.state = IDLE
		return true
	} else if this.state == EVICTION_RETURN_TO_HEAD {
		this.state = IDLE
		if !idleQueue.OfferFirst(this) {
			// TODO - Should never happen
			panic(fmt.Errorf("Should never happen"))
		}
	}

	return false
}
Ejemplo n.º 2
0
// EndEvictionTest  called to inform the object that the eviction test has ended.
func (o *PooledObject) EndEvictionTest(idleQueue *collections.LinkedBlockingDeque) bool {
	o.lock.Lock()
	defer o.lock.Unlock()
	if o.state == StateEviction {
		o.state = StateIdle
		return true
	} else if o.state == StateEvictionReturnToHead {
		o.state = StateIdle
		if !idleQueue.OfferFirst(o) {
			// TODO - Should never happen
			panic(fmt.Errorf("Should never happen"))
		}
	}

	return false
}