Esempio n. 1
0
        /// <summary>
        /// Returns a handle to the Scheduler produced by this factory.
        /// </summary>
        /// <remarks>
        /// If one of the <see cref="Initialize()" /> methods has not be previously
        /// called, then the default (no-arg) <see cref="Initialize()" /> method
        /// will be called by this method.
        /// </remarks>
        public virtual IScheduler GetScheduler()
        {
            Log.Error("GetSchedulerstars");
            if (cfg == null)
            {
                Initialize();
            }

            SchedulerRepository schedRep = SchedulerRepository.Instance;

            IScheduler sched = schedRep.Lookup(SchedulerName);

            if (sched != null)
            {
                if (sched.IsShutdown)
                {
                    schedRep.Remove(SchedulerName);
                }
                else
                {
                    return(sched);
                }
            }
            sched = Instantiate();

            return(sched);
        }
Esempio n. 2
0
        /// <summary>
        /// Returns a handle to the Scheduler produced by this factory.
        /// </summary>
        /// <remarks>
        /// If one of the <see cref="Initialize()" /> methods has not be previously
        /// called, then the default (no-arg) <see cref="Initialize()" /> method
        /// will be called by this method.
        /// </remarks>
        public virtual async Task <IScheduler> GetScheduler(CancellationToken cancellationToken = default)
        {
            if (cfg == null)
            {
                Initialize();
            }

            SchedulerRepository schedRep = SchedulerRepository.Instance;

            IScheduler?sched = await schedRep.Lookup(SchedulerName, cancellationToken).ConfigureAwait(false);

            if (sched != null)
            {
                if (sched.IsShutdown)
                {
                    schedRep.Remove(SchedulerName);
                }
                else
                {
                    return(sched);
                }
            }

            sched = await Instantiate().ConfigureAwait(false);

            return(sched !);
        }
Esempio n. 3
0
        /// <summary>
        /// Returns a handle to the Scheduler with the given name, if it exists.
        /// </summary>
        public virtual Task <IScheduler> GetScheduler(
            string schedName,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            SchedulerRepository schedRep = SchedulerRepository.Instance;

            return(schedRep.Lookup(schedName, cancellationToken));
        }
Esempio n. 4
0
        /// <summary>
        /// Returns a handle to the Scheduler produced by this factory.
        /// <p>
        /// you must call createRemoteScheduler or createScheduler methods before
        /// calling getScheduler()
        /// </p>
        /// </summary>
        /// <returns></returns>
        /// <throws>  SchedulerException </throws>
        public virtual IScheduler GetScheduler()
        {
            if (!initialized)
            {
                throw new SchedulerException(
                          "you must call createRemoteScheduler or createScheduler methods before calling getScheduler()");
            }
            SchedulerRepository schedRep = SchedulerRepository.Instance;

            return(schedRep.Lookup(DefaultSchedulerName));
        }
Esempio n. 5
0
        /// <summary>
        /// Returns a handle to the Scheduler produced by this factory.
        /// <para>
        /// you must call createRemoteScheduler or createScheduler methods before
        /// calling getScheduler()
        /// </para>
        /// </summary>
        /// <returns></returns>
        /// <throws>  SchedulerException </throws>
        public virtual Task <IScheduler> GetScheduler(CancellationToken cancellationToken = default)
        {
            if (!initialized)
            {
                throw new SchedulerException(
                          "you must call createRemoteScheduler or createScheduler methods before calling getScheduler()");
            }
            SchedulerRepository schedRep = SchedulerRepository.Instance;

            return(schedRep.Lookup(DefaultSchedulerName, cancellationToken) !);
        }
Esempio n. 6
0
        /// <summary>
        /// Returns a handle to the Scheduler with the given name, if it exists.
        /// </summary>
        public virtual IScheduler GetScheduler(string schedName)
        {
            SchedulerRepository schedRep = SchedulerRepository.Instance;

            return(schedRep.Lookup(schedName));
        }