@@ -6,10 +6,10 @@ Wisp Scheduler
66[ ![ Maven Central] ( https://maven-badges.herokuapp.com/maven-central/com.coreoz/wisp/badge.svg )] ( https://maven-badges.herokuapp.com/maven-central/com.coreoz/wisp )
77
88Wisp is a simple Java Scheduler with a minimal footprint.
9- Wisp weighs only 30Kb and has zero dependency.
10- It will only create threads that will be used: if one thread is enough to run all the jobs,
11- then only one thread will be created.
12- A second thread will only be created when 2 jobs have to run at the exact same time.
9+ Wisp weighs only 30Kb and has zero dependency except SLF4J .
10+ It will only create threads that will be used: if two threads are enough to run all the jobs,
11+ then only two threads will be created.
12+ A third thread will only be created when 2 jobs have to run at the same time.
1313
1414The scheduler precision will depend on the system load.
1515Though a job will never be executed early, it will generally run after 1ms of the scheduled time.
@@ -24,7 +24,7 @@ Include Wisp in your project:
2424<dependency >
2525 <groupId >com.coreoz</groupId >
2626 <artifactId >wisp</artifactId >
27- <version >1 .0.0</version >
27+ <version >2 .0.0</version >
2828</dependency >
2929```
3030
@@ -43,6 +43,14 @@ A project should generally contain only one instance of a `Scheduler`.
4343So either a dependency injection framework handles this instance,
4444or either a static instance of ` Scheduler ` should be created.
4545
46+ In production, it is generally a good practice to configure the
47+ [ monitor for long running jobs detection] ( #long-running-jobs-detection ) .
48+
49+ Upgrade from version 1.x.x to version 2.x.x
50+ -------------------------------------------
51+ - If a cron schedule is used, then cron-utils must be upgraded to version 8.0.0
52+ - The [ monitor for long running jobs detection] ( #long-running-jobs-detection ) might be configured
53+
4654Schedules
4755---------
4856
@@ -75,7 +83,7 @@ So to use cron expression, cron-utils should be added in the project:
7583<dependency >
7684 <groupId >com.cronutils</groupId >
7785 <artifactId >cron-utils</artifactId >
78- <version >6 .0.4 </version >
86+ <version >8 .0.0 </version >
7987</dependency >
8088```
8189Then to create a job which is executed every hour at the 30th minute,
@@ -94,6 +102,20 @@ the associated job will never be executed again.
94102At the first execution, if a past time is referenced a warning will be logged
95103but no exception will be raised.
96104
105+ ### Long running jobs detection
106+ To detect jobs that are running for too long, an optional job monitor is provided.
107+ It can be setup with:
108+ ``` java
109+ scheduler. schedule(
110+ new LongRunningJobMonitor (scheduler),
111+ Schedules . fixedDelaySchedule(Duration . ofMinutes(1 ))
112+ );
113+ ```
114+ This way, every minute, the monitor will check for jobs that are running for more than 5 minutes.
115+ A warning message with the job stack trace will be logged for any job running for more than 5 minutes.
116+
117+ The detection threshold can also be configured this way: ` new LongRunningJobMonitor(scheduler, Duration.ofMinutes(15)) `
118+
97119Plume Framework integration
98120---------------------------
99121
0 commit comments