org.apache.geode.cache30

## Class CacheSerializableRunnable

- java.lang.Object
- - org.apache.geode.test.dunit.SerializableRunnable
  - - org.apache.geode.cache30.CacheSerializableRunnable

- All Implemented Interfaces:
    java.io.Serializable, org.apache.geode.test.dunit.RepeatableRunnable, org.apache.geode.test.dunit.SerializableRunnableIF

      public abstract class CacheSerializableRunnable
      extends org.apache.geode.test.dunit.SerializableRunnable
      implements org.apache.geode.test.dunit.RepeatableRunnable

  A helper class that provides the `SerializableRunnable` class, but uses a `run2()` method instead that throws `CacheException`. This way, we don't need to have a lot of try/catch code in the tests.
  Since:
    GemFire 3.0
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `CacheSerializableRunnable.CacheSerializableRunnableException` An exception that wraps a `CacheException`

  - ### Field Summary

    - ### Fields inherited from class org.apache.geode.test.dunit.SerializableRunnable

      `args`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CacheSerializableRunnable(java.lang.String name)` Creates a new `CacheSerializableRunnable` with the given name
    `CacheSerializableRunnable(java.lang.String name, java.lang.Object[] args)` Creates a new `CacheSerializableRunnable` with the given name

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `run()` Invokes the `run2()` method and will wrap any `CacheException` thrown by `run2` in a `CacheSerializableRunnable.CacheSerializableRunnableException`.
    `abstract void` | `run2()` A `run` method that may throw a `CacheException`.
    `void` | `run3()`
    `void` | `runRepeatingIfNecessary(long repeatTimeoutMs)` Invokes the `run()` method.

    - ### Methods inherited from class org.apache.geode.test.dunit.SerializableRunnable

      `getName, setName, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### CacheSerializableRunnable

          public CacheSerializableRunnable(java.lang.String name)

      Creates a new `CacheSerializableRunnable` with the given name

    - #### CacheSerializableRunnable

          public CacheSerializableRunnable(java.lang.String name,
                                           java.lang.Object[] args)

      Creates a new `CacheSerializableRunnable` with the given name

  - ### Method Detail

    - #### run

          public void run()

      Invokes the `run2()` method and will wrap any `CacheException` thrown by `run2` in a `CacheSerializableRunnable.CacheSerializableRunnableException`.
      Specified by:
        `run` in interface `org.apache.geode.test.dunit.SerializableRunnableIF`

    - #### runRepeatingIfNecessary

          public void runRepeatingIfNecessary(long repeatTimeoutMs)

      Invokes the `run()` method. If AssertionError is thrown, and repeatTimeoutMs is >0, then repeat the `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.
      Specified by:
        `runRepeatingIfNecessary` in interface `org.apache.geode.test.dunit.RepeatableRunnable`

    - #### run2

          public abstract void run2()
                             throws CacheException

      A `run` method that may throw a `CacheException`.
      Throws:
        `CacheException`

    - #### run3

          public void run3()
                    throws CacheException

      Throws:
        `CacheException`