private void Execute() { IREST <T> _rest; Func <IREST <T> > _command; T _response = null; int _retries; int _secDelay; //get all registered providers RoundRobin <string> rr = new RoundRobin <string>(GeneralSettings.roundRobin[0].direction); if (GeneralSettings.roundRobin[0].direction != RoundRobin <T> .FIXED) { foreach (var p in providers) { rr.Add(p.Key); } } //retrieve and update geocode, one rec at a time foreach (T rec in source().RecordSet) { _rest = null; _command = null; _response = null; while (_response == null) { providers.TryGetValue(provider, out _command); _rest = _command(); //hydrate instantiation _retries = GeneralSettings.retry[0].numOfRetries; _secDelay = GeneralSettings.retry[0].secondsDelay * Constants.MILLISECONDS; //convert to miliseconds while (_response == null && _retries != 0) //TODO: actually, _response won't be null, but an error bubbled up from Get method { _response = _rest.GetDataAsync(rec); //retrieve rec's from 3rd party //_response = null; //test if (_response != null) { break; } else { _retries--; Thread.Sleep(_secDelay); } } // _retries = 0; //test if (_response == null && _retries == 0 && rr.MethodName != RoundRobin <T> .FIXED) { rr.Move(); provider = rr.Current; } } target().Save(_response); //update local db with newly retrieved values } }