public LeaseConfigurationIncludingManager Build()
        {
            if (timeBetweenAquiring <= timeBetweenRenewing)
            {
                throw new HostConfigurationException($"{nameof(AquireLeaseEvery)} must be greater than {nameof(RenewLeaseEvery)}.");
            }

            var leaseCriteria = new LeaseCriteria(timeBetweenRenewing, timeBetweenAquiring);

            return(new LeaseConfigurationIncludingManager(NodeId, managerFunc, calculatorFunc(), leaseCriteria));
        }
Esempio n. 2
0
        public LeaseConfiguration(string nodeId, ILeaseLengthCalculator leaseLengthCalculator, LeaseCriteria leaseCriteria)
        {
            if (string.IsNullOrEmpty(nodeId))
            {
                throw new ArgumentException("Value cannot be null or empty.", nameof(nodeId));
            }

            NodeId = nodeId;
            LeaseLengthCalculator = leaseLengthCalculator ?? throw new ArgumentNullException(nameof(leaseLengthCalculator));
            LeaseCriteria         = leaseCriteria;
        }
 public LeaseConfigurationIncludingManager(string nodeId, Func <LeaseConfiguration, ILeaseManager> leaseManager, ILeaseLengthCalculator leaseLengthCalculator, LeaseCriteria leaseCriteria)
     : base(nodeId, leaseLengthCalculator, leaseCriteria)
 {
     LeaseManager = leaseManager;
 }
 public LeaseLengthCalculator(LeaseCriteria leaseCriteria)
 {
     this.LeaseCriteria = leaseCriteria;
 }