Пример #1
0
 public DualChannelListener(IThreadPool threadPool)
 {
     _threadPool = threadPool;
     if (_threadPool != null)
     {
         _threadPool.Initialize();
     }
 }
Пример #2
0
 public ClientSessionManager(IDatabaseEngineFactory databaseEngineFactory)
 {
     _databaseEngineFactory = databaseEngineFactory;
     _clientSessions        = new HashVector <string, ClientSession>();
     SetLocalAddress();
     _traceProvider    = new TraceProvider();
     _channelFormatter = new DbEngineFormatter();
     _threadPool       = new ClrThreadPool();
     _threadPool.Initialize();
 }
Пример #3
0
        public ServerChannel(IConnection connection, string peerIP, int peerPort, string bindingIP, SessionTypes sessionType, ITraceProvider traceProvider, IChannelFormatter channelFormatter)
        {
            tcpChannel           = new TcpChannel(connection, peerIP, peerPort, bindingIP, traceProvider);
            tcpChannel.Formatter = channelFormatter;
            peerAddress          = new Address(peerIP, peerPort);
            tcpChannel.RegisterEventListener(this);

            _threadPool = new ClrThreadPool();
            _threadPool.Initialize();
        }
Пример #4
0
        public ConfigurationChangeTask(IConfigurationListener changeListener, NodeContext context)
        {
            this.configSession = context.ConfigurationSession;
            this.listener      = changeListener;
            this.context       = context;

            _threadPool = new ClrThreadPool();

            _threadPool.Initialize();
        }
Пример #5
0
        /// <summary>
        /// Creates a scheduler using the specified thread pool and job store and
        /// binds it for remote access.
        /// </summary>
        /// <param name="schedulerName">The name for the scheduler.</param>
        /// <param name="schedulerInstanceId">The instance ID for the scheduler.</param>
        /// <param name="threadPool">The thread pool for executing jobs</param>
        /// <param name="threadExecutor">Thread executor.</param>
        /// <param name="jobStore">The type of job store</param>
        /// <param name="schedulerPluginMap"></param>
        /// <param name="idleWaitTime">The idle wait time. You can specify TimeSpan.Zero for
        /// the default value, which is currently 30000 ms.</param>
        /// <param name="dbFailureRetryInterval">The db failure retry interval.</param>
        /// <param name="maxBatchSize">The maximum batch size of triggers, when acquiring them</param>
        /// <param name="batchTimeWindow">The time window for which it is allowed to "pre-acquire" triggers to fire</param>
        public virtual void CreateScheduler(string schedulerName, string schedulerInstanceId, IThreadPool threadPool, IThreadExecutor threadExecutor,
                                            IJobStore jobStore, IDictionary<string, ISchedulerPlugin> schedulerPluginMap, TimeSpan idleWaitTime,
                                            TimeSpan dbFailureRetryInterval, int maxBatchSize, TimeSpan batchTimeWindow)
        {
            // Currently only one run-shell factory is available...
            IJobRunShellFactory jrsf = new StdJobRunShellFactory();

            // Fire everything u
            // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            threadPool.Initialize();

            QuartzSchedulerResources qrs = new QuartzSchedulerResources();

            qrs.Name = schedulerName;
            qrs.InstanceId = schedulerInstanceId;

            SchedulerDetailsSetter.SetDetails(threadPool, schedulerName, schedulerInstanceId);

            qrs.JobRunShellFactory = jrsf;
            qrs.ThreadPool = threadPool;
            qrs.ThreadExecutor= threadExecutor;
            qrs.JobStore = jobStore;
            qrs.MaxBatchSize = maxBatchSize;
            qrs.BatchTimeWindow = batchTimeWindow;

            // add plugins
            if (schedulerPluginMap != null)
            {
                foreach (ISchedulerPlugin plugin in schedulerPluginMap.Values)
                {
                    qrs.AddSchedulerPlugin(plugin);
                }
            }

            QuartzScheduler qs = new QuartzScheduler(qrs, idleWaitTime, dbFailureRetryInterval);

            ITypeLoadHelper cch = new SimpleTypeLoadHelper();
            cch.Initialize();

            SchedulerDetailsSetter.SetDetails(jobStore, schedulerName, schedulerInstanceId);
            jobStore.Initialize(cch, qs.SchedulerSignaler);

            IScheduler scheduler = new StdScheduler(qs);

            jrsf.Initialize(scheduler);

            qs.Initialize();

            // Initialize plugins now that we have a Scheduler instance.
            if (schedulerPluginMap != null)
            {
                foreach (var pluginEntry in schedulerPluginMap)
                {
                    pluginEntry.Value.Initialize(pluginEntry.Key, scheduler);
                }
            }

            Log.Info(string.Format(CultureInfo.InvariantCulture, "Quartz scheduler '{0}", scheduler.SchedulerName));

            Log.Info(string.Format(CultureInfo.InvariantCulture, "Quartz scheduler version: {0}", qs.Version));

            SchedulerRepository schedRep = SchedulerRepository.Instance;

            qs.AddNoGCObject(schedRep); // prevents the repository from being
            // garbage collected

            schedRep.Bind(scheduler);

            initialized = true;
        }
