All Downloads are FREE. Search and download functionalities are using the official Maven repository.

delight.nashornsandbox.exceptions.ScriptAbuseException Maven / Gradle / Ivy

The newest version!
package delight.nashornsandbox.exceptions;

/**
 * Exception is thrown when JS script abuse was detected.
 *
 * 

Created on 2017.11.24

* * @author Marcin Golebski * @version $Id$ */ public class ScriptAbuseException extends RuntimeException { private static final long serialVersionUID = 1L; private final boolean scriptKilled; public ScriptAbuseException(final String message, final boolean scriptKilled, final Throwable throwable) { super(message, throwable); this.scriptKilled = scriptKilled; } /** * Check if script when asked exited nicely, or not. *

* Note, killint java thread is very dangerous to VM health. *

* * @return true when evaluator thread was finished by * {@link Thread#stop()} method, false when only * {@link Thread#interrupt()} was used */ public boolean isScriptKilled() { return scriptKilled; } @Override public String getMessage() { if(scriptKilled) { return super.getMessage() + " The operation could NOT be gracefully interrupted."; } else { return super.getMessage(); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy