@@ -0,0 +1,2835 @@
+package org.apache.solr.common.util;%0A%0A/*%0A * Licensed to the Apache Software Foundation (ASF) under one or more%0A * contributor license agreements.  See the NOTICE file distributed with%0A * this work for additional information regarding copyright ownership.%0A * The ASF licenses this file to You under the Apache License, Version 2.0%0A * (the %22License%22); you may not use this file except in compliance with%0A * the License.  You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Aimport java.util.concurrent.atomic.AtomicInteger;%0A%0Aimport org.apache.solr.SolrTestCaseJ4;%0Aimport org.apache.solr.common.SolrException;%0Aimport org.apache.solr.common.SolrException.ErrorCode;%0Aimport org.apache.solr.common.util.RetryUtil.RetryCmd;%0A%0A%0Apublic class TestRetryUtil extends SolrTestCaseJ4 %7B%0A%0A  public void testRetryOnThrowable() throws Throwable %7B%0A    final AtomicInteger executes = new AtomicInteger();%0A    RetryUtil.retryOnThrowable(SolrException.class, 10000, 10, new RetryCmd() %7B%0A      %0A      @Override%0A      public void execute() throws Throwable %7B%0A        int calls = executes.incrementAndGet();%0A        if (calls %3C= 2) %7B%0A          throw new SolrException(ErrorCode.SERVER_ERROR, %22Bad Stuff Happened%22);%0A        %7D%0A      %7D%0A    %7D);%0A    %0A    assertEquals(3, executes.get());%0A    %0A    final AtomicInteger executes2 = new AtomicInteger();%0A    boolean caughtSolrException = false;%0A    try %7B%0A      RetryUtil.retryOnThrowable(IllegalStateException.class, 10000, 10,%0A          new RetryCmd() %7B%0A            %0A            @Override%0A            public void execute() throws Throwable %7B%0A              int calls = executes2.incrementAndGet();%0A              if (calls %3C= 2) %7B%0A                throw new SolrException(ErrorCode.SERVER_ERROR,%0A                    %22Bad Stuff Happened%22);%0A              %7D%0A            %7D%0A          %7D);%0A    %7D catch (SolrException e) %7B%0A      caughtSolrException = true;%0A    %7D%0A    assertTrue(caughtSolrException);%0A    assertEquals(1, executes2.get());%0A    %0A    final AtomicInteger executes3 = new AtomicInteger();%0A    caughtSolrException = false;%0A    try %7B%0A      RetryUtil.retryOnThrowable(SolrException.class, 1000, 10, new RetryCmd() %7B%0A        %0A        @Override%0A        public void execute() throws Throwable %7B%0A          executes3.incrementAndGet();%0A          throw new SolrException(ErrorCode.SERVER_ERROR, %22Bad Stuff Happened%22);%0A        %7D%0A      %7D);%0A    %7D catch (SolrException e) %7B%0A      caughtSolrException = true;%0A    %7D%0A    %0A    assertTrue(executes3.get() %3E 1);%0A  %7D%0A%0A%7D%0A

Add TestRetryUtil.