コード例 #1
0
        public MultiTenantRunspaceProvider(
            ILoggerFactory loggerFactory,
            IRunspaceProvider runspaceProvider,
            int maxNumberOfRunspaces,
            int maxRunspaceIdleTimeMinutes,
            int maxRunspaceActiveTimeMinutes,
            IRunspacesStatsMonitor runspacesStatsMonitor = null)
        {
            if (runspaceProvider == null)
            {
                throw new ArgumentNullException(nameof(runspaceProvider));
            }

            _runspaceProvider = runspaceProvider;
            _logger           = loggerFactory.CreateLogger(typeof(MultiTenantRunspaceProvider).FullName);

            _logger.LogDebug("Runspace Provider Settings:");
            _logger.LogDebug($"   MaxNumberOfRunspaces: {maxNumberOfRunspaces}");
            _logger.LogDebug($"   MaxRunspaceIdleTimeMinutes: {maxRunspaceIdleTimeMinutes}");
            _logger.LogDebug($"   MaxRunspaceActiveTimeMinutes: {maxRunspaceActiveTimeMinutes}");

            if (runspacesStatsMonitor == null)
            {
                _runspacesStatsMonitor = new RunspacesStatsMonitor(
                    maxNumberOfRunspaces,
                    maxRunspaceIdleTimeMinutes,
                    maxRunspaceActiveTimeMinutes);
            }
            else
            {
                _runspacesStatsMonitor = runspacesStatsMonitor;
            }

            _runspacesCleanupTimer = new Timer(
                CleanupTimerCallback,
                null,
                30 * 1000,
                60 * 1000);
        }
コード例 #2
0
 public MultiTenantRunspaceProvider(ILoggerFactory loggerFactory, IRunspaceProvider runspaceProvider) :
     this(loggerFactory, runspaceProvider, Int32.MaxValue, 24 * 60, 24 * 60)
 {
 }