public override void Switch(IAstTransformer transformer, out Node resultingNode) { RetryStatement thisNode = (RetryStatement)this; Statement resultingTypedNode = thisNode; transformer.OnRetryStatement(thisNode, ref resultingTypedNode); resultingNode = resultingTypedNode; }
/// <summary> /// Will retry the given statement up to maxRetry times while pausing between each try for /// the given interval. /// </summary> /// <param name="test">Generic boolean statement.</param> /// <param name="interval">Amount of time to wait between each retry.</param> /// <param name="maxRetry">Maximum number of retries.</param> /// <param name="message">Message to print on failure.</param> public static void AssertTrueWithTimeout( RetryStatement test, TimeSpan interval, int maxRetry, string message) { for (int tryCount = 0; tryCount <= maxRetry; tryCount++) { if (test.Invoke()) { return; } System.Threading.Thread.Sleep(interval); } throw new Exception(string.Format("Statement timed out. {0}", message)); }
public override void OnRetryStatement(RetryStatement node) { WriteIndented("retry"); WriteLine(); }
override public void OnRetryStatement(RetryStatement node) { WriteIndented(); WriteKeyword("retry"); WriteLine(); }