Exemplo n.º 1
0
 public CallbackThreadPoolBehaviorAttribute(uint poolSize, Type clientType, string poolName) : base(poolSize, clientType, poolName)
 {
     AppDomain.CurrentDomain.ProcessExit += delegate
     {
         ThreadPoolHelper.CloseThreads(ServiceType);
     };
 }
 void IServiceBehavior.Validate(ServiceDescription description, ServiceHostBase serviceHostBase)
 {
     serviceHostBase.Closed += delegate
     {
         ThreadPoolHelper.CloseThreads(ServiceType);
     };
 }
 void IContractBehavior.ApplyDispatchBehavior(ContractDescription description, ServiceEndpoint endpoint, DispatchRuntime dispatchRuntime)
 {
     PoolName = PoolName ?? "Pool executing endpoints of " + ServiceType;
     lock (typeof(ThreadPoolHelper))
     {
         ThreadPoolHelper.ApplyDispatchBehavior(ProvideSynchronizer(), PoolSize, ServiceType, PoolName, dispatchRuntime);
     }
 }
 protected virtual ThreadPoolSynchronizer ProvideSynchronizer()
 {
     if (ThreadPoolHelper.HasSynchronizer(ServiceType) == false)
     {
         return(new ThreadPoolSynchronizer(PoolSize, PoolName));
     }
     else
     {
         return(ThreadPoolHelper.GetSynchronizer(ServiceType));
     }
 }
Exemplo n.º 5
0
 protected override ThreadPoolSynchronizer ProvideSynchronizer()
 {
     if (ThreadPoolHelper.HasSynchronizer(ServiceType) == false)
     {
         return(new PrioritySynchronizer(PoolSize, PoolName));
     }
     else
     {
         return(ThreadPoolHelper.GetSynchronizer(ServiceType));
     }
 }