Class VFSFileChangedReloadingStrategy

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected FileConfiguration configuration
      Stores a reference to the configuration to be monitored.
      protected long lastChecked
      The last time the file was checked for changes.
      protected long lastModified
      The last time the configuration file was modified.
      protected long refreshDelay
      The minimum delay in milliseconds between checks.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected org.apache.commons.vfs2.FileObject getFile()
      Returns the file that is monitored by this strategy.
      long getRefreshDelay()
      Return the minimal time in milliseconds between two reloadings.
      protected boolean hasChanged()
      Check if the configuration has changed since the last time it was loaded.
      void init()
      Initialize the strategy.
      void reloadingPerformed()
      Notify the strategy that the file has been reloaded.
      boolean reloadingRequired()
      Tell if the evaluation of the strategy requires to reload the configuration.
      void setConfiguration​(FileConfiguration configuration)
      Set the configuration managed by this strategy.
      void setRefreshDelay​(long refreshDelay)
      Set the minimal time between two reloadings.
      protected void updateLastModified()
      Update the last modified time.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • lastModified

        protected long lastModified
        The last time the configuration file was modified.
      • lastChecked

        protected long lastChecked
        The last time the file was checked for changes.
      • refreshDelay

        protected long refreshDelay
        The minimum delay in milliseconds between checks.
    • Method Detail

      • getRefreshDelay

        public long getRefreshDelay()
        Return the minimal time in milliseconds between two reloadings.
        Returns:
        the refresh delay (in milliseconds)
      • setRefreshDelay

        public void setRefreshDelay​(long refreshDelay)
        Set the minimal time between two reloadings.
        Parameters:
        refreshDelay - refresh delay in milliseconds
      • hasChanged

        protected boolean hasChanged()
        Check if the configuration has changed since the last time it was loaded.
        Returns:
        a flag whether the configuration has changed
      • getFile

        protected org.apache.commons.vfs2.FileObject getFile()
        Returns the file that is monitored by this strategy. Note that the return value can be null under some circumstances.
        Returns:
        the monitored file