类 AbstractRefreshableTargetSource
- java.lang.Object
- org.springframework.aop.target.dynamic.AbstractRefreshableTargetSource
- 所有已实现的接口:
Refreshable
,TargetClassAware
,TargetSource
public abstract class AbstractRefreshableTargetSource extends Object implements TargetSource, Refreshable
AbstractTargetSource
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.- 从以下版本开始:
- 2.0
- 作者:
- Rod Johnson, Rob Harrop, Juergen Hoeller
- 另请参阅:
requiresRefresh()
,freshTarget()
字段概要
字段 修饰符和类型 字段 说明 protected Log
logger
Logger available to subclassesprotected Object
targetObject
构造器概要
构造器 构造器 说明 AbstractRefreshableTargetSource()
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 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 type of targets returned by thisTargetSource
.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.
字段详细资料
targetObject
protected Object targetObject
构造器详细资料
AbstractRefreshableTargetSource
public AbstractRefreshableTargetSource()
方法详细资料
setRefreshCheckDelay
public void setRefreshCheckDelay(long refreshCheckDelay)
Set the delay between refresh checks, in milliseconds. Default is -1, indicating no refresh checks at all.Note that an actual refresh will only happen when
requiresRefresh()
returnstrue
.
getTargetClass
public Class<?> getTargetClass()
从接口复制的说明:TargetSource
Return the type of targets returned by thisTargetSource
.Can return
null
, although certain usages of aTargetSource
might just work with a predetermined target class.- 指定者:
getTargetClass
在接口中TargetClassAware
- 指定者:
getTargetClass
在接口中TargetSource
- 返回:
- the type of targets returned by this
TargetSource
isStatic
public boolean isStatic()
Not static.- 指定者:
isStatic
在接口中TargetSource
- 返回:
true
if the target is immutable- 另请参阅:
TargetSource.getTarget()
getTarget
public final Object getTarget()
从接口复制的说明:TargetSource
Return a target instance. Invoked immediately before the AOP framework calls the "target" of an AOP method invocation.- 指定者:
getTarget
在接口中TargetSource
- 返回:
- the target object which contains the joinpoint, or
null
if there is no actual target instance
releaseTarget
public void releaseTarget(Object object)
No need to release target.- 指定者:
releaseTarget
在接口中TargetSource
- 参数:
object
- object obtained from a call toTargetSource.getTarget()
refresh
public final void refresh()
从接口复制的说明:Refreshable
Refresh the underlying target object.- 指定者:
refresh
在接口中Refreshable
getRefreshCount
public long getRefreshCount()
从接口复制的说明:Refreshable
Return the number of actual refreshes since startup.- 指定者:
getRefreshCount
在接口中Refreshable
getLastRefreshTime
public long getLastRefreshTime()
从接口复制的说明:Refreshable
Return the last time an actual refresh happened (as timestamp).- 指定者:
getLastRefreshTime
在接口中Refreshable
requiresRefresh
protected boolean requiresRefresh()
Determine whether a refresh is required. Invoked for each refresh check, after the refresh check delay has elapsed.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.- 返回:
- whether a refresh is required
freshTarget
protected abstract Object freshTarget()
Obtain a fresh target object.Only invoked if a refresh check has found that a refresh is required (that is,
requiresRefresh()
has returnedtrue
).- 返回:
- the fresh target object