Exemplo n.º 1
0
 public ObjectPool(int initialStock, IPoolFactory <T> factory)
 {
     _initialStock = initialStock;
     _factory      = factory;
     _stack        = new List <T>();
     CreateStock();
 }
Exemplo n.º 2
0
        public Engine(ILogManager logManager, IPoolFactory poolFactory)
        {
            _logger      = Log.ForContext <Engine>();
            _poolFactory = poolFactory;

            _pools = new List <IPool>();
            Pools  = new ReadOnlyCollection <IPool>(_pools);
        }
 public void BeginTest()
 {
     repo = new MockRepository();
     channelCreator = repo.StrictMock<ICanCreateChannels<IService>>();
     poolFactory = repo.StrictMock<IPoolFactory>();
     pool = repo.StrictMock<IObjectPool>();
     Expect.Call(poolFactory.CreatePool(null)).IgnoreArguments().Return(pool);
     LastCall.IgnoreArguments();
 }
 public void BeginTest()
 {
     repo           = new MockRepository();
     channelCreator = repo.StrictMock <ICanCreateChannels <IService> >();
     poolFactory    = repo.StrictMock <IPoolFactory>();
     pool           = repo.StrictMock <IObjectPool>();
     Expect.Call(poolFactory.CreatePool(null)).IgnoreArguments().Return(pool);
     LastCall.IgnoreArguments();
 }
Exemplo n.º 5
0
        public PoolManager(IEventSystem eventSystem, IPoolFactory poolFactory, IGroupAccessorFactory groupAccessorFactory)
        {
            EventSystem          = eventSystem;
            PoolFactory          = poolFactory;
            GroupAccessorFactory = groupAccessorFactory;

            _groupAccessors = new Dictionary <GroupAccessorToken, IGroupAccessor>();
            _pools          = new Dictionary <string, IPool>();

            CreatePool(DefaultPoolName);
        }
        protected IPool InitPool(int initialSize, int maxSize)
        {
            if (!Kernel.HasComponent(typeof(IPoolFactory)))
            {
                Kernel.AddComponent("castle.internal.poolfactory", typeof(IPoolFactory), typeof(DefaultPoolFactory));
            }

            IPoolFactory factory = Kernel[typeof(IPoolFactory)] as IPoolFactory;

            return(factory.Create(initialSize, maxSize, ComponentActivator));
        }
Exemplo n.º 7
0
        protected override void OnSingletonAwake()
        {
            DontDestroyOnLoad(this);

            _poolFactory = badPool ? (IPoolFactory) new BadPoolFactory() : new ObjectPoolFactory();

            ExplosionEffectPools = new List <IPool <SimpleParticle> >();

            foreach (var effect in explosionEffects)
            {
                ExplosionEffectPools.Add(_poolFactory.CreatePool(transform, effect, poolSizeOnEffect, fillAtStart, expandable));
            }

            DamageScreenPool = _poolFactory.CreatePool(transform, damageScreen, poolSizeOnEffect, fillAtStart, expandable);
        }
Exemplo n.º 8
0
 /// <summary>
 /// Create a pool to use.
 /// </summary>
 /// <param name="size">The size of the pool.</param>
 /// <returns>A valid pool that can be used.</returns>
 protected virtual IObjectPool CreatePool(IPoolFactory poolFactory)
 {
     return(poolFactory.CreatePool(this));
 }
Exemplo n.º 9
0
 /// <summary>
 /// Constructs a channelpoolmanager.
 /// </summary>
 /// <param name="factory">The channel factory to use.</param>
 public ChannelPoolManager(ICanCreateChannels <TChannel> factory, IPoolFactory poolFactory)
     : base(factory)
 {
     Pool = CreatePool(poolFactory);
 }
Exemplo n.º 10
0
 /// <summary>
 /// Constructs a channelpoolmanager.
 /// </summary>
 /// <param name="endpointConfigurationName">The name of the endpoint in your system.Servicemodel section.</param>
 public ChannelPoolManager(string endpointConfigurationName, IPoolFactory poolFactory)
     : base(endpointConfigurationName)
 {
     Pool = CreatePool(poolFactory);
 }
Exemplo n.º 11
0
 public PoolService(IActiveObjectsCollection <T> activeObjects, IPoolFactory poolFactory)
 {
     _activeObjects = activeObjects;
     _pool          = poolFactory.MakePool(this);
 }
Exemplo n.º 12
0
 public PoolManager(IPoolFactory poolFactory, IPoolConfigFactory poolConfigFactory)
 {
     _poolFactory = poolFactory;
     _poolConfigFactory = poolConfigFactory;
 }
Exemplo n.º 13
0
 public ObjectPool(IPoolFactory <T> factory, int maxLenght)
 {
     _factory    = factory;
     Length      = maxLenght;
     _wrapperArr = new Wrapper <T> [Length];
 }