org.springframework.aop.target
Class HotSwappableTargetSource
- public class HotSwappableTargetSource
- implements TargetSource
Implementation of TargetSource interface that caches a local
target object, but allows the target to be swapped while the application is running.
If configuring an object of this class in a Spring IoC container,
use Type 3 (constructor-style) IoC.
- Author:
- Rod Johnson
- Version: $Id: HotSwappableTargetSource.java,v 1.4 2003/12/30 01:07:12 jhoeller Exp $
Constructor Summary |
HotSwappableTargetSource(Object initialTarget) Create a new HotSwappableTargetSource with the initial target |
Method Summary |
boolean | equals(Object other) Two invoker interceptors are equal if they have the same target or
if the targets are equal. |
final synchronized Object | getTarget() Synchronization around something that takes so little time is fine |
Class | getTargetClass() |
final boolean | isStatic() |
void | releaseTarget(Object o) |
synchronized Object | swap(Object newTarget) Swap the target, returning the old target |
HotSwappableTargetSource
public HotSwappableTargetSource(Object initialTarget)
- Create a new HotSwappableTargetSource with the initial target
- Parameters:
- initialTarget - initial target
equals
public boolean equals(Object other)
- Two invoker interceptors are equal if they have the same target or
if the targets are equal.
getTarget
public final synchronized Object getTarget()
- Synchronization around something that takes so little time is fine
- See Also:
- org.springframework.aop.TargetSource.getTarget()
getTargetClass
public Class getTargetClass()
isStatic
public final boolean isStatic()
- See Also:
- org.springframework.aop.TargetSource.isStatic()
releaseTarget
public void releaseTarget(Object o)
- See Also:
- org.springframework.aop.TargetSource.releaseTarget(java.lang.Object)
swap
public synchronized Object swap(Object newTarget)
throws org.springframework.aop.framework.AopConfigException
- Swap the target, returning the old target
- Parameters:
- newTarget - new target
- Returns: the old target
- Throws:
- AopConfigException - if the new target is invalid