
com.enterprisemath.utils.engine.TaskManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of em-utils Show documentation
Show all versions of em-utils Show documentation
Collection of utility classes for large scale projects focusing on robust and testable code.
package com.enterprisemath.utils.engine;
import java.util.Map;
/**
* Defines interface for task management.
*
*
* Note: Adding functions to this interface will NOT be
* considered as breaking binary compatibility.
*
*
* @author radek.hecl
*/
public interface TaskManager {
/**
* Returns task identification code.
*
* @return task identification code
*/
public String getCode();
/**
* Returns whether task is done. It doesn't matter in which way the end happened.
* Task may end up by returning the result, throwing exception or get stopped.
*
* @return whether task is done or not
*/
public boolean isDone();
/**
* Returns task result. Result satisfies the following conditions.
*
* - If task finished normally by returning from the run method, then result is ALWAYS not null (empty map if run method returned null)
* - If task is still running, then result is null
* - If task thrown an exception, then result is null
* - If task has been stopped, then result is null
*
*
* @return task result or null if result is not available
*/
public Map getResult();
/**
* Returns details about the exception. This method returns not null always and only if task
* execution ended up by exception thrown from the run method. In all other cases returns null.
*
* @return details about the exception or null if there was no exception
*/
public Map getExceptionDetails();
/**
* Stops task execution. Once this method returns, then task is stopped and it cannot produce any result any more.
* If task already finished or has been stopped, then this method has no effect.
*/
public void stop();
/**
* Waits until task is done. This method blocks calling thread until task is done by any way.
* Immediate call to isDone method will always return true.
*/
public void waitTillDone();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy