commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r312717 - in /jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/reloading: FileChangedReloadingStrategy.java ReloadingStrategy.java
Date Mon, 10 Oct 2005 19:26:54 GMT
Author: oheger
Date: Mon Oct 10 12:26:46 2005
New Revision: 312717

URL: http://svn.apache.org/viewcvs?rev=312717&view=rev
Log:
Javadoc and Checkstyle

Modified:
    jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/reloading/FileChangedReloadingStrategy.java
    jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/reloading/ReloadingStrategy.java

Modified: jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/reloading/FileChangedReloadingStrategy.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/reloading/FileChangedReloadingStrategy.java?rev=312717&r1=312716&r2=312717&view=diff
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/reloading/FileChangedReloadingStrategy.java
(original)
+++ jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/reloading/FileChangedReloadingStrategy.java
Mon Oct 10 12:26:46 2005
@@ -30,7 +30,7 @@
  * but is triggered by its associated configuration whenever properties are
  * accessed. It then checks the configuration file's last modification date
  * and causes a reload if this has changed.</p>
- * <p>To avoid permanent disc access on successive property lookups a refresh 
+ * <p>To avoid permanent disc access on successive property lookups a refresh
  * delay can be specified. This has the effect that the configuration file's
  * last modification date is only checked once in this delay period. The default
  * value for this refresh delay is 5 seconds.</p>
@@ -44,7 +44,10 @@
 {
     /** Constant for the jar URL protocol.*/
     private static final String JAR_PROTOCOL = "jar";
-    
+
+    /** Constant for the default refresh delay.*/
+    private static final int DEFAULT_REFRESH_DELAY = 5000;
+
     /** Stores a reference to the configuration to be monitored.*/
     protected FileConfiguration configuration;
 
@@ -55,7 +58,7 @@
     protected long lastChecked;
 
     /** The minimum delay in milliseconds between checks. */
-    protected long refreshDelay = 5000;
+    protected long refreshDelay = DEFAULT_REFRESH_DELAY;
 
     public void setConfiguration(FileConfiguration configuration)
     {
@@ -73,10 +76,10 @@
 
         long now = System.currentTimeMillis();
 
-        if ((now > lastChecked + refreshDelay))
+        if (now > lastChecked + refreshDelay)
         {
             lastChecked = now;
-            if(hasChanged())
+            if (hasChanged())
             {
                 reloading = true;
             }
@@ -92,6 +95,8 @@
 
     /**
      * Return the minimal time in milliseconds between two reloadings.
+     *
+     * @return the refresh delay (in milliseconds)
      */
     public long getRefreshDelay()
     {
@@ -122,6 +127,8 @@
 
     /**
      * Check if the configuration has changed since the last time it was loaded.
+     *
+     * @return a flag whether the configuration has changed
      */
     protected boolean hasChanged()
     {
@@ -131,13 +138,13 @@
             return false;
         }
 
-        return (file.lastModified() > lastModified);
+        return file.lastModified() > lastModified;
     }
 
     /**
      * Returns the file that is monitored by this strategy. Note that the return
      * value can be <b>null </b> under some circumstances.
-     * 
+     *
      * @return the monitored file
      */
     protected File getFile()
@@ -149,7 +156,7 @@
     /**
      * Helper method for transforming a URL into a file object. This method
      * handles file: and jar: URLs.
-     * 
+     *
      * @param url the URL to be converted
      * @return the resulting file or <b>null </b>
      */

Modified: jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/reloading/ReloadingStrategy.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/reloading/ReloadingStrategy.java?rev=312717&r1=312716&r2=312717&view=diff
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/reloading/ReloadingStrategy.java
(original)
+++ jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/reloading/ReloadingStrategy.java
Mon Oct 10 12:26:46 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Copyright 2001-2005 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License")
  * you may not use this file except in compliance with the License.
@@ -26,10 +26,12 @@
  * @version $Revision$, $Date$
  * @since 1.1
  */
-public interface ReloadingStrategy {
-
+public interface ReloadingStrategy
+{
     /**
      * Set the configuration managed by this strategy.
+     *
+     * @param configuration the configuration to monitor
      */
     void setConfiguration(FileConfiguration configuration);
 
@@ -40,6 +42,8 @@
 
     /**
      * Tell if the evaluation of the strategy requires to reload the configuration.
+     *
+     * @return a flag whether a reload should be performed
      */
     boolean reloadingRequired();
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message