ããã¯ããªã«ãããããŠæžãããã®ïŒ
Javaã®ãžã§ãã¹ã±ãžã¥ãŒã©ãŒãšããã°Quartzãæåã ãšæããŸãããããããã°ã¡ãããšè§Šã£ãããšããªãã£ãã®ã§å°ãè©ŠããŠã¿ãããšã«
ããŸããã
Quartz
Quartzã®ãªãã£ã·ã£ã«ãµã€ãã¯ããã¡ãã
Quartz Enterprise Job Scheduler
Quartzãšã¯ãªã«ãïŒãšããããšã§ããããªãã£ã·ã£ã«ãµã€ãã®çŽ¹ä»æãèŠããšããããã£ãããšãæžããŠãããŸãã
- ãªãŒãã³ãœãŒã¹ã®ãžã§ãã¹ã±ãžã¥ãŒãªã³ã°ã©ã€ãã©ãª
- åçŽãªãã®ããè€éãªãã®ãŸã§ãæ°éãæ°çŸããæ°äžã®ãžã§ããå®è¡ããããã®ã¹ã±ãžã¥ãŒã«ãäœæã§ãã
- ãã©ã³ã¶ã¯ã·ã§ã³ãã¯ã©ã¹ã¿ãªã³ã°ã®ãµããŒããæã€
ããå°ãèžã¿èŸŒãã 玹ä»ã¯ããã¡ãã®ããŒãžã«æžãããŠããŸãã
ãžã§ãã®èµ·åã¿ã€ãã³ã°ããžã§ãã®æ°žç¶åãªã©ã«ã€ããŠã觊ããããŠããŸãã
ããã¥ã¡ã³ãã¯ããã¡ãã§ãã
çŸæç¹ã§ã®ææ°å®å®çã¯2.3.2ã®ããã§ãããããã¥ã¡ã³ããšããŠã¯2.3.0ã®ãã®ã§æ¢ãŸã£ãŠãããããªã®ã§ãä»åã¯ãã¡ããèŠãŠããããšã«
ããŸãã
ããã¥ã¡ã³ãã¯ä»¥äžã®ããã«åãããŠããŸãã
- Quick Start Guide
- Configuration Reference
- Cookbook
- Tutorials
- Examples
- Quartz Enterprise Job Scheduler 2.3.0-SNAPSHOT API
Exampleã¯GitHubã®ãªããžããªã«ãå«ãŸããŠããŸãã
Quick Start GuideãTutorialãExamplesã®First Quartz ProgramãšäŒŒããããªå°è±¡ãåããã³ã³ãã³ãããã€ããããŸããã
ãŸãã¯Quick Start Guideããè©ŠããŠããããšæããŸãã
ç°å¢
ä»åã®ç°å¢ã¯ããã¡ãã
$ java --version openjdk 17.0.4 2022-07-19 OpenJDK Runtime Environment (build 17.0.4+8-Ubuntu-120.04) OpenJDK 64-Bit Server VM (build 17.0.4+8-Ubuntu-120.04, mixed mode, sharing) $ mvn --version Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63) Maven home: $HOME/.sdkman/candidates/maven/current Java version: 17.0.4, vendor: Private Build, runtime: /usr/lib/jvm/java-17-openjdk-amd64 Default locale: ja_JP, platform encoding: UTF-8 OS name: "linux", version: "5.4.0-126-generic", arch: "amd64", family: "unix"
æºå
MavenäŸåé¢ä¿ãªã©ã¯ãã¡ãã
<properties> <maven.compiler.source>17</maven.compiler.source> <maven.compiler.target>17</maven.compiler.target> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> </properties> <dependencies> <dependency> <groupId>org.quartz-scheduler</groupId> <artifactId>quartz</artifactId> <version>2.3.2</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-simple</artifactId> <version>1.7.36</version> </dependency> </dependencies>
QuartzãšSLF4J-Simpleã䜿ã£ãŠããŸãã
Quartzã䜿ã£ãããã°ã©ã ãæžããŠã¿ã
ã§ã¯ãQuick Start Guideã«æ²¿ã£ãŠé²ããŠã¿ãŸãããã
å¿ èŠã«å¿ããŠãä»ã®ããã¥ã¡ã³ããåç §ããŠãããŸãã
æåã«ããŠã³ããŒãããŒãžãããã£ã¹ããªãã¥ãŒã·ã§ã³ãããŠã³ããŒãããŠãå±éãããšããããã£ã¬ã¯ããªã«quartz-xxx.jar
ãã¡ã€ã«ããããš
æžãããŠããŸãããå®éã«ã¯ãªããŠlib
ãã£ã¬ã¯ããªã®äžèº«ãèŠãæ¹ãè¯ãããã§ããã
lib
ãã£ã¬ã¯ããªå
ã®ãã¡ã€ã«ã§ããµãŒãããŒãã£è£œã®ãã®ã¯å¿
èŠã«å¿ããŠéžã¶æãã®æžããæ¹ãããŠããŸããããä»åã®ãã¡ã€ã«ã®äžã¯
ãããªæãã§ããã
$ curl -OL http://www.quartz-scheduler.org/downloads/files/quartz-2.3.0-distribution.tar.gz $ tar xf quartz-2.3.0-distribution.tar.gz $ cd quartz-2.3.0-SNAPSHOT $ ll lib åèš 1728 drwxr-xr-x 2 xxxxx xxxxx 4096 10æ 7 01:30 ./ drwxrwxr-x 8 xxxxx xxxxx 4096 10æ 7 01:30 ../ -rwxr-xr-x 1 xxxxx xxxxx 497865 2æ 5 2019 c3p0-0.9.5.2.jar* -rwxr-xr-x 1 xxxxx xxxxx 481535 2æ 5 2019 log4j-1.2.16.jar* -rwxr-xr-x 1 xxxxx xxxxx 693579 2æ 28 2019 quartz-2.3.0-SNAPSHOT.jar* -rwxr-xr-x 1 xxxxx xxxxx 34023 2æ 28 2019 quartz-jobs-2.3.0-SNAPSHOT.jar* -rwxr-xr-x 1 xxxxx xxxxx 29257 2æ 5 2019 slf4j-api-1.7.7.jar* -rwxr-xr-x 1 xxxxx xxxxx 8870 2æ 5 2019 slf4j-log4j12-1.7.7.jar*
ãªãããã®ç¶æ ã®äŸåé¢ä¿ã§
<dependency> <groupId>org.quartz-scheduler</groupId> <artifactId>quartz</artifactId> <version>2.3.2</version> </dependency>
Mavenã®dependency:tree
ã§èŠããš
$ mvn dependency:tree
ãããªããŸãã
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ quartz-getting-started --- [INFO] org.littlewings:quartz-getting-started:jar:0.0.1-SNAPSHOT [INFO] \- org.quartz-scheduler:quartz:jar:2.3.2:compile [INFO] +- com.mchange:c3p0:jar:0.9.5.4:compile [INFO] +- com.mchange:mchange-commons-java:jar:0.2.15:compile [INFO] +- com.zaxxer:HikariCP-java7:jar:2.4.13:compile [INFO] \- org.slf4j:slf4j-api:jar:1.7.7:compile
SLF4Jã§äœ¿ããã®ã³ã°ã©ã€ãã©ãªã ããã¡ãã£ãšè¶³ããªãã§ããããªã®ã§ãSLF4J-Simpleãä»åã¯äœ¿ããŸããã
Quick Start Guidã§ã¯ããŸãããããã£ãã¡ã€ã«ãçšæããŠQuartzã®èšå®ãããããšã«ãªã£ãŠããŸãã
Quartz Quick Start Guide / Configuration
æåã¯ããããã£ãã¡ã€ã«ãçšæãããããã©ã«ãå€ã§å®è¡ããŠã¿ãããšæããŸãã
èšå®ã«é¢ããŠã¯ãªãã¡ã¬ã³ã¹ããã£ããããŠããŠè¯ãã§ããã
次ã«ãJobãå®çŸ©ããŸããQuartzã§ã¯ãJob
ã€ã³ã¿ãŒãã§ãŒã¹ãå®è£
ããã¯ã©ã¹ãäœæããå¿
èŠãããããã§ãã
src/main/java/org/littlewings/quartz/HelloJob.java
package org.littlewings.quartz; import java.time.LocalDateTime; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class HelloJob implements Job { Logger logger = LoggerFactory.getLogger(HelloJob.class); @Override public void execute(JobExecutionContext context) throws JobExecutionException { logger.info("execute job[{}]", LocalDateTime.now()); } }
èµ·åãããçŸåšæéã衚瀺ããã ãã®Job
ã§ãããã®ããã«ããŠå®çŸ©ããJob
ããQuartzã®ã¹ã±ãžã¥ãŒã©ãŒããåŒã³åºãããããšã«
ãªãããã§ãã
Jobã®äœæã«ã€ããŠã¯ãCookbookã«ãèšèŒããããŸãããã¡ãã¯ãJob
ã«ããŒã¿ãæž¡ãæ¹æ³ãæžãããŠããŸããã
Quartz Cookbook / How-To: Defining a Job (with input data)
ãã®ããšã§JobDetail
ãšããŠäœæãããã®ãããJob InstanceããšåŒã¶ã¿ããã§ããã
ãªããQuick Start Guideã«ã¯HelloJob
ãšããã¯ã©ã¹ã¯ååããç»å ŽããŸãããæåŸã«Quartzã®exampleã«å«ãŸããŠããªããžããªã®ãã¹ã
èšèŒããŠããã®ã§ããã¡ããèŠããšããã§ãããã
次ã«main
ã¯ã©ã¹ããã³ã¹ã±ãžã¥ãŒã©ãŒã®å®çŸ©ãè¡ããŸãããã
src/main/java/org/littlewings/quartz/QuartsGettingStarted.java
package org.littlewings.quartz; import java.time.Duration; import java.time.LocalDateTime; import java.time.temporal.ChronoUnit; import java.util.concurrent.TimeUnit; import org.quartz.JobBuilder; import org.quartz.JobDetail; import org.quartz.Scheduler; import org.quartz.SchedulerException; import org.quartz.SimpleScheduleBuilder; import org.quartz.Trigger; import org.quartz.TriggerBuilder; import org.quartz.impl.StdSchedulerFactory; public class QuartsGettingStarted { public static void main(String... args) { Scheduler scheduler = null; try { scheduler = StdSchedulerFactory.getDefaultScheduler(); JobDetail helloJob = JobBuilder .newJob(HelloJob.class) .withIdentity("helloJob", "job-group1") .build(); Trigger trigger = TriggerBuilder .newTrigger() .withIdentity("trigger1", "trigger-group1") .withSchedule( SimpleScheduleBuilder .simpleSchedule() .withIntervalInSeconds(3) .repeatForever() ) .build(); scheduler.scheduleJob(helloJob, trigger); scheduler.start(); waitFor(Duration.ofSeconds(30L)); } catch (SchedulerException e) { e.printStackTrace(); } finally { if (scheduler != null) { try { scheduler.shutdown(true); } catch (SchedulerException e) { e.printStackTrace(); } } } } static void waitFor(Duration waitTime) { LocalDateTime startTime = LocalDateTime.now(); while (ChronoUnit.SECONDS.between(startTime, LocalDateTime.now()) < waitTime.toSeconds()) { try { TimeUnit.SECONDS.sleep(3L); } catch (InterruptedException e) { // no-op } } } }
é ã«èª¬æãæžããŠãããŸãã
Scheduler
ã®ååŸã
Scheduler scheduler = null; try { scheduler = StdSchedulerFactory.getDefaultScheduler();
Cookbookã«ãããScheduler
ã®ã€ã³ã¹ã¿ã³ã¹åãšéå§ã®èšè¿°ã¯ãã¡ãã
How-To: Instantiating a Scheduler
Scheduler
ã¯start
ãåŒã³åºãããšã§éå§ããshutdown
ã§åæ¢ããŸãã
scheduler.start(); waitFor(Duration.ofSeconds(30L)); } catch (SchedulerException e) { e.printStackTrace(); } finally { if (scheduler != null) { try { scheduler.shutdown(true); } catch (SchedulerException e) { e.printStackTrace(); } } }
Scheduler#shutdown
ã«ã¯åŒæ°ããããã®ãšãªããã®ããããåŒæ°ãæå®ããªãããŸãã¯false
ãæå®ãããšçŸåšã®Jobã®å®è¡ã®çµäºã
åŸ
ããã«çµäºããããã§ããtrue
ãæå®ãããšãJobã®å®è¡çµäºãåŸ
æ©ãããšã
Cookbookã«ãããScheduler
ã®åæ¢ã®èšè¿°ã¯ãã¡ããå®è¡äžã®Jobã®æ±ããããã¡ãã«æžãããŠããŸãã
How-To: Shutting Down a Scheduler
ã¡ãªã¿ã«ããã®éšåã§ãã
waitFor(Duration.ofSeconds(30L));
ããã«Scheduler
ãshutdown
ããŠããŸããšããã°ã©ã ãçµäºããŠããŸãã®ã§ãæå®ããDuration
ã ãåŸ
æ©ããããã«ããŠããŸãã
ä»åã¯30ç§åŸ
ã€ããšã«ããŸããã
static void waitFor(Duration waitTime) { LocalDateTime startTime = LocalDateTime.now(); while (ChronoUnit.SECONDS.between(startTime, LocalDateTime.now()) < waitTime.toSeconds()) { try { TimeUnit.SECONDS.sleep(3L); } catch (InterruptedException e) { // no-op } } }
Quick Start Guideã§ã¯ãThread#sleep
ã§åŸ
æ©ããããããšããããšæžãããŠããŸããã
(you will also need to allow some time for the job to be triggered and executed before calling shutdown() - for a simple example such as this, you might just want to add a Thread.sleep(60000) call).
JobDetail
ã®äœæãJobBuilder
ã䜿ã£ãŠäœæããŸãã
JobDetail helloJob = JobBuilder .newJob(HelloJob.class) .withIdentity("helloJob", "job-group1") .build();
ãã¡ãã®Cookbookã§ã¯ããã®ãããªJobDetail
ã®äœæããDefining a Job InstanceããšåŒãã§ããŸãã
Quartz Cookbook / How-To: Defining a Job (with input data)
JobBuilder#withIdentity
ã§æå®ããŠããã®ã¯ãJobã®ååãšæå±ããã°ã«ãŒãã§ãã
Overviewã«ãããšãJobã«ã¯ååãä»ããã°ã«ãŒãã§ãŸãšããããšãã§ããããã§ãã
Jobs are given names by their creator and can also be organized into named groups.
次ã«ãTrigger
ãäœæããŸãã
Trigger trigger = TriggerBuilder .newTrigger() .withIdentity("trigger1", "trigger-group1") .withSchedule( SimpleScheduleBuilder .simpleSchedule() .withIntervalInSeconds(3) .repeatForever() ) .build();
Trigger
ã¯ãæå®ããã¹ã±ãžã¥ãŒã«ãééãªã©ã§Jobãèµ·åãã圹å²ãæã€ãã®ã§ãã
Jobs are scheduled to run when a given Trigger occurs.
ä»åã¯ã3ç§ããã«å®è¡ãç¶ããã¹ã±ãžã¥ãŒãªã³ã°ãšããŸããã
SimpleScheduleBuilder
.simpleSchedule()
.withIntervalInSeconds(3)
.repeatForever()
Trigger
ã«ãååãšã°ã«ãŒããæå®ã§ããŸãã
Quick Start Guideãªã©ã§JobDetail
ãšTrigger
ãåãã°ã«ãŒãåã«æå±ãããŠããã®ã§åéãããŠããã®ã§ããããããŸã§ããã¯Trigger
ã«å¯Ÿãã
ã°ã«ãŒãæå®ã§ãããJobDetail
ãšTrigger
ã¯å¥ã
ã®ç®¡çã«ãªã£ãŠããããã§ãã
riggers may also be given names and placed into groups, in order to easily organize them within the scheduler.
JobDetail
ãTrigger
ã«çŽä»ããã«ã¯ãScheduler
ãžã®ç»é²æã«è¡ããŸãã
scheduler.scheduleJob(helloJob, trigger);
Cookbookã§ã¯ãJobDetail
ãšTrigger
ã®äœæãScheduler
ãŸã§ã®é¢é£ä»ãããžã§ãã®ã¹ã±ãžã¥ãŒãªã³ã°ãšããŠèšèŒããŠããŸãã
ãããŸã§ããScheduler
ãååŸããŠJob
ã®äœæããã®å®è¡ã¿ã€ãã³ã°ã®å®çŸ©ã§ããã
scheduler = StdSchedulerFactory.getDefaultScheduler(); JobDetail helloJob = JobBuilder .newJob(HelloJob.class) .withIdentity("helloJob", "job-group1") .build(); Trigger trigger = TriggerBuilder .newTrigger() .withIdentity("trigger1", "trigger-group1") .withSchedule( SimpleScheduleBuilder .simpleSchedule() .withIntervalInSeconds(3) .repeatForever() ) .build(); scheduler.scheduleJob(helloJob, trigger); scheduler.start();
ã§ã¯ãå®è¡ããŠã¿ãŸãããã
$ mvn compile exec:java -Dexec.mainClass=org.littlewings.quartz.QuartsGettingStarted
Quartzããããã©ã«ãèšå®ã§èµ·åããŸãã
[org.littlewings.quartz.QuartsGettingStarted.main()] INFO org.quartz.impl.StdSchedulerFactory - Using default implementation for ThreadExecutor [org.littlewings.quartz.QuartsGettingStarted.main()] INFO org.quartz.simpl.SimpleThreadPool - Job execution threads will use class loader of thread: org.littlewings.quartz.QuartsGettingStarted.main() [org.littlewings.quartz.QuartsGettingStarted.main()] INFO org.quartz.core.SchedulerSignalerImpl - Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl [org.littlewings.quartz.QuartsGettingStarted.main()] INFO org.quartz.core.QuartzScheduler - Quartz Scheduler v.2.3.2 created. [org.littlewings.quartz.QuartsGettingStarted.main()] INFO org.quartz.simpl.RAMJobStore - RAMJobStore initialized. [org.littlewings.quartz.QuartsGettingStarted.main()] INFO org.quartz.core.QuartzScheduler - Scheduler meta-data: Quartz Scheduler (v2.3.2) 'DefaultQuartzScheduler' with instanceId 'NON_CLUSTERED' Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally. NOT STARTED. Currently in standby mode. Number of jobs executed: 0 Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads. Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered. [org.littlewings.quartz.QuartsGettingStarted.main()] INFO org.quartz.impl.StdSchedulerFactory - Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties' [org.littlewings.quartz.QuartsGettingStarted.main()] INFO org.quartz.impl.StdSchedulerFactory - Quartz scheduler version: 2.3.2 [org.littlewings.quartz.QuartsGettingStarted.main()] INFO org.quartz.core.QuartzScheduler - Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started.
30ç§éãJobãç¹°ãè¿ãå®è¡ãããŸãã
[DefaultQuartzScheduler_Worker-1] INFO org.littlewings.quartz.HelloJob - execute job[2022-10-08T16:33:13.360251471] [DefaultQuartzScheduler_Worker-2] INFO org.littlewings.quartz.HelloJob - execute job[2022-10-08T16:33:16.355957563] [DefaultQuartzScheduler_Worker-3] INFO org.littlewings.quartz.HelloJob - execute job[2022-10-08T16:33:19.356242236] [DefaultQuartzScheduler_Worker-4] INFO org.littlewings.quartz.HelloJob - execute job[2022-10-08T16:33:22.355981361] [DefaultQuartzScheduler_Worker-5] INFO org.littlewings.quartz.HelloJob - execute job[2022-10-08T16:33:25.356468678] [DefaultQuartzScheduler_Worker-6] INFO org.littlewings.quartz.HelloJob - execute job[2022-10-08T16:33:28.355907533] [DefaultQuartzScheduler_Worker-7] INFO org.littlewings.quartz.HelloJob - execute job[2022-10-08T16:33:31.356178477] [DefaultQuartzScheduler_Worker-8] INFO org.littlewings.quartz.HelloJob - execute job[2022-10-08T16:33:34.355574682] [DefaultQuartzScheduler_Worker-9] INFO org.littlewings.quartz.HelloJob - execute job[2022-10-08T16:33:37.355939616] [DefaultQuartzScheduler_Worker-10] INFO org.littlewings.quartz.HelloJob - execute job[2022-10-08T16:33:40.356887985] [DefaultQuartzScheduler_Worker-1] INFO org.littlewings.quartz.HelloJob - execute job[2022-10-08T16:33:43.356656751]
ãããŠãshutdownã
[org.littlewings.quartz.QuartsGettingStarted.main()] INFO org.quartz.core.QuartzScheduler - Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED shutting down. [org.littlewings.quartz.QuartsGettingStarted.main()] INFO org.quartz.core.QuartzScheduler - Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED paused. [org.littlewings.quartz.QuartsGettingStarted.main()] INFO org.quartz.core.QuartzScheduler - Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED shutdown complete.
OKã§ããã
ããããã£ãã¡ã€ã«ãäœæããŠã¿ã
ããã©ã«ãèšå®ã§ãèµ·åããŠããŸããããæåŸã«ããããã£ãã¡ã€ã«ãäœæããŠã¿ãŸãããã
ã¯ã©ã¹ãã¹çŽäžã«quartz.properties
ãšãããã¡ã€ã«ãäœæããŸãã
src/main/resources/quartz.properties
org.quartz.scheduler.instanceName = MyScheduler org.quartz.threadPool.threadCount = 3
ä»åã¯Quick Start Guideã«èšèŒãããŠããé ç®ã®ãã¡ãã€ã³ã¹ã¿ã³ã¹åãšã¹ã¬ããæ°ã®ã¿æå®ã
ãã1床å®è¡ã
$ mvn compile exec:java -Dexec.mainClass=org.littlewings.quartz.QuartsGettingStarted
å°ãããã°ã®åºæ¹ãå€ãããŸããã
[org.littlewings.quartz.QuartsGettingStarted.main()] INFO org.quartz.impl.StdSchedulerFactory - Using default implementation for ThreadExecutor [org.littlewings.quartz.QuartsGettingStarted.main()] INFO org.quartz.core.SchedulerSignalerImpl - Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl [org.littlewings.quartz.QuartsGettingStarted.main()] INFO org.quartz.core.QuartzScheduler - Quartz Scheduler v.2.3.2 created. [org.littlewings.quartz.QuartsGettingStarted.main()] INFO org.quartz.simpl.RAMJobStore - RAMJobStore initialized. [org.littlewings.quartz.QuartsGettingStarted.main()] INFO org.quartz.core.QuartzScheduler - Scheduler meta-data: Quartz Scheduler (v2.3.2) 'MyScheduler' with instanceId 'NON_CLUSTERED' Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally. NOT STARTED. Currently in standby mode. Number of jobs executed: 0 Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 3 threads. Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered. [org.littlewings.quartz.QuartsGettingStarted.main()] INFO org.quartz.impl.StdSchedulerFactory - Quartz scheduler 'MyScheduler' initialized from default resource file in Quartz package: 'quartz.properties' [org.littlewings.quartz.QuartsGettingStarted.main()] INFO org.quartz.impl.StdSchedulerFactory - Quartz scheduler version: 2.3.2 [org.littlewings.quartz.QuartsGettingStarted.main()] INFO org.quartz.core.QuartzScheduler - Scheduler MyScheduler_$_NON_CLUSTERED started.
ã¹ã±ãžã¥ãŒã©ãŒåãDefaultQuartzScheduler
ã ã£ãã®ãMyScheduler
ã«ãªããquartz.properties
ã䜿ã£ãŠããããšãåºåãããŠããŸããã
[org.littlewings.quartz.QuartsGettingStarted.main()] INFO org.quartz.core.QuartzScheduler - Scheduler meta-data: Quartz Scheduler (v2.3.2) 'MyScheduler' with instanceId 'NON_CLUSTERED' [org.littlewings.quartz.QuartsGettingStarted.main()] INFO org.quartz.impl.StdSchedulerFactory - Quartz scheduler 'MyScheduler' initialized from default resource file in Quartz package: 'quartz.properties'
ã¹ã¬ããæ°ã®å€æŽãåæ ãã
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 3 threads.
Jobãå®è¡ããããã®ã¹ã¬ããåãå€ããã3ã€ã®ã¹ã¬ããã䜿ããŸãããŠããããšãããããŸãã
[MyScheduler_Worker-1] INFO org.littlewings.quartz.HelloJob - execute job[2022-10-08T16:39:05.473665584] [MyScheduler_Worker-2] INFO org.littlewings.quartz.HelloJob - execute job[2022-10-08T16:39:08.467310053] [MyScheduler_Worker-3] INFO org.littlewings.quartz.HelloJob - execute job[2022-10-08T16:39:11.467012194] [MyScheduler_Worker-1] INFO org.littlewings.quartz.HelloJob - execute job[2022-10-08T16:39:14.467538797] [MyScheduler_Worker-2] INFO org.littlewings.quartz.HelloJob - execute job[2022-10-08T16:39:17.466925646] [MyScheduler_Worker-3] INFO org.littlewings.quartz.HelloJob - execute job[2022-10-08T16:39:20.467433465] [MyScheduler_Worker-1] INFO org.littlewings.quartz.HelloJob - execute job[2022-10-08T16:39:23.467141547] [MyScheduler_Worker-2] INFO org.littlewings.quartz.HelloJob - execute job[2022-10-08T16:39:26.466755037] [MyScheduler_Worker-3] INFO org.littlewings.quartz.HelloJob - execute job[2022-10-08T16:39:29.467242403] [MyScheduler_Worker-1] INFO org.littlewings.quartz.HelloJob - execute job[2022-10-08T16:39:32.466972963] [MyScheduler_Worker-2] INFO org.littlewings.quartz.HelloJob - execute job[2022-10-08T16:39:35.467666051]
ãã¡ããOKã§ããã
ãªãã±
ãã®Quick Start Guideã«è¿ãQuartzã®Example1ã¯ããã¡ãã«å«ãŸããŠããŸãã
Example 1 - Your First Quartz Program
ãŸãšã
Quartzã䜿ã£ãŠã¿ãŸãããQuick Start Guideããªãã£ãçšåºŠã®ãã®ã§ããããããŸãã¡ãããšèŠãããšããªãã£ãã®ã§ãããããšç¥ãããšã
å€ãã£ãã§ããã
ãããããããå°ãæãäžããŠãããããªãšæããŸãã