jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1574801 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/BackgroundObserver.java
Date Thu, 06 Mar 2014 08:38:34 GMT
Author: mduerig
Date: Thu Mar  6 08:38:34 2014
New Revision: 1574801

URL: http://svn.apache.org/r1574801
Log:
OAK-1491: ObservationTest failure on Windows
Better naming

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/BackgroundObserver.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/BackgroundObserver.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/BackgroundObserver.java?rev=1574801&r1=1574800&r2=1574801&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/BackgroundObserver.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/BackgroundObserver.java
Thu Mar  6 08:38:34 2014
@@ -237,9 +237,9 @@ public class BackgroundObserver implemen
      * A future task with a on complete handler.
      */
     private static class ListenableFutureTask extends FutureTask<Void> {
-        private final AtomicBoolean ran = new AtomicBoolean(false);
+        private final AtomicBoolean completed = new AtomicBoolean(false);
 
-        private volatile Runnable task;
+        private volatile Runnable onComplete;
 
         public ListenableFutureTask(Callable<Void> callable) {
             super(callable);
@@ -256,23 +256,23 @@ public class BackgroundObserver implemen
          * <p>
          * Note: there is no guarantee to which handler will run when the method
          * is called multiple times with different arguments.
-         * @param task
+         * @param onComplete
          */
-        public void onComplete(Runnable task) {
-            this.task = task;
+        public void onComplete(Runnable onComplete) {
+            this.onComplete = onComplete;
             if (isDone()) {
-                run(task);
+                run(onComplete);
             }
         }
 
         @Override
         protected void done() {
-            run(task);
+            run(onComplete);
         }
 
-        private void run(Runnable runnable) {
-            if (runnable != null && ran.compareAndSet(false, true)) {
-                runnable.run();
+        private void run(Runnable onComplete) {
+            if (onComplete != null && completed.compareAndSet(false, true)) {
+                onComplete.run();
             }
         }
 



Mime
View raw message