程序包 infra.aop.target

类 AbstractRefreshableTargetSource

java.lang.Object
infra.aop.target.AbstractRefreshableTargetSource
所有已实现的接口:
Refreshable, TargetClassAware, TargetSource
直接已知子类:
BeanFactoryRefreshableTargetSource

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
另请参阅:
  • 字段详细资料

    • logger

      protected final infra.logging.Logger logger
    • targetObject

      protected Object 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() returns true.

    • getTargetClass

      public Class<?> getTargetClass()
      从接口复制的说明: TargetSource
      Return the type of targets returned by this TargetSource.

      Can return null, although certain usages of a TargetSource 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
      另请参阅:
    • 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 join-point, or null if there is no actual target instance
    • 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
    • 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

      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 returned true).

      返回:
      the fresh target object