Exemplo n.º 1
0
 static RecyclablePooledFactories()
 {
     s_recyclablePooledChannelFactories = StaticDisposablesHelper.AddDisposable(
         new PoolOfThings <ChannelFactory <WcfService1.IService1> >(
             maxSize: 10,
             createInstance: () =>
             TestHelpers.CreateChannelFactory <WcfService1.IService1>(TestHelpers.CreateEndPointAddress(), TestHelpers.CreateBinding()),
             destroyInstance: (chf) =>
             s_CloseFactoryStats.CallActionAndRecordStats(() => TestHelpers.CloseFactory(chf))));
 }
Exemplo n.º 2
0
 static PooledFactoriesAndChannels()
 {
     s_pooledFactoriesAndChannels = StaticDisposablesHelper.AddDisposable(
         new PoolOfThings <FactoryAndPoolOfItsObjects <ChannelFactory <WcfService1.IService1>, WcfService1.IService1> >(
             maxSize: 3, // # of pooled FactoryAndPoolOfItsObjects
             createInstance: () => new FactoryAndPoolOfItsObjects <ChannelFactory <WcfService1.IService1>, 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(TestHelpers.CreateChannel, chf),
                 destroyObject: (ch) =>
                 s_CloseChannelStats.CallActionAndRecordStats(() => TestHelpers.CloseChannel(ch))
                 ),
             destroyInstance: (_fapoic) => _fapoic.Destroy()));
 }
Exemplo n.º 3
0
 static RecyclablePooledFactoriesAndChannelsAsync_OpenOnce()
 {
     s_recyclablePooledFactoriesAndChannels = StaticDisposablesHelper.AddDisposable(
         new PoolOfAsyncThings <
             FactoryAndPoolOfItsAsyncObjects <ChannelFactory <WcfService1.IService1>, OpenAsyncOnceChannelWrapper <WcfService1.IService1> > >(
             maxSize: 3, // # of pooled FactoryAndPoolOfItsChannels
             createInstance: () => new FactoryAndPoolOfItsAsyncObjects <ChannelFactory <WcfService1.IService1>, OpenAsyncOnceChannelWrapper <WcfService1.IService1> >(
                 createFactoryInstance: () =>
                 TestHelpers.CreateChannelFactory <WcfService1.IService1>(TestHelpers.CreateEndPointAddress(), TestHelpers.CreateBinding()),
                 destroyFactoryInstanceAsync: async(chf) =>
                 await s_CloseFactoryStats.CallAsyncFuncAndRecordStatsAsync(TestHelpers.CloseFactoryAsync, chf),
                 maxPooledObjects: 3, // # of pooled channels within each pooled FactoryAndPoolOfItsAsyncObjects
                 createObject: (chf) =>
                 s_CreateChannelStats.CallFuncAndRecordStats(func: () => new OpenAsyncOnceChannelWrapper <WcfService1.IService1>(TestHelpers.CreateChannel(chf))),
                 destroyObjectAsync: async(chWr) =>
                 await s_CloseChannelStats.CallAsyncFuncAndRecordStatsAsync(func: () => TestHelpers.CloseChannelAsync(chWr.Channel))
                 ),
             destroyInstanceAsync: async(_fapoic) => await _fapoic.DestroyAsync()));
 }