Пример #6
0
        /// <summary>
        /// Creates a scheduler using the specified thread pool and job store and
        /// binds it for remote access.
        /// </summary>
        /// <param name="schedulerName">The name for the scheduler.</param>
        /// <param name="schedulerInstanceId">The instance ID for the scheduler.</param>
        /// <param name="threadPool">The thread pool for executing jobs</param>
        /// <param name="jobStore">The type of job store</param>
        /// <param name="schedulerPluginMap"></param>
        /// <param name="idleWaitTime">The idle wait time. You can specify TimeSpan.Zero for
        /// the default value, which is currently 30000 ms.</param>
        /// <param name="dbFailureRetryInterval">The db failure retry interval.</param>
        public virtual void CreateScheduler(string schedulerName, string schedulerInstanceId, IThreadPool threadPool,
                                            IJobStore jobStore, IDictionary <string, ISchedulerPlugin> schedulerPluginMap, TimeSpan idleWaitTime,
                                            TimeSpan dbFailureRetryInterval)
        {
            // Currently only one run-shell factory is available...
            IJobRunShellFactory jrsf = new StdJobRunShellFactory();

            // Fire everything up
            // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            threadPool.Initialize();

            QuartzSchedulerResources qrs = new QuartzSchedulerResources();

            qrs.Name       = schedulerName;
            qrs.InstanceId = schedulerInstanceId;

            SchedulerDetailsSetter.SetDetails(threadPool, schedulerName, schedulerInstanceId);

            qrs.JobRunShellFactory = jrsf;
            qrs.ThreadPool         = threadPool;
            qrs.JobStore           = jobStore;


            // add plugins
            if (schedulerPluginMap != null)
            {
                foreach (ISchedulerPlugin plugin in schedulerPluginMap.Values)
                {
                    qrs.AddSchedulerPlugin(plugin);
                }
            }

            QuartzScheduler qs = new QuartzScheduler(qrs, idleWaitTime, dbFailureRetryInterval);

            ITypeLoadHelper cch = new SimpleTypeLoadHelper();

            cch.Initialize();

            SchedulerDetailsSetter.SetDetails(jobStore, schedulerName, schedulerInstanceId);
            jobStore.Initialize(cch, qs.SchedulerSignaler);

            IScheduler scheduler = new StdScheduler(qs);

            jrsf.Initialize(scheduler);

            qs.Initialize();

            // Initialize plugins now that we have a Scheduler instance.
            if (schedulerPluginMap != null)
            {
                foreach (var pluginEntry in schedulerPluginMap)
                {
                    pluginEntry.Value.Initialize(pluginEntry.Key, scheduler);
                }
            }

            Log.Info(string.Format(CultureInfo.InvariantCulture, "Quartz scheduler '{0}", scheduler.SchedulerName));

            Log.Info(string.Format(CultureInfo.InvariantCulture, "Quartz scheduler version: {0}", qs.Version));

            SchedulerRepository schedRep = SchedulerRepository.Instance;

            qs.AddNoGCObject(schedRep);             // prevents the repository from being
            // garbage collected

            schedRep.Bind(scheduler);

            initialized = true;
        }
