1 package net.sf.openrocket.simulation.listeners.system;
3 import net.sf.openrocket.simulation.SimulationStatus;
4 import net.sf.openrocket.simulation.exception.SimulationCancelledException;
5 import net.sf.openrocket.simulation.exception.SimulationException;
6 import net.sf.openrocket.simulation.listeners.AbstractSimulationListener;
10 * A simulation listener that throws a {@link SimulationCancelledException} if
11 * this thread has been interrupted. The conditions is checked every time a step
14 * @author Sampo Niskanen <sampo.niskanen@iki.fi>
16 public class InterruptListener extends AbstractSimulationListener {
18 public static final InterruptListener INSTANCE = new InterruptListener();
21 public void postStep(SimulationStatus status) throws SimulationException {
22 if (Thread.interrupted()) {
23 throw new SimulationCancelledException("The simulation was interrupted.");
28 public boolean isSystemListener() {