/// <summary> /// This is the main constructor. /// </summary> /// <param name="resourceTracker">The resource tracker.</param> /// <param name="client">The client to hold.</param> /// <param name="mappingChannelId">The mapping channel.param> /// <param name="maxAllowedPollWait">The maximum permitted poll length.</param> public ClientPriorityHolder(IResourceTracker resourceTracker , ClientHolder client , string mappingChannelId , IListenerClientPollAlgorithm priorityAlgorithm ) { if (client == null) { throw new ArgumentNullException("client"); } if (priorityAlgorithm == null) { throw new ArgumentNullException("algorithm"); } mPriorityAlgorithm = priorityAlgorithm; Client = client; mMappingChannel = mappingChannelId; //Create the metrics container to hold the calculations for poll priority and reservation amount. mMetrics = new ClientPriorityHolderMetrics(mPriorityAlgorithm , resourceTracker?.RegisterRequestRateLimiter(client.Name, client.ResourceProfiles) , client.Priority , client.Weighting ); mPriorityAlgorithm.InitialiseMetrics(mMetrics); }