Beispiel #1
0
        private Lease GetLeaseWithLeastConnections()
        {
            //now get the service with the least connections?
            Lease leaseWithLeastConnections = null;

            for (var i = 0; i < _leases.Count; i++)
            {
                if (i == 0)
                {
                    leaseWithLeastConnections = _leases[i];
                }
                else
                {
                    if (_leases[i].Connections < leaseWithLeastConnections.Connections)
                    {
                        leaseWithLeastConnections = _leases[i];
                    }
                }
            }

            return(leaseWithLeastConnections);
        }
Beispiel #2
0
 private Lease AddConnection(Lease lease)
 {
     return(new Lease(lease.HostAndPort, lease.Connections + 1));
 }