Ejemplo n.º 1
0
 internal void AppendWait(CacheGetter getter)
 {
     if (IsLoaded && currentGetter == null)
     {
         currentGetter = getter;
         getter.Start();
         Append(getter);
     }
     else
     {
         getter.LinkNext = waitGetterLink;
         waitGetterLink  = getter;
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 下一个获取缓存数据
 /// </summary>
 internal void NextGetter()
 {
     if (NewFile == null)
     {
         if ((currentGetter = waitGetterLink) != null)
         {
             waitGetterLink = currentGetter.LinkNext;
             currentGetter.Start();
             Append(currentGetter);
         }
     }
     else
     {
         currentGetter = null;
         NewFile.Start(File);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 数据操作完以后的持久化处理
        /// </summary>
        /// <param name="buffer">数据缓冲区</param>
        private void onOperation(Buffer buffer)
        {
            if (File != null)
            {
                buffer.Reference();
                File.BufferLink.Push(buffer);
                if (NewFile != null)
                {
                    buffer.Reference();
                    NewFile.BufferLink.Push(buffer);
                }
            }
            CacheGetter getter = getterLink;

            if (getter != null)
            {
                CacheGetter father = null;
                do
                {
                    if (getter.Append(buffer))
                    {
                        father = getter;
                        getter = getter.LinkNext;
                    }
                    else
                    {
                        if (getter == currentGetter)
                        {
                            NextGetter();
                        }
                        getter = getter.LinkNext;
                        if (father == null)
                        {
                            getterLink = getter;
                        }
                        else
                        {
                            father.LinkNext = getter;
                        }
                    }
                }while (getter != null);
            }
            buffer.FreeReference();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 释放资源
        /// </summary>
        internal void DisposeTcpQueue()
        {
            CanWrite = false;
            if (File != null)
            {
                File.Close();
                File = null;
            }
            CacheGetter getter = waitGetterLink;

            waitGetterLink = null;
            while (getter != null)
            {
                getter = getter.Cancel();
            }
            getter     = getterLink;
            getterLink = currentGetter = null;
            while (getter != null)
            {
                getter = getter.Cancel();
            }
        }
Ejemplo n.º 5
0
 internal void Append(CacheGetter getter)
 {
     getter.LinkNext = getterLink;
     getterLink      = getter;
 }