程序包 infra.aop.target
类 AbstractRefreshableTargetSource
java.lang.Object
infra.aop.target.AbstractRefreshableTargetSource
- 所有已实现的接口:
Refreshable,TargetClassAware,TargetSource
public abstract class AbstractRefreshableTargetSource
extends Object
implements TargetSource, Refreshable
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.
- 从以下版本开始:
- 3.0
- 作者:
- Rod Johnson, Rob Harrop, Juergen Hoeller, TODAY 2021/2/1 21:20
- 另请参阅:
-
字段概要
字段修饰符和类型字段说明private longprivate longprotected final infra.logging.Loggerprivate longprivate longprotected Object -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明protected abstract ObjectObtain a fresh target object.longReturn the last time an actual refresh happened (as timestamp).longReturn the number of actual refreshes since startup.final ObjectReturn a target instance.Class<?>Return the type of targets returned by thisTargetSource.booleanisStatic()Not static.final voidrefresh()Refresh the underlying target object.private booleanprotected booleanDetermine whether a refresh is required.voidsetRefreshCheckDelay(long refreshCheckDelay) Set the delay between refresh checks, in milliseconds.从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 infra.aop.TargetSource
releaseTarget
-
字段详细资料
-
logger
protected final infra.logging.Logger logger -
targetObject
-
refreshCheckDelay
private long refreshCheckDelay -
lastRefreshCheck
private long lastRefreshCheck -
lastRefreshTime
private long lastRefreshTime -
refreshCount
private long refreshCount
-
-
构造器详细资料
-
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
从接口复制的说明:TargetSourceReturn the type of targets returned by thisTargetSource.Can return
null, although certain usages of aTargetSourcemight 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- 返回:
trueif the target is immutable- 另请参阅:
-
getTarget
从接口复制的说明:TargetSourceReturn 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 join-point,
or
nullif there is no actual target instance
-
refresh
public final void refresh()从接口复制的说明:RefreshableRefresh the underlying target object.- 指定者:
refresh在接口中Refreshable
-
getRefreshCount
public long getRefreshCount()从接口复制的说明:RefreshableReturn the number of actual refreshes since startup.- 指定者:
getRefreshCount在接口中Refreshable
-
getLastRefreshTime
public long getLastRefreshTime()从接口复制的说明:RefreshableReturn the last time an actual refresh happened (as timestamp).- 指定者:
getLastRefreshTime在接口中Refreshable
-
refreshCheckDelayElapsed
private boolean refreshCheckDelayElapsed() -
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
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
-