/// <summary> /// Starts load balancer /// </summary> /// <typeparam name="T">Task type</typeparam> /// <param name="ballancerTask">Ballancer task to run</param> /// <returns>System.Threading.Task that runs the load ballancer</returns> public Task StrartLoadBallancer <TJob, TJobType>(IBallancerTask <TJob, TJobType> ballancerTask) { var config = reader.ReadConfig(); var machineM = new RemoteMachinesManager(config.PingerPort, config.Timeout, config.Hosts, config); var ballancer = new LocalBallancer <TJob, TJobType>(ballancerTask, new PerformanceManager(), machineM, config.MachineNumber); return(ballancer.StartAsync()); }
public LocalBallancer(IBallancerTask <TJob, TJobType> ballancerTask, IPerformanceManager performanceManager, IRemoteMachinesManager remoteMachines, int currentMachineId) { if (ballancerTask == null) { throw new ArgumentNullException("ballancerTask"); } if (performanceManager == null) { throw new ArgumentNullException("performanceManager"); } if (remoteMachines == null) { throw new ArgumentNullException("remoteMachines"); } this.ballancerTask = ballancerTask; this.performanceManager = performanceManager; this.remoteMachines = remoteMachines; this.currentMachineId = currentMachineId; }