Example usage for org.springframework.statemachine.state State equals

List of usage examples for org.springframework.statemachine.state State equals

Introduction

In this page you can find the example usage for org.springframework.statemachine.state State equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Indicates whether some other object is "equal to" this one.

Usage

From source file:org.springframework.statemachine.support.DefaultStateMachineExecutor.java

private synchronized boolean processDeferList() {
    if (log.isDebugEnabled()) {
        log.debug("Process defer list, size=" + deferList.size());
    }//  ww w  .j  av a  2s .c  o m
    ListIterator<Message<E>> iterator = deferList.listIterator();
    State<S, E> currentState = stateMachine.getState();
    while (iterator.hasNext()) {
        Message<E> event = iterator.next();
        if (currentState.shouldDefer(event)) {
            // if current state still defers, just continue with others
            continue;
        }
        for (Transition<S, E> transition : transitions) {
            State<S, E> source = transition.getSource();
            Trigger<S, E> trigger = transition.getTrigger();
            if (source.equals(currentState)) {
                if (trigger != null && trigger.evaluate(new DefaultTriggerContext<S, E>(event.getPayload()))) {
                    triggerQueue.add(new TriggerQueueItem(trigger, event));
                    iterator.remove();
                    // bail out when first deferred message is causing a trigger to fire
                    return true;
                }
            }
        }
    }
    return false;
}