-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAsyncGroup.java
More file actions
38 lines (34 loc) · 1.32 KB
/
AsyncGroup.java
File metadata and controls
38 lines (34 loc) · 1.32 KB
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
/*
* AsyncGroup.java
* Copyright (C) 2023-2026 Takayuki Sato. All Rights Reserved.
*/
package com.github.sttk.sabi;
/**
* An interface for asynchronously executing multiple {@link Runner} instances and waiting for their
* completion.
*
* <p>Implementations of this interface allow adding multiple {@link Runner} objects, which are then
* executed concurrently. The group waits until all added runners have finished their execution. Any
* errors occurring during the execution of a {@link Runner} are stored and can be retrieved by
* their names in a map.
*/
public interface AsyncGroup {
/**
* Represents the reason for a new {@link com.github.sttk.errs.Err} exception object when an
* exception occurred during the execution of a {@link Runner} and the exception class was not the
* {@link com.github.sttk.errs.Err}.
*/
record RunnerFailed() {}
/**
* Represents the reason for an {@link com.github.sttk.errs.Err} exception object when the
* creation of a thread for asynchronous execution of a {@link Runner} fails.
*/
record RunnerInterrupted() {}
/**
* Adds a {@link Runner} to this group for asynchronous execution. The added runner will be
* executed in a separate thread.
*
* @param runner The {@link Runner} to be added and executed asynchronously.
*/
void add(final Runner runner);
}