Class AbstractRefreshableTargetSource

    • Method Detail

      • 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.

      • getTarget

        public final Object getTarget()
        Description copied from interface: TargetSource
        Return a target instance. Invoked immediately before the AOP framework calls the "target" of an AOP method invocation.
        Specified by:
        getTarget in interface TargetSource
        Returns:
        the target object which contains the joinpoint, or null if there is no actual target instance
      • 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.

        Returns:
        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).

        Returns:
        the fresh target object