|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.springframework.aop.target.AbstractBeanFactoryBasedTargetSource
org.springframework.aop.target.AbstractPrototypeBasedTargetSource
org.springframework.aop.target.ThreadLocalTargetSource
Alternative to an object pool. This 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 is performed in the destroy() method from DisposableBean.
destroy(),
Serialized Form| Field Summary |
| Fields inherited from class org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource |
logger |
| Constructor Summary | |
ThreadLocalTargetSource()
|
|
| Method Summary | |
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 |
getHits()
Deprecated. in favor of getHitCount |
int |
getInvocationCount()
Return the number of client invocations. |
int |
getInvocations()
Deprecated. in favor of getInvocationCount |
int |
getObjectCount()
Return the number of thread-bound objects created. |
int |
getObjects()
Deprecated. in favor of getObjectCount |
IntroductionAdvisor |
getStatsMixin()
Return an introduction advisor mixin that allows the AOP proxy to be cast to ThreadLocalInvokerStats. |
Object |
getTarget()
Implementation of abstract getTarget() method. |
| Methods inherited from class org.springframework.aop.target.AbstractPrototypeBasedTargetSource |
newPrototypeInstance, setBeanFactory |
| Methods inherited from class org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource |
getBeanFactory, getTargetBeanName, getTargetClass, isStatic, releaseTarget, setTargetBeanName, writeReplace |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public ThreadLocalTargetSource()
| Method Detail |
public Object getTarget()
throws BeansException
getTarget in interface TargetSourceBeansExceptionpublic void destroy()
destroy in interface DisposableBeanpublic int getInvocationCount()
ThreadLocalTargetSourceStats
getInvocationCount in interface ThreadLocalTargetSourceStatspublic int getHitCount()
ThreadLocalTargetSourceStats
getHitCount in interface ThreadLocalTargetSourceStatspublic int getObjectCount()
ThreadLocalTargetSourceStats
getObjectCount in interface ThreadLocalTargetSourceStatspublic int getInvocations()
getInvocations in interface ThreadLocalTargetSourceStatsgetInvocationCount()public int getHits()
getHits in interface ThreadLocalTargetSourceStatsgetHitCount()public int getObjects()
getObjects in interface ThreadLocalTargetSourceStatsgetObjectCount()public IntroductionAdvisor getStatsMixin()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||