@Override
  public void run(final RunNotifier notifier) {
    final Description description = getDescription();
    final EachTestNotifier testNotifier = new EachTestNotifier(notifier, description);
    final Statement statement = classBlock(notifier);
    try {
      statement.evaluate();
    } catch (AssumptionViolatedException e) {
      testNotifier.fireTestIgnored();
    } catch (StoppedByUserException e) {
      // not retrying when user explicitly stops the test
      throw e;
    } catch (Throwable e) {
      // retry on any other exception
      retry(description, testNotifier, statement, e);
    }
  }
JUnit test runner that reruns test on failure.
common/src/test/org/apache/hive/common/util/RetryTestRunner.java