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

eu.unicore.uas.util.State Maven / Gradle / Ivy

The newest version!
package eu.unicore.uas.util;

/**
 * The State interface encapsulates two notions: 
 * 
    *
  • a target object is transitioned from the current state to the * next using the next() method
  • *
  • when errors occur, recovery actions can be taken, or simply a retry * can occur, as handled by the onError() method
  • *
* * @author schuller */ public interface State { /** * transition to the next state * @param target - the target object * @return next State, or null if there is no next state * @throws Exception */ public State next(T target) throws Exception; /** * decide how to handle an error which occurred while processing next() * * @param target - the target object * @param exception - the error that occurred * @return next State, or null if there is no next state * @throws Exception */ public State onError(T target, Exception exception) throws Exception; /** * get this state's name, unique for the state machine, which is both * useful for humans, and which can be used as e.g. hash map key */ public String getName(); /** * whether the state machine can pause after this state: * if false the state machine must always process the * next state */ public boolean isPausable(); /** * if this is larger than zero, failed state transitions will be re-tried * (at most the given number of times) */ public int getNumberOfRetries(); /** * if this is larger than zero, it is used to delay a retry by the given number * of milliseconds */ public int getRetryDelay(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy