Quartz

public Result save(QuartzBean quartz) {
        LOGGER.info("");
        try {
            if (quartz.getOldJobGroup() != null) {
                JobKey key = new JobKey(quartz.getOldJobName(), quartz.getOldJobGroup());
                scheduler.deleteJob(key);
            }
            Class cls = Class.forName(quartz.getJobClassName());
            cls.newInstance();
            JobDetail job = JobBuilder.newJob(cls).withIdentity(quartz.getJobName(),
                    quartz.getJobGroup())
                    .withDescription(quartz.getDescription()).build();
            CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(quartz.getCronExpression());
            Trigger trigger = TriggerBuilder.newTrigger().withIdentity("trigger" + quartz.getJobName(), quartz.getJobGroup())
                    .startNow().withSchedule(cronScheduleBuilder).build();
            scheduler.scheduleJob(job, trigger);
        } catch (Exception e) {
            e.printStackTrace();
            return Result.error();
        }
        return Result.ok();
    }

Let me first declare that I am a beginner in quartz, but when integrating springboot, I found that it can be added to the database qrtz_cron_triggers and qrtz_job_details table by adjusting this new interface. I used druid to monitor and did not monitor the SQL statement. Is quartz operating the database itself? Is there a big god to help me

Apr.05,2021

Yes, quartz has a complex configuration file. When the configuration uses the database and the database jdbc parameters are specified correctly, quargz will save the job to the database itself, and it can even be configured as cluster. If you look up the configuration file of quartz under your classpath, you can generally see that this is what you do:

org.quartz.dataSource.quartzDataSource.driver = com.mysql.jdbc.Driver
org.quartz.dataSource.quartzDataSource.URL = jdbc:mysql://localhost:3306/db
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1c2456b-336fe.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1c2456b-336fe.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?