|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.aop.target.dynamic.AbstractRefreshableTargetSource
public abstract class AbstractRefreshableTargetSource
Abstract TargetSource
implementation that
wraps a refreshable target object. Subclasses can determine whether a
refresh is required, and need to provide fresh target objects.
Implements the Refreshable
interface in order to allow for
explicit control over the refresh status.
requiresRefresh()
,
freshTarget()
Field Summary | |
---|---|
protected Log |
logger
Logger available to subclasses |
protected Object |
targetObject
|
Constructor Summary | |
---|---|
AbstractRefreshableTargetSource()
|
Method Summary | |
---|---|
protected abstract Object |
freshTarget()
Obtain a fresh target object. |
long |
getLastRefreshTime()
Return the last time an actual refresh happened (as timestamp). |
long |
getRefreshCount()
Return the number of actual refreshes since startup. |
Object |
getTarget()
Return a target instance. |
Class |
getTargetClass()
Return the target class behind the implementing object (typically a proxy configuration or an actual proxy). |
boolean |
isStatic()
Not static. |
void |
refresh()
Refresh the underlying target object. |
void |
releaseTarget(Object object)
No need to release target. |
protected boolean |
requiresRefresh()
Determine whether a refresh is required. |
void |
setRefreshCheckDelay(long refreshCheckDelay)
Set the delay between refresh checks, in milliseconds. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Log logger
protected Object targetObject
Constructor Detail |
---|
public AbstractRefreshableTargetSource()
Method Detail |
---|
public void setRefreshCheckDelay(long refreshCheckDelay)
Note that an actual refresh will only happen when
requiresRefresh()
returns true
.
public Class getTargetClass()
TargetClassAware
getTargetClass
in interface TargetClassAware
getTargetClass
in interface TargetSource
null
if not knownpublic boolean isStatic()
isStatic
in interface TargetSource
true
if the target is immutableTargetSource.getTarget()
public final Object getTarget()
TargetSource
getTarget
in interface TargetSource
public void releaseTarget(Object object)
releaseTarget
in interface TargetSource
object
- object obtained from a call to TargetSource.getTarget()
public final void refresh()
Refreshable
refresh
in interface Refreshable
public long getRefreshCount()
Refreshable
getRefreshCount
in interface Refreshable
public long getLastRefreshTime()
Refreshable
getLastRefreshTime
in interface Refreshable
protected boolean requiresRefresh()
The default implementation always returns true
, triggering
a refresh every time the delay has elapsed. To be overridden by subclasses
with an appropriate check of the underlying target resource.
protected abstract Object freshTarget()
Only invoked if a refresh check has found that a refresh is required
(that is, requiresRefresh()
has returned true
).
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |