1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.spi.lifecycle;
|
---|
3 |
|
---|
4 | import java.util.Collection;
|
---|
5 | import java.util.Collections;
|
---|
6 | import java.util.List;
|
---|
7 | import java.util.concurrent.Callable;
|
---|
8 |
|
---|
9 | /**
|
---|
10 | * Defines the initialization sequence.
|
---|
11 | * @since 14139
|
---|
12 | */
|
---|
13 | public interface InitializationSequence {
|
---|
14 |
|
---|
15 | /**
|
---|
16 | * Returns tasks that must be run before parallel tasks.
|
---|
17 | * @return tasks that must be run before parallel tasks
|
---|
18 | * @see #afterInitializationTasks
|
---|
19 | * @see #parallelInitializationTasks
|
---|
20 | */
|
---|
21 | default List<InitializationTask> beforeInitializationTasks() {
|
---|
22 | return Collections.emptyList();
|
---|
23 | }
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * Returns tasks to be executed (in parallel) by a ExecutorService.
|
---|
27 | * @return tasks to be executed (in parallel) by a ExecutorService
|
---|
28 | */
|
---|
29 | default Collection<InitializationTask> parallelInitializationTasks() {
|
---|
30 | return Collections.emptyList();
|
---|
31 | }
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * Returns asynchronous callable initializations to be completed eventually
|
---|
35 | * @return asynchronous callable initializations to be completed eventually
|
---|
36 | */
|
---|
37 | default List<Callable<?>> asynchronousCallableTasks() {
|
---|
38 | return Collections.emptyList();
|
---|
39 | }
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * Returns asynchronous runnable initializations to be completed eventually
|
---|
43 | * @return asynchronous runnable initializations to be completed eventually
|
---|
44 | */
|
---|
45 | default List<Runnable> asynchronousRunnableTasks() {
|
---|
46 | return Collections.emptyList();
|
---|
47 | }
|
---|
48 |
|
---|
49 | /**
|
---|
50 | * Returns tasks that must be run after parallel tasks.
|
---|
51 | * @return tasks that must be run after parallel tasks
|
---|
52 | * @see #beforeInitializationTasks
|
---|
53 | * @see #parallelInitializationTasks
|
---|
54 | */
|
---|
55 | default List<InitializationTask> afterInitializationTasks() {
|
---|
56 | return Collections.emptyList();
|
---|
57 | }
|
---|
58 | }
|
---|