Beispiel #1
0
        private static EnhancedServiceParams BuildBaseParams(string connectionString, int poolSize,
                                                             PoolParams poolParams       = null, ConnectionParams connectionParams = null,
                                                             CachingParams cachingParams = null)
        {
            var parameters =
                new EnhancedServiceParams
            {
                ConnectionParams = connectionParams ?? new ConnectionParams {
                    ConnectionString = connectionString
                },
                PoolParams = poolParams ?? new PoolParams {
                    PoolSize = poolSize
                }
            };

            if (cachingParams != null)
            {
                parameters.IsCachingEnabled = true;
                parameters.CachingParams    = cachingParams;
            }

            if (AutoSetMaxPerformanceParams)
            {
                parameters.AutoSetMaxPerformanceParams();
            }

            return(parameters);
        }
 public EnhancedServicePool(EnhancedServiceFactory <TServiceInterface, TEnhancedOrgService> factory, int poolSize)
 {
     this.factory = factory;
     poolParams   = new PoolParams {
         PoolSize = poolSize
     };
 }
Beispiel #3
0
        public EmptyNodesPool(PoolParams poolParams)
        {
            this.poolParams = poolParams;

            for (int i = 0; i < poolParams.PreloadedInstances; i++)
            {
                Push(Create());
            }
        }
        public static void SetPerformanceParams(PoolParams parameters)
        {
            parameters.Require(nameof(parameters));

            if (parameters.DotNetSetMinAppReservedThreads.HasValue)
            {
                var minThreads = parameters.DotNetSetMinAppReservedThreads.Value;
                ThreadPool.SetMinThreads(minThreads, minThreads);
            }
        }
Beispiel #5
0
        public SingleTypePool(PoolParams poolParams)
        {
            this.poolParams = poolParams;
            emptyNodesPool  = new EmptyNodesPool(poolParams);

            for (int i = 0; i < poolParams.PreloadedInstances; i++)
            {
                Push(Create());
            }
        }
        public EnhancedServicePool(EnhancedServiceFactory <TServiceInterface, TEnhancedOrgService> factory, PoolParams poolParams = null)
        {
            this.factory = factory;

            if (poolParams != null)
            {
                poolParams.IsLocked = true;
            }

            this.poolParams = poolParams ?? factory.Parameters?.PoolParams ?? new PoolParams();
        }
Beispiel #7
0
 public void OnConstruct()
 {
     // DebugUtils.Log("PoolStorageView.OnConstruct()");
     for (int i = 0; i < poolsParams.Length; ++i)
     {
         PoolParams poolParams       = poolsParams[i];
         var        instanceProvider = new ViewInstanceProvider(
             poolParams.ViewProto, instantiator, instanceContainer);
         var pool = new Pool <PoolableView>(instanceProvider,
                                            poolParams.InitialSize);
         poolsMap.Add(poolParams.ViewProto.PoolId, pool);
     }
 }
Beispiel #8
0
        public static IEnhancedServicePool <ICachingOrgService> GetPoolCaching(ConnectionParams connectionParams, PoolParams poolParams,
                                                                               CachingParams cachingParams = null)
        {
            var parameters = BuildBaseParams(string.Empty, 2, null, connectionParams,
                                             cachingParams ?? new CachingParams());
            var factory = new EnhancedServiceFactory <ICachingOrgService, CachingOrgService>(parameters);

            return(new EnhancedServicePool <ICachingOrgService, CachingOrgService>(factory, poolParams));
        }
Beispiel #9
0
 public DefaultServicePool(string connectionString, PoolParams poolParams = null)
     : this(new ConnectionParams {
     ConnectionString = connectionString
 }, poolParams)
 {
 }
Beispiel #10
0
        public static IEnhancedServicePool <IEnhancedOrgService> GetPool(ConnectionParams connectionParams, PoolParams poolParams)
        {
            var parameters = BuildBaseParams(string.Empty, 2, poolParams, connectionParams);
            var factory    = new EnhancedServiceFactory <IEnhancedOrgService, Services.Enhanced.EnhancedOrgService>(parameters);

            return(new EnhancedServicePool <IEnhancedOrgService, Services.Enhanced.EnhancedOrgService>(factory, poolParams));
        }
Beispiel #11
0
 public static IEnhancedServicePool <ICachingOrgService> GetCachingPool(string connectionString, PoolParams poolParams,
                                                                        CachingParams cachingParams = null)
 {
     connectionString.RequireFilled(nameof(connectionString));
     poolParams.Require(nameof(poolParams));
     return(GetCachingPool(BuildBaseParams(connectionString, null, poolParams,
                                           cachingParams: cachingParams ?? new CachingParams())));
 }
Beispiel #12
0
 public static IEnhancedServicePool <ICachingOrgService> GetCachingPool(ConnectionParams connectionParams, PoolParams poolParams,
                                                                        CachingParams cachingParams = null)
 {
     connectionParams.Require(nameof(connectionParams));
     poolParams.Require(nameof(poolParams));
     return(GetCachingPool(BuildBaseParams(null, null, poolParams, connectionParams,
                                           cachingParams ?? new CachingParams())));
 }
Beispiel #13
0
 public static IEnhancedServicePool <IEnhancedOrgService> GetPool(ConnectionParams connectionParams, PoolParams poolParams)
 {
     connectionParams.Require(nameof(connectionParams));
     poolParams.Require(nameof(poolParams));
     return(GetPool(BuildBaseParams(null, null, poolParams, connectionParams)));
 }
Beispiel #14
0
 public static IEnhancedServicePool <IEnhancedOrgService> GetPool(string connectionString, PoolParams poolParams)
 {
     connectionString.RequireFilled(nameof(connectionString));
     poolParams.Require(nameof(poolParams));
     return(GetPool(BuildBaseParams(connectionString, null, poolParams)));
 }
Beispiel #15
0
 /// <summary>
 /// Instantiates the <see cref="FakeNativeMemoryChunkPool"/>.
 /// </summary>
 public FakeNativeMemoryChunkPool(PoolParams poolParams) : base(
         new MockMemoryTrimmableRegistry(),
         poolParams,
         new MockPoolStatsTracker())
 {
 }
Beispiel #16
0
 public DefaultServicePool(ConnectionParams connectionParams, PoolParams poolParams = null)
     : base(new ServiceFactory(connectionParams, poolParams?.TokenExpiryCheck), poolParams)
 {
 }
Beispiel #17
0
 public DefaultServicePool(IServiceFactory <IOrganizationService> factory, PoolParams poolParams = null)
     : base(factory, poolParams)
 {
 }