public ObjectPool(int initialStock, IPoolFactory <T> factory) { _initialStock = initialStock; _factory = factory; _stack = new List <T>(); CreateStock(); }
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(); }
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)); }
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); }
/// <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)); }
/// <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); }
/// <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); }
public PoolService(IActiveObjectsCollection <T> activeObjects, IPoolFactory poolFactory) { _activeObjects = activeObjects; _pool = poolFactory.MakePool(this); }
public PoolManager(IPoolFactory poolFactory, IPoolConfigFactory poolConfigFactory) { _poolFactory = poolFactory; _poolConfigFactory = poolConfigFactory; }
public ObjectPool(IPoolFactory <T> factory, int maxLenght) { _factory = factory; Length = maxLenght; _wrapperArr = new Wrapper <T> [Length]; }