Esempio n. 1
0
        /// <summary>
        /// Same as <see cref="DirectSchedulerFactory.CreateRemoteScheduler(string)" />,
        /// with the addition of specifying the scheduler name and instance ID. This
        /// scheduler can only be retrieved via <see cref="DirectSchedulerFactory.GetScheduler(string)" />.
        /// </summary>
        /// <param name="schedulerName">The name for the scheduler.</param>
        /// <param name="schedulerInstanceId">The instance ID for the scheduler.</param>
        /// <param name="proxyAddress"></param>
        /// <throws>  SchedulerException </throws>
        protected virtual void CreateRemoteScheduler(string schedulerName, string schedulerInstanceId, string proxyAddress)
        {
            string uid = QuartzSchedulerResources.GetUniqueIdentifier(schedulerName, schedulerInstanceId);

            var proxyBuilder = new RemotingSchedulerProxyFactory();

            proxyBuilder.Address = proxyAddress;
            RemoteScheduler remoteScheduler = new RemoteScheduler(uid, proxyBuilder);

            SchedulerRepository schedRep = SchedulerRepository.Instance;

            schedRep.Bind(remoteScheduler);
            initialized = true;
        }
Esempio n. 2
0
        public static RemoteScheduler GetRemoteScheduler()
        {
            RemoteScheduler scheduler = null;

            try
            {
                RemotingSchedulerProxyFactory rcpf = new RemotingSchedulerProxyFactory();
                rcpf.Address = "tcp://localhost:" + tcpPort + "/QuartzScheduler";
                scheduler    = new RemoteScheduler(InstanceName, rcpf);
            }
            catch (Exception ex)
            {
                _logger.ErrorFormat("远程获取JOB实例异常:" + ex.InnerException);
            }
            return(scheduler);
        }