You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by sa...@apache.org on 2018/09/28 22:17:17 UTC

[geode] branch develop updated: GEODE-5787: deleted deprecated RepeatableRunnable (#2522)

This is an automated email from the ASF dual-hosted git repository.

sai_boorlagadda pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new 7f0c156  GEODE-5787: deleted deprecated RepeatableRunnable (#2522)
7f0c156 is described below

commit 7f0c15619e71e2afc563a96be6a2dcfb268b0342
Author: Sai Boorlagadda <sa...@gmail.com>
AuthorDate: Fri Sep 28 15:17:09 2018 -0700

    GEODE-5787: deleted deprecated RepeatableRunnable (#2522)
---
 .../geode/cache30/CacheSerializableRunnable.java   | 29 +-------------
 .../java/org/apache/geode/test/dunit/Invoke.java   | 45 ----------------------
 .../geode/test/dunit/RepeatableRunnable.java       | 28 --------------
 .../main/java/org/apache/geode/test/dunit/VM.java  | 17 --------
 4 files changed, 1 insertion(+), 118 deletions(-)

diff --git a/geode-dunit/src/main/java/org/apache/geode/cache30/CacheSerializableRunnable.java b/geode-dunit/src/main/java/org/apache/geode/cache30/CacheSerializableRunnable.java
index 3ae4f1b..5b45ec1 100644
--- a/geode-dunit/src/main/java/org/apache/geode/cache30/CacheSerializableRunnable.java
+++ b/geode-dunit/src/main/java/org/apache/geode/cache30/CacheSerializableRunnable.java
@@ -16,7 +16,6 @@ package org.apache.geode.cache30;
 
 import org.apache.geode.cache.CacheException;
 import org.apache.geode.cache.CacheRuntimeException;
-import org.apache.geode.test.dunit.RepeatableRunnable;
 import org.apache.geode.test.dunit.SerializableRunnable;
 
 /**
@@ -26,8 +25,7 @@ import org.apache.geode.test.dunit.SerializableRunnable;
  *
  * @since GemFire 3.0
  */
-public abstract class CacheSerializableRunnable extends SerializableRunnable
-    implements RepeatableRunnable {
+public abstract class CacheSerializableRunnable extends SerializableRunnable {
 
   /**
    * Creates a new <code>CacheSerializableRunnable</code> with the given name
@@ -63,31 +61,6 @@ public abstract class CacheSerializableRunnable extends SerializableRunnable
   }
 
   /**
-   * Invokes the {@link #run} method. If AssertionError is thrown, and repeatTimeoutMs is >0, then
-   * repeat the {@link #run} method until it either succeeds or repeatTimeoutMs milliseconds have
-   * passed. The AssertionError is only thrown to the caller if the last run still throws it.
-   */
-  public void runRepeatingIfNecessary(long repeatTimeoutMs) {
-    long start = System.currentTimeMillis();
-    AssertionError lastErr = null;
-    do {
-      try {
-        lastErr = null;
-        this.run();
-      } catch (AssertionError err) {
-        lastErr = err;
-        try {
-          Thread.sleep(50);
-        } catch (InterruptedException ex) {
-          throw new RuntimeException("interrupted", ex);
-        }
-      }
-    } while (lastErr != null && System.currentTimeMillis() - start < repeatTimeoutMs);
-    if (lastErr != null)
-      throw lastErr;
-  }
-
-  /**
    * A {@link SerializableRunnable#run run} method that may throw a {@link CacheException}.
    */
   public abstract void run2() throws CacheException;
diff --git a/geode-dunit/src/main/java/org/apache/geode/test/dunit/Invoke.java b/geode-dunit/src/main/java/org/apache/geode/test/dunit/Invoke.java
index 34d4665..cba12d0 100755
--- a/geode-dunit/src/main/java/org/apache/geode/test/dunit/Invoke.java
+++ b/geode-dunit/src/main/java/org/apache/geode/test/dunit/Invoke.java
@@ -126,49 +126,4 @@ public class Invoke {
   public static void invokeInLocator(final SerializableRunnableIF runnable) {
     Host.getLocator().invoke(runnable);
   }
-
-  /**
-   * @deprecated Please use {@link org.awaitility.Awaitility} with
-   *             {@link #invokeInEveryVM(SerializableCallableIF)} instead.
-   */
-  public static void invokeRepeatingIfNecessary(final VM vm, final RepeatableRunnable runnable) {
-    vm.invokeRepeatingIfNecessary(runnable, 0);
-  }
-
-  /**
-   * @deprecated Please use {@link org.awaitility.Awaitility} with
-   *             {@link #invokeInEveryVM(SerializableCallableIF)} instead.
-   */
-  public static void invokeRepeatingIfNecessary(final VM vm, final RepeatableRunnable runnable,
-      final long repeatTimeoutMs) {
-    vm.invokeRepeatingIfNecessary(runnable, repeatTimeoutMs);
-  }
-
-  /**
-   * @deprecated Please use {@link org.awaitility.Awaitility} with
-   *             {@link #invokeInEveryVM(SerializableCallableIF)} instead.
-   */
-  public static void invokeInEveryVMRepeatingIfNecessary(final RepeatableRunnable runnable) {
-    Invoke.invokeInEveryVMRepeatingIfNecessary(runnable, 0);
-  }
-
-  /**
-   * Invokes a <code>SerializableRunnable</code> in every VM that DUnit knows about. If
-   * <code>run()</code> throws an assertion failure, its execution is repeated, until no assertion
-   * failure occurs or <code>repeatTimeoutMs</code> milliseconds have passed.
-   *
-   * @deprecated Please use {@link org.awaitility.Awaitility} with
-   *             {@link #invokeInEveryVM(SerializableCallableIF)} instead.
-   */
-  public static void invokeInEveryVMRepeatingIfNecessary(final RepeatableRunnable runnable,
-      final long repeatTimeoutMs) {
-    for (int h = 0; h < Host.getHostCount(); h++) {
-      Host host = Host.getHost(h);
-
-      for (int v = 0; v < host.getVMCount(); v++) {
-        VM vm = host.getVM(v);
-        vm.invokeRepeatingIfNecessary(runnable, repeatTimeoutMs);
-      }
-    }
-  }
 }
diff --git a/geode-dunit/src/main/java/org/apache/geode/test/dunit/RepeatableRunnable.java b/geode-dunit/src/main/java/org/apache/geode/test/dunit/RepeatableRunnable.java
deleted file mode 100644
index 3403aa2..0000000
--- a/geode-dunit/src/main/java/org/apache/geode/test/dunit/RepeatableRunnable.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.test.dunit;
-
-/**
- * A RepeatableRunnable is an object that implements a method that can be invoked repeatably without
- * causing any side affects.
- *
- * @deprecated Please use SerializableRunnable with {@link org.awaitility.Awaitility} instead.
- */
-@Deprecated
-public interface RepeatableRunnable {
-
-  public void runRepeatingIfNecessary(long repeatTimeoutMs);
-
-}
diff --git a/geode-dunit/src/main/java/org/apache/geode/test/dunit/VM.java b/geode-dunit/src/main/java/org/apache/geode/test/dunit/VM.java
index 4c54c8f..32643ec 100644
--- a/geode-dunit/src/main/java/org/apache/geode/test/dunit/VM.java
+++ b/geode-dunit/src/main/java/org/apache/geode/test/dunit/VM.java
@@ -25,7 +25,6 @@ import java.util.List;
 import java.util.concurrent.Callable;
 
 import hydra.MethExecutorResult;
-import org.awaitility.Awaitility;
 
 import org.apache.geode.internal.process.ProcessUtils;
 import org.apache.geode.test.dunit.standalone.BounceResult;
@@ -386,22 +385,6 @@ public class VM implements Serializable {
   }
 
   /**
-   * Invokes the {@code run} method of a {@link Runnable} in this {@code VM}. If the invocation
-   * throws AssertionError, and repeatTimeoutMs is >0, the {@code run} method is invoked repeatedly
-   * until it either succeeds, or repeatTimeoutMs has passed. The AssertionError is thrown back to
-   * the sender of this method if {@code run} has not completed successfully before repeatTimeoutMs
-   * has passed.
-   *
-   * @deprecated Please use {@link Awaitility} to await condition and then
-   *             {@link #invoke(SerializableCallableIF)} instead.
-   */
-  @Deprecated
-  public void invokeRepeatingIfNecessary(final RepeatableRunnable runnable,
-      final long repeatTimeoutMs) {
-    invoke(runnable, "runRepeatingIfNecessary", new Object[] {repeatTimeoutMs});
-  }
-
-  /**
    * Invokes an instance method with no arguments on an object that is serialized into this
    * {@code VM}. The return type of the method can be either {@link Object} or {@code void}. If the
    * return type of the method is {@code void}, {@code null} is returned.