Exemple #1
0
        //清空全部空闲
        //public void ClearAllIdles(Type type_)
        //{
        //    BasePool pool = GetPool(type_);
        //    if (pool != null)
        //    {
        //        pool.ClearAllIdles();
        //    }
        //}

        //public void ClearAllIdles()
        //{
        //    if (m_type2pool.Count == 0)
        //        return;

        //    foreach (KeyValuePair<Type, ClassPool> kvp in m_type2pool)
        //    {
        //        ClassPool v = kvp.Value;
        //        v.ClearAllIdles();
        //    }
        //}

        //清空对象池
        public void Clear()
        {
            if (m_type2pool.Count > 0)
            {
                foreach (KeyValuePair <Type, TypePool> kvp in m_type2pool)
                {
                    TypePool v = kvp.Value;
                    v.Clear();
                }
                m_type2pool.Clear();
            }


            if (m_t2pool.Count > 0)
            {
                foreach (KeyValuePair <Type, object> kvp in m_t2pool)
                {
                    ClassUtil.CallMethod(kvp.Value, "Clear");
                }
                m_t2pool.Clear();
            }


            if (m_id2pool.Count > 0)
            {
                foreach (KeyValuePair <string, BasePool> kvp in m_id2pool)
                {
                    BasePool v = kvp.Value;
                    v.Clear();
                }
                m_id2pool.Clear();
            }
        }
Exemple #2
0
        //清空对象池
        public void ClearPool(Type type_)
        {
            BasePool pool = GetPool(type_);

            if (pool != null)
            {
                pool.Clear();
            }
        }