<commit_before>package org.jtrim.concurrent;

import java.util.concurrent.*;
import java.util.concurrent.atomic.*;
import org.jtrim.utils.*;

/**
 * Defines a task which is made of multiple subtasks. Once the task is finished
 * anyone may call {@link #finishTask(Object, Throwable, boolean) finishTask}
 * to finish this {@code MultiPhaseTask}. The main advantages of this class
 * is that it offers a {@link #getFuture() future} object representing the
 * {@code MultiPhaseTask} and it can notify a listener when the
 * {@code MultiPhaseTask} terminates and no more subtasks may run anymore.
 * <P>
 * Therefore to use this class, submit subtasks by one of the
 * {@code executeSubTask} or {@code submitSubTask} methods and when finished
 * invoke the {@code finishTask} method (possibly from a subtask).
 *
 * <h3>Thread safety</h3>
 * The methods of this class are safe to use by multiple threads concurrently.
 *
 * <h4>Synchronization transparency</h4>
 * The methods of this interface are not <I>synchronization transparent</I>.
 *
 * @param <ResultType> the type of the result of this task. The result can be
 *   specified to the {@code finishTask} method and later can also be retrieved<commit_msg>Fixed the documentation of MultiPhaseTask<commit_after>package org.jtrim.concurrent;

import java.util.concurrent.*;
import java.util.concurrent.atomic.*;
import org.jtrim.utils.*;

/**
 * Defines a task which is made of multiple subtasks. Once the task is finished
 * anyone may call {@link #finishTask(Object, Throwable, boolean) finishTask}
 * to finish this {@code MultiPhaseTask}. The main advantages of this class
 * is that it offers a {@link #getFuture() future} object representing the
 * {@code MultiPhaseTask} and it can notify a listener when the
 * {@code MultiPhaseTask} terminates and no more subtasks may run anymore.
 * <P>
 * Therefore to use this class, submit subtasks by one of the
 * {@code executeSubTask} or {@code submitSubTask} methods and when finished
 * invoke the {@code finishTask} method (possibly from a subtask).
 *
 * <h3>Thread safety</h3>
 * The methods of this class are safe to use by multiple threads concurrently.
 *
 * <h4>Synchronization transparency</h4>
 * The methods of this class are not <I>synchronization transparent</I>.
 *
 * @param <ResultType> the type of the result of this task. The result can be
 *   specified to the {@code finishTask} method and later can also be retrieved
{'fraction_non_alphanumeric': 0.08934426229508197, 'fraction_numerical': 0.003278688524590164, 'mean_word_length': 4.510158013544018, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '135761', 'n_tokens_mistral': 655, 'n_tokens_neox': 644, 'n_words': 311}