-
Notifications
You must be signed in to change notification settings - Fork 0
/
ExampleSchedulerRunnable.java
48 lines (41 loc) · 1.36 KB
/
ExampleSchedulerRunnable.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
*
* * Copyright (c) 2021. Zyonic Software - Niklas Griese
* * This File, its contents and by extention the corresponding project is property of Zyonic Software and may not be used without explicit permission to do so.
* *
* * contact(at)zyonicsoftware.com
*
*/
package com.zyonicsoftware.minereaper.example;
import com.zyonicsoftware.minereaper.runnable.RedEugeneSchedulerRunnable;
import org.jetbrains.annotations.NotNull;
import java.util.concurrent.TimeUnit;
/**
* @author Niklas Griese
* @see RedEugeneSchedulerRunnable
*/
public class ExampleSchedulerRunnable extends RedEugeneSchedulerRunnable {
public ExampleSchedulerRunnable(
@NotNull final String eugeneJobName, @NotNull final TimeUnit timeUnit, final long period) {
super(eugeneJobName, timeUnit, period);
}
/**
* don't remove super.run(); this calls the inject reference! then you can call your own void
* scheduler
*/
@Override
public void run() {
super.run();
this.callCodeBlock(); // checked the execution count to cancel your self ;)
}
private void callCodeBlock() {
if (this.getEugeneJob().getExecute() == 50001) {
if (ExampleMain.getRedEugeneIntroduction()
.forceCancelEugeneJob(this.getEugeneJob().getName())) {
System.out.println("Job is finished");
}
} else {
System.out.println(this.getEugeneJob());
}
}
}