Examples of TransitionException


Examples of org.squirrelframework.foundation.exception.TransitionException

                } catch (Exception e) {
                    e.printStackTrace();
                    Throwable t = (e instanceof SquirrelRuntimeException) ?
                            ((SquirrelRuntimeException)e).getTargetException() : e;
                    // wrap any exception into transition exception
                    TransitionException te = new TransitionException(t, ErrorCodes.FSM_TRANSITION_ERROR,
                            new Object[]{actionContext.from, actionContext.to, actionContext.event,
                            actionContext.context, actionContext.action.name(), e.getMessage()});
                    fireEvent(new ExecActionExceptionEventImpl<T, S, E, C>(te, i+1, actionSize, actionContext));
                    throw te;
                } finally {
                    fireEvent(AfterExecActionEventImpl.get(i+1, actionSize, actionContext));
                }
            } else {
                logger.info("Method call action \""+actionContext.action.name()+"\" ("+(i+1)+" of "+actionSize+") was ignored.");
            }
        }
       
        for(Entry<ActionContext<T, S, E, C>, Future<?>> entry : futures.entrySet()) {
            final Future<?> future = entry.getValue();
            final ActionContext<T, S, E, C> actionContext = entry.getKey();
            try {
                logger.debug("Waiting action \'"+actionContext.action.toString()+"\' to finish.");
                if(actionContext.action.timeout()>=0) {
                    future.get(actionContext.action.timeout(), TimeUnit.MILLISECONDS);
                } else {
                    future.get();
                }
                logger.debug("Action \'"+actionContext.action.toString()+"\' finished.");
            } catch (Exception e) {
                future.cancel(true);
                Throwable t = e;
                if(e instanceof ExecutionException) {
                    t = ((ExecutionException)e).getCause();
                }
                TransitionException te = new TransitionException(t, ErrorCodes.FSM_TRANSITION_ERROR,
                        new Object[]{actionContext.from, actionContext.to, actionContext.event,
                        actionContext.context, actionContext.action.name(), e.getMessage()});
                fireEvent(new ExecActionExceptionEventImpl<T, S, E, C>(te,
                        actionContext.position, actionTotalSize, actionContext));
                throw te;
View Full Code Here

Examples of org.squirrelframework.foundation.exception.TransitionException

            // set state machine in error status first which means state machine cannot process event anymore
            // unless this exception has been resolved and state machine status set back to normal again.
            setStatus(StateMachineStatus.ERROR);
            // wrap any exception into transition exception   
            lastException = (e instanceof TransitionException) ? (TransitionException) e :
                new TransitionException(e, ErrorCodes.FSM_TRANSITION_ERROR,
                        new Object[]{fromStateId, toStateId, event, context, "UNKNOWN", e.getMessage()});
            fireEvent(new TransitionExceptionEventImpl<T, S, E, C>(lastException, fromStateId,
                    localData.read().currentState(), event, context, getThis()));
            afterTransitionCausedException(fromStateId, toStateId, event, context);
        } finally {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.