public NextQueue GetQueue(IHttpContext context) { if (Type == ThreadQueueType.Single) { return(QueueGroup.Queues[0]); } else if (Type == ThreadQueueType.Multiple) { return(QueueGroup.Next()); } else if (Type == ThreadQueueType.DataUnique) { string value = null; if (UniqueName != null) { context.Data.TryGetString(UniqueName, out value); } if (value == null) { value = context.Request.Url; } int index = System.Math.Abs(value.GetHashCode() % mUniqueQueueGroup.Queues.Count); return(mUniqueQueueGroup.Queues[index]); } return(QueueGroup.Next()); }
public NextQueue GetQueue(IHttpContext context) { if (Type == ThreadQueueType.Single) { return(QueueGroup.Queues[0]); } else if (Type == ThreadQueueType.Multiple) { return(QueueGroup.Next()); } else if (Type == ThreadQueueType.DataUnique) { string value = null; if (UniqueName != null) { if (string.Compare(UniqueName, "$path", true) == 0) { value = context.Request.GetSourcePath(); } else if (UniqueName.IndexOf("__") == 0) { return(mUniqueQueueGroup.Has(UniqueName.GetHashCode())); } else { value = context.Request.Header[UniqueName]; if (value == null) { context.Data.TryGetString(UniqueName, out value); } } } if (value == null) { value = context.Request.GetSourceUrl(); } return(mUniqueQueueGroup.Has(value.GetHashCode())); } return(QueueGroup.Next()); }