Esempio n. 1
0
 public WaitPoolTest()
 {
     MockInnerPool.Setup(inner => inner.Count).Returns(4);
     MockInnerPool.Setup(inner => inner.Size).Returns(4);
     m_waitPool    = new WaitPool <string>(MockInnerPool.Object, 0);
     DecoratedPool = m_waitPool;
 }
Esempio n. 2
0
 public Client(ConnectionOptions options, Func2 <object, T> createfactory, Action <T> releasefactory)
 {
     Options = options;
     Pool    = new WaitPool <T>(
         new LazyPool <T>(
             new SynchronizedPool <T>(m_sync,
                                      new IdleTimeoutPool <T>(m_sync,
                                                              new StackPool <T>(String.Concat("Client ", options.Name), options.MaxPoolSize),
                                                              releasefactory, options.IdleTimeout, options.LeaseTimeout),
                                      options.PoolAccessTimeout),
             createfactory, releasefactory),
         options.PoolWaitTimeout);
 }
Esempio n. 3
0
        public SymmetricAlgorithmContextPool(SymmetricAlgorithmOptions options, ISymmetricAlgorithmProvider provider)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            if (provider == null)
            {
                throw new ArgumentNullException("provider");
            }

            m_options  = options;
            m_provider = provider;
            Pool       = new WaitPool <ISymmetricAlgorithmContext>(
                new LazyPool <ISymmetricAlgorithmContext>(
                    new SynchronizedPool <ISymmetricAlgorithmContext>(m_sync,
                                                                      new StackPool <ISymmetricAlgorithmContext>(String.Concat("SymmetricAlgorithm ", options.Name), options.MaxPoolSize),
                                                                      options.PoolAccessTimeout),
                    CreateFactory, ReleaseFactory),
                options.PoolWaitTimeout);
        }