Example #1
0
 static RecyclablePooledFactoriesAndChannels_OpenOnce()
 {
     s_recyclablePooledFactoriesAndChannels = StaticDisposablesHelper.AddDisposable(
         new PoolOfThings <FactoryAndPoolOfItsObjects <ChannelFactory <WcfService1.IService1>, OpenOnceChannelWrapper <WcfService1.IService1> > >(
             maxSize: 3, // # of pooled FactoryAndPoolOfItsObjects
             createInstance: () => new FactoryAndPoolOfItsObjects <ChannelFactory <WcfService1.IService1>, OpenOnceChannelWrapper <WcfService1.IService1> >(
                 createFactoryInstance: () =>
                 TestHelpers.CreateChannelFactory <WcfService1.IService1>(TestHelpers.CreateEndPointAddress(), TestHelpers.CreateBinding()),
                 destroyFactoryInstance: (chf) =>
                 s_CloseFactoryStats.CallActionAndRecordStats(() => TestHelpers.CloseFactory(chf)),
                 maxPooledObjects: 3, // # of pooled channels within each pooled FactoryAndPoolOfItsObjects
                 createObject: (chf) =>
                 s_CreateChannelStats.CallFuncAndRecordStats(func: () => new OpenOnceChannelWrapper <WcfService1.IService1>(TestHelpers.CreateChannel(chf))),
                 destroyObject: (chWr) =>
                 s_CloseChannelStats.CallActionAndRecordStats(action: () => TestHelpers.CloseChannel(chWr.Channel))
                 ),
             destroyInstance: (_fapoic) => _fapoic.Destroy()));
 }
Example #2
0
 public AllPooledInstancesCollection(PoolOfThings <T> thePool)
 {
     _thePool = thePool;
 }