All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bigdata.util.concurrent.IHaltable Maven / Gradle / Ivy

package com.bigdata.util.concurrent;

import java.util.concurrent.Future;

/**
 * Interface extends {@link Future} and provides an interface for managing the
 * termination of a process from within that process.
 * 
 * @param 
 *            The generic type of the computation to which the {@link Future}
 *            evaluates.
 */
public interface IHaltable extends Future {

    /**
     * Halt (normal termination).
     */
    void halt(V v);

	/**
	 * Halt (exception thrown). The caller is responsible for throwing
	 * their given cause out of their own context. As a
	 * convenience, this method returns the given cause.
	 * 
	 * @param cause
	 *            The cause (required).
	 * 
	 * @return The argument.
	 */
	 T halt(T cause);

	/**
	 * Return the first {@link Throwable} which caused this process to halt, but
	 * only for abnormal termination.
	 * 

* {@link IHaltable} considers exceptions triggered by an interrupt to be * normal termination of the process and will return null for * such exceptions. * * @return The first {@link Throwable} which caused this process to halt and * null if the process has not halted or if it halted * through normal termination. */ Throwable getCause(); /** * Return the first {@link Throwable cause} regardless of whether it is * indicative of normal termination and null iff no cause has * been set. */ Throwable getAsThrownCause(); }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy