001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.spi.lifecycle;
003
004import java.util.Collection;
005import java.util.Collections;
006import java.util.List;
007import java.util.concurrent.Callable;
008
009/**
010 * Defines the initialization sequence.
011 * @since 14139
012 */
013public interface InitializationSequence {
014
015    /**
016     * Returns tasks that must be run before parallel tasks.
017     * @return tasks that must be run before parallel tasks
018     * @see #afterInitializationTasks
019     * @see #parallelInitializationTasks
020     */
021    default List<InitializationTask> beforeInitializationTasks() {
022        return Collections.emptyList();
023    }
024
025    /**
026     * Returns tasks to be executed (in parallel) by a ExecutorService.
027     * @return tasks to be executed (in parallel) by a ExecutorService
028     */
029    default Collection<InitializationTask> parallelInitializationTasks() {
030        return Collections.emptyList();
031    }
032
033    /**
034     * Returns asynchronous callable initializations to be completed eventually
035     * @return asynchronous callable initializations to be completed eventually
036     */
037    default List<Callable<?>> asynchronousCallableTasks() {
038        return Collections.emptyList();
039    }
040
041    /**
042     * Returns asynchronous runnable initializations to be completed eventually
043     * @return asynchronous runnable initializations to be completed eventually
044     */
045    default List<Runnable> asynchronousRunnableTasks() {
046        return Collections.emptyList();
047    }
048
049    /**
050     * Returns tasks that must be run after parallel tasks.
051     * @return tasks that must be run after parallel tasks
052     * @see #beforeInitializationTasks
053     * @see #parallelInitializationTasks
054     */
055    default List<InitializationTask> afterInitializationTasks() {
056        return Collections.emptyList();
057    }
058}