Пример #7
0
        /// <summary>
        /// Creates a scheduler using the specified thread pool and job store and
        /// binds it for remote access.
        /// </summary>
        /// <param name="schedulerName">The name for the scheduler.</param>
        /// <param name="schedulerInstanceId">The instance ID for the scheduler.</param>
        /// <param name="threadPool">The thread pool for executing jobs</param>
        /// <param name="threadExecutor">Thread executor.</param>
        /// <param name="jobStore">The type of job store</param>
        /// <param name="schedulerPluginMap"></param>
        /// <param name="idleWaitTime">The idle wait time. You can specify TimeSpan.Zero for
        /// the default value, which is currently 30000 ms.</param>
        /// <param name="dbFailureRetryInterval">The db failure retry interval.</param>
        /// <param name="maxBatchSize">The maximum batch size of triggers, when acquiring them</param>
        /// <param name="batchTimeWindow">The time window for which it is allowed to "pre-acquire" triggers to fire</param>
        public virtual void CreateScheduler(string schedulerName, string schedulerInstanceId, IThreadPool threadPool, IThreadExecutor threadExecutor,
                                            IJobStore jobStore, IDictionary <string, ISchedulerPlugin> schedulerPluginMap, TimeSpan idleWaitTime,
                                            TimeSpan dbFailureRetryInterval, int maxBatchSize, TimeSpan batchTimeWindow)
        {
            // Currently only one run-shell factory is available...
            IJobRunShellFactory jrsf = new StdJobRunShellFactory();

            // Fire everything u
            // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            threadPool.Initialize();

            QuartzSchedulerResources qrs = new QuartzSchedulerResources();

            qrs.Name       = schedulerName;
            qrs.InstanceId = schedulerInstanceId;

            SchedulerDetailsSetter.SetDetails(threadPool, schedulerName, schedulerInstanceId);

            qrs.JobRunShellFactory = jrsf;
            qrs.ThreadPool         = threadPool;
            qrs.ThreadExecutor     = threadExecutor;
            qrs.JobStore           = jobStore;
            qrs.MaxBatchSize       = maxBatchSize;
            qrs.BatchTimeWindow    = batchTimeWindow;

            // add plugins
            if (schedulerPluginMap != null)
            {
                foreach (ISchedulerPlugin plugin in schedulerPluginMap.Values)
                {
                    qrs.AddSchedulerPlugin(plugin);
                }
            }

            QuartzScheduler qs = new QuartzScheduler(qrs, idleWaitTime, dbFailureRetryInterval);

            ITypeLoadHelper cch = new SimpleTypeLoadHelper();

            cch.Initialize();

            SchedulerDetailsSetter.SetDetails(jobStore, schedulerName, schedulerInstanceId);
            jobStore.Initialize(cch, qs.SchedulerSignaler);

            IScheduler scheduler = new StdScheduler(qs);

            jrsf.Initialize(scheduler);

            qs.Initialize();

            // Initialize plugins now that we have a Scheduler instance.
            if (schedulerPluginMap != null)
            {
                foreach (var pluginEntry in schedulerPluginMap)
                {
                    pluginEntry.Value.Initialize(pluginEntry.Key, scheduler);
                }
            }

            SchedulerService schedRep = SchedulerService.Instance;

            qs.AddNoGCObject(schedRep); // prevents the service from being
            // garbage collected

            schedRep.Bind(scheduler);

            initialized = true;
        }
        /// <summary>
        /// Creates a scheduler using the specified thread pool and job store and
        /// binds it for remote access.
        /// </summary>
        /// <param name="schedulerName">The name for the scheduler.</param>
        /// <param name="schedulerInstanceId">The instance ID for the scheduler.</param>
        /// <param name="threadPool">The thread pool for executing jobs</param>
        /// <param name="jobStore">The type of job store</param>
        /// <param name="schedulerPluginMap"></param>
        /// <param name="idleWaitTime">The idle wait time. You can specify TimeSpan.Zero for
        ///     the default value, which is currently 30000 ms.</param>
        /// <param name="maxBatchSize">The maximum batch size of triggers, when acquiring them</param>
        /// <param name="batchTimeWindow">The time window for which it is allowed to "pre-acquire" triggers to fire</param>
        /// <param name="schedulerExporter">The scheduler exporter to use</param>
        public virtual void CreateScheduler(
            string schedulerName,
            string schedulerInstanceId,
            IThreadPool threadPool,
            IJobStore jobStore,
            IDictionary <string, ISchedulerPlugin> schedulerPluginMap,
            TimeSpan idleWaitTime,
            int maxBatchSize,
            TimeSpan batchTimeWindow,
            ISchedulerExporter schedulerExporter)
        {
            // Currently only one run-shell factory is available...
            IJobRunShellFactory jrsf = new StdJobRunShellFactory();

            // Fire everything up
            // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            SchedulerDetailsSetter.SetDetails(threadPool, schedulerName, schedulerInstanceId);

            threadPool.Initialize();

            QuartzSchedulerResources qrs = new QuartzSchedulerResources
            {
                Name       = schedulerName,
                InstanceId = schedulerInstanceId,

                JobRunShellFactory = jrsf,
                ThreadPool         = threadPool,
                JobStore           = jobStore,
                MaxBatchSize       = maxBatchSize,
                BatchTimeWindow    = batchTimeWindow,
                SchedulerExporter  = schedulerExporter
            };

            // add plugins
            if (schedulerPluginMap != null)
            {
                foreach (ISchedulerPlugin plugin in schedulerPluginMap.Values)
                {
                    qrs.AddSchedulerPlugin(plugin);
                }
            }

            QuartzScheduler qs = new QuartzScheduler(qrs, idleWaitTime);

            ITypeLoadHelper cch = new SimpleTypeLoadHelper();

            cch.Initialize();

            SchedulerDetailsSetter.SetDetails(jobStore, schedulerName, schedulerInstanceId);
            jobStore.Initialize(cch, qs.SchedulerSignaler);

            IScheduler scheduler = new StdScheduler(qs);

            jrsf.Initialize(scheduler);

            qs.Initialize();

            // Initialize plugins now that we have a Scheduler instance.
            if (schedulerPluginMap != null)
            {
                foreach (var pluginEntry in schedulerPluginMap)
                {
                    pluginEntry.Value.Initialize(pluginEntry.Key, scheduler);
                }
            }

            Log.Info($"Quartz scheduler '{scheduler.SchedulerName}");

            Log.Info($"Quartz scheduler version: {qs.Version}");

            SchedulerRepository schedRep = SchedulerRepository.Instance;

            qs.AddNoGCObject(schedRep); // prevents the repository from being
            // garbage collected

            schedRep.Bind(scheduler);

            initialized = true;
        }