Example usage for org.springframework.statemachine.action Action execute

List of usage examples for org.springframework.statemachine.action Action execute

Introduction

In this page you can find the example usage for org.springframework.statemachine.action Action execute.

Prototype

void execute(StateContext<S, E> context);

Source Link

Document

Execute action with a StateContext .

Usage

From source file:org.springframework.statemachine.state.AbstractState.java

/**
 * Execute action and notify action listener if set.
 *
 * @param action the action/*from www.ja v a  2 s .  com*/
 * @param context the context
 */
protected void executeAction(Action<S, E> action, StateContext<S, E> context) {
    long now = System.currentTimeMillis();
    action.execute(context);
    if (this.actionListener != null) {
        try {
            this.actionListener.onExecute(context.getStateMachine(), action, System.currentTimeMillis() - now);
        } catch (Exception e) {
            log.warn("Error with actionListener", e);
        }
    }
}

From source file:org.springframework.statemachine.transition.AbstractTransition.java

protected final void executeAllActions(StateContext<S, E> context) {
    if (actions == null) {
        return;//from   ww  w .  j  a va 2s.co m
    }

    for (Action<S, E> action : actions) {
        long now = System.currentTimeMillis();
        action.execute(context);
        if (this.actionListener != null) {
            this.actionListener.onExecute(context.getStateMachine(), action, System.currentTimeMillis() - now);
        }
    }
}