Search in sources :

Example 1 with UserStopException

use of cbit.vcell.solver.UserStopException in project vcell by virtualcell.

the class AbstractJavaSolver method runSolver.

/**
 * Insert the method's description here.
 * Creation date: (6/26/2001 3:08:31 PM)
 */
public void runSolver() {
    try {
        fieldRunning = true;
        setSolverStatus(new SolverStatus(SolverStatus.SOLVER_STARTING, SimulationMessage.MESSAGE_SOLVER_STARTING_INIT));
        fireSolverStarting(SimulationMessage.MESSAGE_SOLVEREVENT_STARTING_INIT);
        initialize();
        setSolverStatus(new SolverStatus(SolverStatus.SOLVER_RUNNING, SimulationMessage.MESSAGE_SOLVER_RUNNING_START));
        fireSolverProgress(getProgress());
        integrate();
        setSolverStatus(new SolverStatus(SolverStatus.SOLVER_FINISHED, SimulationMessage.MESSAGE_SOLVER_FINISHED));
        fireSolverFinished();
    } catch (SolverException integratorException) {
        lg.error(integratorException.getMessage(), integratorException);
        SimulationMessage simulationMessage = SimulationMessage.solverAborted(integratorException.getMessage());
        setSolverStatus(new SolverStatus(SolverStatus.SOLVER_ABORTED, simulationMessage));
        fireSolverAborted(simulationMessage);
    } catch (IOException ioException) {
        lg.error(ioException.getMessage(), ioException);
        SimulationMessage simulationMessage = SimulationMessage.solverAborted(ioException.getMessage());
        setSolverStatus(new SolverStatus(SolverStatus.SOLVER_ABORTED, simulationMessage));
        fireSolverAborted(simulationMessage);
    } catch (UserStopException userStopException) {
        lg.error(userStopException.getMessage(), userStopException);
        setSolverStatus(new SolverStatus(SolverStatus.SOLVER_STOPPED, SimulationMessage.solverStopped(userStopException.getMessage())));
        fireSolverStopped();
    } catch (Exception e) {
        lg.error("AbstractJavaSolver.runSolver() : Caught Throwable instead of SolverException -- THIS EXCEPTION SHOULD NOT HAPPEN!", e);
        SimulationMessage simulationMessage = SimulationMessage.solverAborted(e.getMessage());
        setSolverStatus(new SolverStatus(SolverStatus.SOLVER_ABORTED, simulationMessage));
        fireSolverAborted(simulationMessage);
    } finally {
        fieldRunning = false;
    }
}
Also used : SimulationMessage(cbit.vcell.solver.server.SimulationMessage) SolverException(cbit.vcell.solver.SolverException) IOException(java.io.IOException) UserStopException(cbit.vcell.solver.UserStopException) SolverStatus(cbit.vcell.solver.server.SolverStatus) UserStopException(cbit.vcell.solver.UserStopException) IOException(java.io.IOException) SolverException(cbit.vcell.solver.SolverException)

Aggregations

SolverException (cbit.vcell.solver.SolverException)1 UserStopException (cbit.vcell.solver.UserStopException)1 SimulationMessage (cbit.vcell.solver.server.SimulationMessage)1 SolverStatus (cbit.vcell.solver.server.SolverStatus)1 IOException (java.io.IOException)1