public Statement apply()

in disco-java-agent/disco-java-agent-core/src/integ/java/software/amazon/disco/agent/integtest/concurrent/source/ForceConcurrency.java [25:50]


        public Statement apply(Statement base, Description target) {
            return new Statement() {
                @Override
                public void evaluate() throws Throwable {
                    //seems like a high number of retries, but still fails occasionally, and requires the test suite to be rerun
                    boolean success = false;
                    for (int i = 0; i < 63; i++) {
                        try {
                            base.evaluate();
                            success = true;
                        } catch (ConcurrencyCanBeRetriedException t) {
                            System.out.println("DiSCo(Core-integtests): Retrying test in case of concurrency flakiness, retry "+i);
                        } catch (Throwable t) {
                            throw t;
                        }

                        if (success) {
                            return;
                        }
                    }

                    //last chance
                    base.evaluate();
                }
            };
        }