Exemplo n.º 1
0
        private static IObjectPoolContainer I_GetObjectPoolContainer(ObjectPoolKey _key)
        {
            IObjectPoolContainer objectPoolContainer;

            if (!ObjectPoolManager.ms_ObjPools.TryGetValue(_key, out objectPoolContainer))
            {
                bool     flag             = true;
                object[] customAttributes = _key.GetObjType().GetCustomAttributes(false);
                for (int i = 0; i < customAttributes.Length; i++)
                {
                    ObjectPoolAttribute objectPoolAttribute  = (ObjectPoolAttribute)customAttributes[i];
                    ObjectPoolAttribute objectPoolAttribute2 = objectPoolAttribute;
                    if (objectPoolAttribute2 != null)
                    {
                        objectPoolContainer = objectPoolAttribute2.CreatePoolContainerStaticPrivate(objectPoolAttribute2);
                        ObjectPoolManager.ms_ObjPools.Add(_key, objectPoolContainer);
                        flag = false;
                        break;
                    }
                }
                if (flag)
                {
                    TsLog.LogError("ObjectPoolManager.I_GetObjectPoolContainer(...). Fail creation {0}", new object[]
                    {
                        _key.GetObjType()
                    });
                }
            }
            return(objectPoolContainer);
        }
Exemplo n.º 2
0
 private static IObjectPoolContainer CreateInstanceStaicPrivate(ObjectPoolAttribute opa)
 {
     return(new StackObjectPool(opa));
 }
Exemplo n.º 3
0
 private StackObjectPool(ObjectPoolAttribute opa)
 {
     this.m_opAttribute = opa;
     this.m_reuseStack  = new Stack <object>(this.m_opAttribute.initCapacity);
     this.GrowPool_I();
 }