private void HandlePullLoadAvailabilityRequest(PullLoadAvailabilityRequest message) { Bid bid; if (_hostState.CurrentAction == HostCurrentAction.None && !_hostState.EvacuationMode) { ContainerLoadInfo selectedContainerload = GetToBeRemovedContainerLoadInfo(); if (selectedContainerload != null) { var oldstate = LoadManager.GetPredictedHostLoadInfo().CalculateTotalUtilizationState(MinUtilization, MaxUtilization); var load = LoadManager.GetHostLoadInfoAWithoutContainer(selectedContainerload); var newState = load.CalculateTotalUtilizationState(MinUtilization, MaxUtilization); //Comment this condition if (oldstate == UtilizationStates.Normal && newState == UtilizationStates.UnderUtilization) { bid = new AuctionBid(MachineId, false, load, message.AuctionId, -1, BidReasons.MinimumLoad, 0); } else { //try to find how many pulls the target will need !!! var pullsCountRequest = new PullsCountRequest(message.RequestOwner, this.MachineId, selectedContainerload.ImageId); var t = CommunicationModule.RequestData(pullsCountRequest); t.Wait(); var pullsCountResponce = t.Result as PullsCountResponce; bid = new AuctionBid(MachineId, true, load, message.AuctionId, selectedContainerload.ContainerId, BidReasons.ValidBid, pullsCountResponce.PullsCount); _hostState.CurrentAction = HostCurrentAction.Bidding; _hostState.AuctionId = message.AuctionId; } } else { bid = new AuctionBid(MachineId, false, null, message.AuctionId, -1, BidReasons.Empty, 0); } } else { bid = new AuctionBid(MachineId, false, null, message.AuctionId, -1, BidReasons.CantBid, 0); } LoadAvailabilityResponce availabilityResponce = new LoadAvailabilityResponce(message.SenderId, this.MachineId, message.AuctionId, bid); CommunicationModule.SendMessage(availabilityResponce); }