Exemple #1
0
        public override DestinationStatus PickDestination(IReadOnlyList <DestinationStatus> availableDestinations)
        {
            Random r = RandomFactory.GetRandom();

            DestinationStatus first  = availableDestinations[r.Next(availableDestinations.Count)];
            DestinationStatus second = availableDestinations[r.Next(availableDestinations.Count)];

            return((first.CurrentRequestCount <= second.CurrentRequestCount) ? first : second);
        }
Exemple #2
0
        public override DestinationStatus PickDestination(IReadOnlyList <DestinationStatus> availableDestinations)
        {
            DestinationStatus chosenDestination = availableDestinations[0];
            int leastRequestCount = chosenDestination.CurrentRequestCount;

            for (int i = 1; i < availableDestinations.Count; i++)
            {
                int destinationRequestCount = availableDestinations[i].CurrentRequestCount;
                if (destinationRequestCount < leastRequestCount)
                {
                    chosenDestination = availableDestinations[i];
                    leastRequestCount = destinationRequestCount;
                }
            }

            return(chosenDestination);
        }
 // TODO: This is pretty lame because there's no way to track passive history and
 // make a determination based on that.
 // For now it's fine though.
 // Return value: null means don't deactivate, otherwise TimeSpan indicates how long to deactivate for.
 public abstract TimeSpan?CheckForDeactivationOnFailure(DestinationStatus failedDestinationStatus);