An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

          

![](https://github.com/wniemiec-task-java/checkpoint/blob/master/docs/img/logo/logo.jpg)

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.






Coverage status
Java compatibility
Maven Central release
License



## ❇ 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|