commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r1435888 - in /commons/proper/configuration/trunk/src: main/java/org/apache/commons/configuration/reloading/ReloadingController.java test/java/org/apache/commons/configuration/reloading/TestReloadingController.java
Date Sun, 20 Jan 2013 17:05:20 GMT
Author: oheger
Date: Sun Jan 20 17:05:20 2013
New Revision: 1435888

URL: http://svn.apache.org/viewvc?rev=1435888&view=rev
Log:
ReloadingController.checkForReloading() now always returns true if in reloading state.

Modified:
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/reloading/ReloadingController.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/reloading/TestReloadingController.java

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/reloading/ReloadingController.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/reloading/ReloadingController.java?rev=1435888&r1=1435887&r2=1435888&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/reloading/ReloadingController.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/reloading/ReloadingController.java
Sun Jan 20 17:05:20 2013
@@ -143,22 +143,28 @@ public class ReloadingController
      * if necessary. The argument can be an arbitrary data object; it will be
      * part of the event notification sent out when a reload operation should be
      * performed. The return value indicates whether a change was detected and
-     * an event was sent.
+     * an event was sent. Once a need for a reload is detected, this controller
+     * is in <em>reloading state</em>. Until this state is reset (by calling
+     * {@link #resetReloadingState()}), no further reloading checks are
+     * performed by this method, and no events are fired; it then returns always
+     * <b>true</b>.
      *
      * @param data additional data for an event notification
+     * @return a flag whether a reload operation is necessary
      */
     public boolean checkForReloading(Object data)
     {
         boolean sendEvent = false;
         synchronized (this)
         {
-            if (!isInReloadingState())
+            if (isInReloadingState())
             {
-                if (getDetector().isReloadingRequired())
-                {
-                    sendEvent = true;
-                    reloadingState = true;
-                }
+                return true;
+            }
+            if (getDetector().isReloadingRequired())
+            {
+                sendEvent = true;
+                reloadingState = true;
             }
         }
 

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/reloading/TestReloadingController.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/reloading/TestReloadingController.java?rev=1435888&r1=1435887&r2=1435888&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/reloading/TestReloadingController.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/reloading/TestReloadingController.java
Sun Jan 20 17:05:20 2013
@@ -151,7 +151,7 @@ public class TestReloadingController
         ReloadingController ctrl = createController();
         ctrl.addReloadingListener(l);
         assertTrue("Wrong result (1)", ctrl.checkForReloading(1));
-        assertFalse("Wrong result (2)", ctrl.checkForReloading(2));
+        assertTrue("Wrong result (2)", ctrl.checkForReloading(2));
         EasyMock.verify(detector, l);
     }
 



Mime
View raw message