public void MarkReturning() { lock (syncLock) { state = PooledObjectState.Returning; } }
public void Invalidate() { lock (this.syncRoot) { state = PooledObjectState.INVALID; } }
public void MarkAbandoned() { lock (syncLock) { state = PooledObjectState.Abandoned; } }
public void Invalidate() { lock (syncLock) { state = PooledObjectState.Invalid; } }
public bool StartEvictionTest() { if (state == PooledObjectState.Idle) { state = PooledObjectState.Eviction; return(true); } return(false); }
public bool StartEvictionTest() { lock (this.syncRoot) { if (state == PooledObjectState.IDLE) { state = PooledObjectState.MAINTAIN_EVICTION; return(true); } } return(false); }
public bool Deallocate() { if (state == PooledObjectState.Allocated || state == PooledObjectState.Returning) { state = PooledObjectState.Idle; lastReturnTime = DateTime.Now.CurrentTimeMillis(); borrowedBy = null; return(true); } return(false); }
public bool Deallocate() { lock (this.syncRoot) { if (state == PooledObjectState.ALLOCATED) { state = PooledObjectState.IDLE; lastReturnedTime = DateTime.Now; return(true); } } return(false); }
public void Release() { if (_poolState == PooledObjectState.Acquired) { _poolState = PooledObjectState.Releasing; RaiseOnReleased(); ReleaseInternal(); ReturnToPool(); } else { throw new ObjectPoolException("Can only release Acquired objects"); } }
public bool EndEvictionTest(Deque <IPooledObject <T> > idleQueue) { if (state == PooledObjectState.Eviction) { state = PooledObjectState.Idle; return(true); } else if (state == PooledObjectState.EvictionReturnToHead) { state = PooledObjectState.Idle; //if (!idleQueue.offerFirst(this)) { // // TODO - Should never happen } return(false); }
public bool EndEvictionTest(LinkedBlockingDeque <PooledObject <T> > idleQueue) { lock (this.syncRoot) { if (state == PooledObjectState.MAINTAIN_EVICTION) { state = PooledObjectState.IDLE; return(true); } else if (state == PooledObjectState.MAINTAIN_EVICTION_RETURN_TO_HEAD) { state = PooledObjectState.IDLE; idleQueue.OfferFirst(this); } } return(false); }
public bool Allocate() { lock (this.syncRoot) { if (state == PooledObjectState.IDLE) { state = PooledObjectState.ALLOCATED; lastBorrowedTime = DateTime.Now; return(true); } else if (state == PooledObjectState.MAINTAIN_EVICTION) { state = PooledObjectState.MAINTAIN_EVICTION_RETURN_TO_HEAD; return(false); } } return(false); }
public bool Allocate() { if (state == PooledObjectState.Idle) { state = PooledObjectState.Allocated; lastBorrowTime = DateTime.Now.CurrentTimeMillis(); lastUseTime = lastBorrowTime; borrowedCount++; if (logAbandoned) { borrowedBy = new AbandonedObjectCreatedException(); } return(true); } else if (state == PooledObjectState.Eviction) { // TODO Allocate anyway and ignore eviction test state = PooledObjectState.EvictionReturnToHead; return(false); } // TODO if validating and testOnBorrow == true then pre-allocate for // performance return(false); }