PooledObject

Defines the wrapper that is used to track the additional information, such as state, for the pooled objects. <p> Implementations of this class are required to be thread-safe.

@param <T> the type of object in the pool

Members

Functions

endEvictionTest
bool endEvictionTest(Deque!(IPooledObject) idleQueue)

Called to inform the object that the eviction test has ended.

getObject
T getObject()

Obtains the underlying object that is wrapped by this instance of {@link PooledObject}.

opCmp
int opCmp(IPooledObject other)

Orders instances based on idle time - i.e. the length of time since the instance was returned to the pool. Used by the GKOP idle object evictor. <p> Note: This class has a natural ordering that is inconsistent with equals if distinct objects have the same identity hash code. </p> <p> {@inheritDoc} </p>

Inherited Members

From IPooledObject

objectType
TypeInfo objectType()
Undocumented in source.
objectToString
string objectToString()
Undocumented in source.
getCreateTime
long getCreateTime()

Obtains the time (using the same basis as {@link DateTimeHelper.currentTimeMillis()}) that this object was created.

getActiveTimeMillis
long getActiveTimeMillis()

Obtains the time in milliseconds that this object last spent in the active state (it may still be active in which case subsequent calls will return an increased value).

getIdleTimeMillis
long getIdleTimeMillis()

Obtains the time in milliseconds that this object last spend in the idle state (it may still be idle in which case subsequent calls will return an increased value).

getLastBorrowTime
long getLastBorrowTime()

Obtains the time the wrapped object was last borrowed.

getLastReturnTime
long getLastReturnTime()

Obtains the time the wrapped object was last returned.

getLastUsedTime
long getLastUsedTime()

Returns an estimate of the last time this object was used. If the class of the pooled object implements {@link TrackedUse}, what is returned is the maximum of {@link TrackedUse#getLastUsed()} and {@link #getLastBorrowTime()}; otherwise this method gives the same value as {@link #getLastBorrowTime()}.

opEquals
bool opEquals(IPooledObject obj)
Undocumented in source.
toHash
size_t toHash()
Undocumented in source.
toString
string toString()

Provides a string form of the wrapper for debug purposes. The format is not fixed and may change at any time. <p> {@inheritDoc}

startEvictionTest
bool startEvictionTest()

Attempts to place the pooled object in the {@link PooledObjectState#EVICTION} state.

allocate
bool allocate()

Allocates the object.

deallocate
bool deallocate()

Deallocates the object and sets it {@link PooledObjectState#IDLE IDLE} if it is currently {@link PooledObjectState#ALLOCATED ALLOCATED}.

invalidate
void invalidate()

Sets the state to {@link PooledObjectState#INVALID INVALID}

setLogAbandoned
void setLogAbandoned(bool logAbandoned)

Is abandoned object tracking being used? If this is true the implementation will need to record the stack trace of the last caller to borrow this object.

use
void use()

Record the current stack trace as the last time the object was used.

getState
PooledObjectState getState()

Returns the state of this object. @return state

markAbandoned
void markAbandoned()

Marks the pooled object as abandoned.

markReturning
void markReturning()

Marks the object as returning to the pool.

Meta