示例#1
0
            public QueueRequestIfc Dequeue()
            {
                Monitor.Enter(this);
                QueueRequestIfc result;

                try
                {
                    QueuedTileProvider.QueueRequestCell firstKey = this.queue.FirstKey;
                    if (firstKey == null)
                    {
                        result = null;
                    }
                    else
                    {
                        this.queue.Remove(firstKey);
                        this.cellMap.Remove(firstKey.qr);
                        this.UpdateDebugList();
                        result = firstKey.qr;
                    }
                }
                finally
                {
                    Monitor.Exit(this);
                }
                return(result);
            }
示例#2
0
            public void TruncateQueue(int targetCount)
            {
                List <QueuedTileProvider.QueueRequestCell> list = new List <QueuedTileProvider.QueueRequestCell>();

                Monitor.Enter(this);
                try
                {
                    while (this.queue.Count > targetCount)
                    {
                        QueuedTileProvider.QueueRequestCell lastKey = this.queue.LastKey;
                        this.cellMap.Remove(lastKey.qr);
                        this.queue.Remove(lastKey);
                        list.Add(lastKey);
                    }
                    this.UpdateDebugList();
                }
                finally
                {
                    Monitor.Exit(this);
                }
                foreach (QueuedTileProvider.QueueRequestCell current in list)
                {
                    current.qr.DeQueued();
                }
            }
示例#3
0
            public int CompareTo(object o)
            {
                QueuedTileProvider.QueueRequestCell queueRequestCell = (QueuedTileProvider.QueueRequestCell)o;
                int num = -this.queuedInterest.CompareTo(queueRequestCell.queuedInterest);

                if (num != 0)
                {
                    return(num);
                }
                return(this.uniqueID.CompareTo(queueRequestCell.uniqueID));
            }
示例#4
0
 public void Enqueue(QueueRequestIfc qr)
 {
     Monitor.Enter(this);
     try
     {
         QueuedTileProvider.QueueRequestCell queueRequestCell = new QueuedTileProvider.QueueRequestCell();
         queueRequestCell.qr             = qr;
         queueRequestCell.queuedInterest = qr.GetInterest();
         this.cellMap.Add(qr, queueRequestCell);
         this.queue.Add(queueRequestCell, qr);
         this.UpdateDebugList();
     }
     finally
     {
         Monitor.Exit(this);
     }
 }
			public void Enqueue(QueueRequestIfc qr)
			{
				Monitor.Enter(this);
				try
				{
					QueuedTileProvider.QueueRequestCell queueRequestCell = new QueuedTileProvider.QueueRequestCell();
					queueRequestCell.qr = qr;
					queueRequestCell.queuedInterest = qr.GetInterest();
					this.cellMap.Add(qr, queueRequestCell);
					this.queue.Add(queueRequestCell, qr);
					this.UpdateDebugList();
				}
				finally
				{
					Monitor.Exit(this);
				}
			}
示例#6
0
 public void ChangePriority(QueueRequestIfc qr)
 {
     Monitor.Enter(this);
     try
     {
         if (this.cellMap.ContainsKey(qr))
         {
             QueuedTileProvider.QueueRequestCell key = this.cellMap[qr];
             this.queue.Remove(key);
             this.cellMap.Remove(qr);
             this.Enqueue(qr);
             this.UpdateDebugList();
         }
     }
     finally
     {
         Monitor.Exit(this);
     }
 }