https://github.com/wniemiec-task-java/checkpoint
A checkpoint is a class and method marker, and it is used when you want a piece of code, even if executed by several independent processes, to be executed only once.
https://github.com/wniemiec-task-java/checkpoint
checkpoint class-marker java method-marker processes tasj wniemiec wniemiec-task-java
Last synced: 6 months ago
JSON representation
A checkpoint is a class and method marker, and it is used when you want a piece of code, even if executed by several independent processes, to be executed only once.
- Host: GitHub
- URL: https://github.com/wniemiec-task-java/checkpoint
- Owner: wniemiec-task-java
- License: mit
- Created: 2021-08-11T22:42:06.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-08-12T01:52:26.000Z (almost 5 years ago)
- Last Synced: 2025-07-07T05:05:45.084Z (12 months ago)
- Topics: checkpoint, class-marker, java, method-marker, processes, tasj, wniemiec, wniemiec-task-java
- Language: Java
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

Checkpoint
A checkpoint is a class and method marker, and it is used when you want a piece of code, even if executed by several independent processes, to be executed only once.
## ❇ Introduction
If you need to know if a piece of code has already been executed by another process, then this is the perfect library for you. A checkpoint is a class and method marker, and it is used when you want a piece of code, even if executed by several independent processes, to be executed only once.
## ❓ How to use
1. Add one of the options below to the pom.xml file:
#### Using Maven Central (recomended):
```
io.github.wniemiec-task-java
checkpoint
LATEST
```
#### Using GitHub Packages:
```
wniemiec.task.java
checkpoint
LATEST
```
2. Run
```
$ mvn install
```
3. Use it
```
[...]
import wniemiec.task.java.Checkpoint;
[...]
public class CheckpointExample {
[...]
Checkpoint checkpoint = new Checkpoint(tmpDir, "checkpoint-example");
System.out.println("Trying to access piece of code...");
if (checkpoint.isEnabled()) {
System.out.println("Piece of code already executed");
}
else {
System.out.println("Piece of code executed for the first time");
checkpoint.enable();
}
System.out.println("...");
while (true) {
}
[...]
```
```
Process one
$ java CheckpointExample
Trying to access piece of code...
Piece of code executed for the first time
...
```
```
Process two
$ java CheckpointExample
Trying to access piece of code...
Piece of code already executed
...
```
## 📖 Documentation
| Property |Parameter type|Return type|Description|Default parameter value|
|----------------|-------------------------------|------|-----------------------|--------|
|enable |`void`|`void`|Starts a new checkpoint| - |
|disable |`void`|`void`|Disables checkpoint| - |
|exists |`void`|`boolean`|Checks if a checkpoint was created.| - |
|isEnabled |`void`|`boolean`|Checks if the checkpoint is active.| - |
|delete | `void`|`void`|Checks if the checkpoint is active.| - |
## 🚩 Changelog
Details about each version are documented in the [releases section](https://github.com/williamniemiec/wniemiec-task-java/checkpoint/releases).
## 🤝 Contribute!
See the documentation on how you can contribute to the project [here](https://github.com/wniemiec-task-java/checkpoint/blob/master/CONTRIBUTING.md).
## 📁 Files
### /
| Name |Type|Description|
|----------------|-------------------------------|-----------------------------|
|dist |`Directory`|Released versions|
|docs |`Directory`|Documentation files|
|src |`Directory`| Source files|