spring-framework / org.springframework.aop.target / ThreadLocalTargetSourceStats

ThreadLocalTargetSourceStats

interface ThreadLocalTargetSourceStats

Statistics for a ThreadLocal TargetSource.

Author
Rod Johnson

Author
Juergen Hoeller

Functions

getHitCount

abstract fun getHitCount(): Int

Return the number of hits that were satisfied by a thread-bound object.

getInvocationCount

abstract fun getInvocationCount(): Int

Return the number of client invocations.

getObjectCount

abstract fun getObjectCount(): Int

Return the number of thread-bound objects created.

Inheritors

ThreadLocalTargetSource

open class ThreadLocalTargetSource : AbstractPrototypeBasedTargetSource, ThreadLocalTargetSourceStats, DisposableBean

Alternative to an object pool. This org.springframework.aop.TargetSource uses a threading model in which every thread has its own copy of the target. There's no contention for targets. Target object creation is kept to a minimum on the running server.

Application code is written as to a normal pool; callers can't assume they will be dealing with the same instance in invocations in different threads. However, state can be relied on during the operations of a single thread: for example, if one caller makes repeated calls on the AOP proxy.

Cleanup of thread-bound objects is performed on BeanFactory destruction, calling their DisposableBean.destroy() method if available. Be aware that many thread-bound objects can be around until the application actually shuts down.