Exemplo n.º 1
0
 public SingletonModulePool(IRpcModuleFactory <T> factory, bool allowExclusive = true)
 {
     Factory             = factory;
     _onlyInstance       = factory.Create();
     _onlyInstanceAsTask = Task.FromResult(_onlyInstance);
     _allowExclusive     = allowExclusive;
 }
Exemplo n.º 2
0
        public BoundedModulePool(int capacity, IRpcModuleFactory <T> factory)
        {
            Factory = factory;

            _semaphore = new SemaphoreSlim(capacity);
            for (int i = 0; i < capacity; i++)
            {
                _bag.Add(Factory.Create());
            }
        }
Exemplo n.º 3
0
        public BoundedModulePool(int exclusiveCapacity, IRpcModuleFactory <T> factory)
        {
            Factory = factory;

            _semaphore = new SemaphoreSlim(exclusiveCapacity);
            for (int i = 0; i < exclusiveCapacity; i++)
            {
                _bag.Add(Factory.Create());
            }

            _shared = factory.Create();
        }
Exemplo n.º 4
0
        public BoundedModulePool(IRpcModuleFactory <T> factory, int exclusiveCapacity, int timeout)
        {
            _timeout = timeout;
            Factory  = factory;

            _semaphore = new SemaphoreSlim(exclusiveCapacity);
            for (int i = 0; i < exclusiveCapacity; i++)
            {
                _pool.Enqueue(Factory.Create());
            }

            _shared       = factory.Create();
            _sharedAsTask = Task.FromResult(_shared);
        }
Exemplo n.º 5
0
 public SingletonModulePool(IRpcModuleFactory <T> factory, bool allowExclusive)
 {
     Factory         = factory;
     _onlyInstance   = factory.Create();
     _allowExclusive = allowExclusive;
 }
Exemplo n.º 6
0
 public SingletonModulePool(IRpcModuleFactory <T> factory)
 {
     Factory       = factory;
     _onlyInstance = factory.Create();
 }