public class ThreadLocalTargetSource extends AbstractPrototypeBasedTargetSource implements ThreadLocalTargetSourceStats, DisposableBean
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.
ThreadLocalTargetSourceStats
,
DisposableBean.destroy()
,
Serialized Formlogger
Constructor and Description |
---|
ThreadLocalTargetSource() |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Dispose of targets if necessary; clear ThreadLocal.
|
int |
getHitCount()
Return the number of hits that were satisfied by a thread-bound object.
|
int |
getInvocationCount()
Return the number of client invocations.
|
int |
getObjectCount()
Return the number of thread-bound objects created.
|
IntroductionAdvisor |
getStatsMixin()
Return an introduction advisor mixin that allows the AOP proxy to be
cast to ThreadLocalInvokerStats.
|
Object |
getTarget()
Implementation of abstract getTarget() method.
|
destroyPrototypeInstance, newPrototypeInstance, setBeanFactory, writeReplace
copyFrom, equals, getBeanFactory, getTargetBeanName, getTargetClass, hashCode, isStatic, releaseTarget, setTargetBeanName, setTargetClass, toString
public Object getTarget() throws BeansException
getTarget
in interface TargetSource
BeansException
public void destroy()
destroy
in interface DisposableBean
AbstractPrototypeBasedTargetSource.destroyPrototypeInstance(java.lang.Object)
public int getInvocationCount()
ThreadLocalTargetSourceStats
getInvocationCount
in interface ThreadLocalTargetSourceStats
public int getHitCount()
ThreadLocalTargetSourceStats
getHitCount
in interface ThreadLocalTargetSourceStats
public int getObjectCount()
ThreadLocalTargetSourceStats
getObjectCount
in interface ThreadLocalTargetSourceStats
public IntroductionAdvisor getStatsMixin()