private IEnumerable <FarmServerStats> ChangeState(Action <StateExecutor> changeState, Action <object> writeObject = null, WaitCondition waitCondition = null) { var stats = new List <FarmServerStats>(); foreach (var farm in Farms) { foreach (var server in farm.Servers) { using (var arr = new ArrServerManager(server.WebFarm, server.Name)) { changeState(arr.StateExecutor); arr.Commit(); if (waitCondition != null) { while (waitCondition(arr.Counters)) { Thread.Sleep(100); } } if (writeObject != null) { writeObject(arr.Counters.GetServerStats()); } } } } return(stats); }
private IEnumerable<FarmServerStats> ChangeState(Action<StateExecutor> changeState, Action<object> writeObject = null, WaitCondition waitCondition = null) { var stats = new List<FarmServerStats>(); foreach (var farm in Farms) { foreach (var server in farm.Servers) { using (var arr = new ArrServerManager(server.WebFarm, server.Name)) { changeState(arr.StateExecutor); arr.Commit(); if(waitCondition != null) { while(waitCondition(arr.Counters)) { Thread.Sleep(100); } } if(writeObject != null) { writeObject(arr.Counters.GetServerStats()); } } } } return stats; }