Schedule routines to run after a certain time or whenever the the timer expires.
Scheduler allows you to perform operations with routines so that they are executed according to a criterion.
- Add one of the options below to the pom.xml file:
<dependency>
<groupId>io.github.wniemiec-task-java</groupId>
<artifactId>scheduler</artifactId>
<version>LATEST</version>
</dependency>
<dependency>
<groupId>wniemiec.task.java</groupId>
<artifactId>scheduler</artifactId>
<version>LATEST</version>
</dependency>
- Run
$ mvn install
- Use it
[...]
import wniemiec.task.java.Scheduler;
[...]
Scheduler.setTimeout(() -> { System.out.println("Hello..."); }, 1000);
Scheduler.setTimeout(() -> { System.out.println("World!"); }, 1000);
Property | Parameter type | Return type | Description | Default parameter value |
---|---|---|---|---|
setTimeout | routine: Routine, delay: long |
long |
Sets a timer which executes a routine once the timer expires | - |
setInterval | routine: Routine, delay: long |
long |
Repeatedly calls a routine with a fixed time delay between each call | - |
clearInterval | id: long |
void |
Cancels a timed, repeating action | - |
clearTimeout | id: long |
void |
Cancels a timed action | - |
clearAllTimeout | void |
void |
Clear all timeouts | - |
clearAllIntervals | void |
void |
Clear all intervals | - |
setTimeoutToRoutine | routine: Routine, delay: long |
boolean |
Runs a routine within a timeout. If the routine does not end on time, an interrupt signal will be sent to it | - |
Details about each version are documented in the releases section.
See the documentation on how you can contribute to the project here.
Name | Type | Description |
---|---|---|
dist | Directory |
Released versions |
docs | Directory |
Documentation files |
src | Directory |
Source files |