美文网首页
Quartz初始化源码跟踪(3)

Quartz初始化源码跟踪(3)

作者: 丁钰铭 | 来源:发表于2019-02-24 13:15 被阅读0次

    正式初始化QuartzScheduler
    调度器接口及实现如下


    Scheduler

    StdScheduler 默认的调度器,其实就是QuartzScheduler类的包装。

    QuartzScheduler 核心类

    ExecutingJobsManagerjobMgr=null;

    ErrorLoggererrLogger=null;

    privateSchedulerSignalersignaler;

    1.构造方法

    public QuartzScheduler(QuartzSchedulerResources resources,longidleWaitTime,@Deprecated long dbRetryInterval)
    throwsSchedulerException{
        //配置资源
        this.resources = resources;
        if(resources.getJobStore() instanceof JobListener){
            addInternalJobListener((JobListener)resources.getJobStore());
        }
    
        //构造调度线程...核心线程!!!
        this.schedThread = new QuartzSchedulerThread(this,resources);
        ThreadExecutor schedThreadExecutor = resources.getThreadExecutor();
        schedThreadExecutor.execute(this.schedThread);
        if(idleWaitTime>0){
            this.schedThread.setIdleWaitTime(idleWaitTime);
        }
        
        jobMgr = new ExecutingJobsManager();
        addInternalJobListener(jobMgr);
        errLogger=newErrorLogger();
        add InternalSchedulerListener(errLogger);
        
        signaler = new SchedulerSignalerImpl(this,this.schedThread);
        
        if(shouldRunUpdateCheck())
            updateTimer=scheduleUpdateCheck();
        else
            updateTimer=null;
        
        getLog().info("QuartzSchedulerv."+getVersion()+"created.");
    }
    

    初始化
    bind 绑定rmi调用
    registerJMX 注册JMX

    相关文章

      网友评论

          本文标题:Quartz初始化源码跟踪(3)

          本文链接:https://www.haomeiwen.com/subject/tggvyqtx.html