Uses 911K of libraries. Click here for Pure Java version (14368L/80K).
1 | !7 |
2 | |
3 | concept CronJob { |
4 | bool enabled = true; |
5 | long lastStart, lastEnd, nextStart; |
6 | S name; |
7 | S code; |
8 | S lastError; |
9 | bool realEval; |
10 | } |
11 | |
12 | set flag DynModule. |
13 | |
14 | cmodule CronCRUD > DynCRUD<CronJob> { |
15 | start { |
16 | doEvery(10.0, rEnter bingo); |
17 | } |
18 | |
19 | void bingo { |
20 | for (final CronJob job : list()) pcall { |
21 | if (job.enabled && job.nextStart > 0 && job.nextStart <= now()) { |
22 | cset(job, lastStart := now(), nextStart := 0); |
23 | programLog(print("STARTING JOB: " + job); |
24 | startThread(job.name, r { |
25 | try { |
26 | if (job.realEval) |
27 | dm_javaEval(job.code); |
28 | else |
29 | dm_javaEvalOrInterpret(job.code); |
30 | cset(job, lastError := null); |
31 | programLog(print("JOB COMPLETE: " + job); |
32 | } catch e { |
33 | cset(job, lastError := getStackTrace(e)); |
34 | } finally { |
35 | cset(job, lastEnd := now()); |
36 | } |
37 | }); |
38 | } |
39 | } |
40 | } |
41 | } |
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1022136 |
Snippet name: | JavaX Cron CRUD |
Eternal ID of this version: | #1022136/5 |
Text MD5: | 33a56c8be3cf7d3b5ed4541a8467839f |
Transpilation MD5: | 81a1538da197ec0a68578a880bc68acc |
Author: | stefan |
Category: | javax / stefan's os |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-03-08 17:48:33 |
Source code size: | 984 bytes / 41 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 280 / 398 |
Version history: | 4 change(s) |
Referenced in: | [show references] |