org.springframework.aop.target
Class HotSwappableTargetSource

java.lang.Object
  extended byorg.springframework.aop.target.HotSwappableTargetSource
All Implemented Interfaces:
TargetSource

public class HotSwappableTargetSource
extends java.lang.Object
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.

Version:
$Id: HotSwappableTargetSource.java,v 1.5 2004/03/18 02:46:13 trisberg Exp $
Author:
Rod Johnson

Constructor Summary
HotSwappableTargetSource(java.lang.Object initialTarget)
          Create a new HotSwappableTargetSource with the initial target
 
Method Summary
 boolean equals(java.lang.Object other)
          Two invoker interceptors are equal if they have the same target or if the targets are equal.
 java.lang.Object getTarget()
          Synchronization around something that takes so little time is fine
 java.lang.Class getTargetClass()
           
 boolean isStatic()
           
 void releaseTarget(java.lang.Object o)
           
 java.lang.Object swap(java.lang.Object newTarget)
          Swap the target, returning the old target
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HotSwappableTargetSource

public HotSwappableTargetSource(java.lang.Object initialTarget)
Create a new HotSwappableTargetSource with the initial target

Parameters:
initialTarget - initial target
Method Detail

getTargetClass

public java.lang.Class getTargetClass()
Specified by:
getTargetClass in interface TargetSource

isStatic

public final boolean isStatic()
Specified by:
isStatic in interface TargetSource
See Also:
TargetSource.isStatic()

getTarget

public final java.lang.Object getTarget()
Synchronization around something that takes so little time is fine

Specified by:
getTarget in interface TargetSource
See Also:
TargetSource.getTarget()

releaseTarget

public void releaseTarget(java.lang.Object o)
Specified by:
releaseTarget in interface TargetSource
See Also:
TargetSource.releaseTarget(java.lang.Object)

swap

public java.lang.Object swap(java.lang.Object newTarget)
                      throws AopConfigException
Swap the target, returning the old target

Parameters:
newTarget - new target
Returns:
the old target
Throws:
AopConfigException - if the new target is invalid

equals

public boolean equals(java.lang.Object other)
Two invoker interceptors are equal if they have the same target or if the targets are equal.



Copyright (C) 2003-2004 The Spring Framework Project.