public void SetCacheSizeInBytes(long?cacheSizeInBytes) { if (cacheSizeInBytes != this.Settings.TotalCacheSizeInBytes) { this.Settings.TotalCacheSizeInBytes = cacheSizeInBytes; SizeBasedFlowQueue queue = this.messageQueue; if (queue != null) { queue.SetLinkCreditUsingTotalCacheSize(); } } }
protected override bool OpenInternal() { this.messageQueue = new SizeBasedFlowQueue(this); this.waiterList = new LinkedList <ReceiveAsyncResult>(); this.pendingDispositions = new WorkCollection <ArraySegment <byte>, DisposeAsyncResult, Outcome>(ByteArrayComparer.Instance); bool syncComplete = base.OpenInternal(); if (this.LinkCredit > 0) { this.SendFlow(false); } return(syncComplete); }
void CancelPendingOperations(bool aborted, out Queue <AmqpMessage> messagesToRelease) { messagesToRelease = null; LinkedList <ReceiveAsyncResult> waiters = null; lock (this.SyncRoot) { messagesToRelease = this.messageQueue; waiters = this.waiterList; this.messageQueue = null; this.waiterList = null; } if (waiters != null) { ActionItem.Schedule(o => { var state = (Tuple <LinkedList <ReceiveAsyncResult>, bool>)o; LinkedList <ReceiveAsyncResult> waitersToCancel = state.Item1; foreach (ReceiveAsyncResult waiter in waitersToCancel) { if (state.Item2) { waiter.Cancel(); } else { waiter.Signal(false, null); } } }, new Tuple <LinkedList <ReceiveAsyncResult>, bool>(waiters, aborted)); } if (this.pendingDispositions != null) { this.pendingDispositions.Abort(); } }