-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.in
46 lines (36 loc) · 1.16 KB
/
README.in
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
## taskrecorder
The `taskrecorder` package provides a simple abstraction to record the steps
(and subtasks) performed during the execution of tasks within an application.
## Features
* Record detailed task steps for informative error reports.
* High coverage test suite.
* [OSGi-ready](https://www.osgi.org/)
* [JPMS-ready](https://en.wikipedia.org/wiki/Java_Platform_Module_System)
* ISC license.
## Usage
Create a new task, and create steps and subtasks as the application performs
operations:
```
final Logger logger;
final TRTaskRecorderType<Integer> recorder =
TRTaskRecorder.create(logger, "Book Flight");
recorder.beginStep("Picking best airline price...");
Airline airline;
try {
airline = pickAirline();
recorder.setStepSucceeded("Found airline.");
} catch (Exception e) {
recorder.setTaskFailed("No price available.", e);
return;
}
recorder.beginStep("Making reservation...");
try {
int id = makeReservation(airline);
recorder.setTaskSucceeded("Created reservation.", id);
} catch (Exception e) {
recorder.setTaskFailed("No reservations available.", e);
return;
}
var task = recorder.toTask();
assert task.resolution() instanceof TRSucceeded;
```