Move static function useSafetyChecks() to Application.
This commit is contained in:
parent
d00c83c2e4
commit
6bd6e81f9b
@ -31,6 +31,17 @@ public final class Application {
|
||||
setLogOutputLevel(LogLevel.DEBUG);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether to use additional safety code checks.
|
||||
*/
|
||||
public static boolean useSafetyChecks() {
|
||||
// Currently default to false unless openrocket.debug.safetycheck is defined
|
||||
String s = System.getProperty("openrocket.debug.safetycheck");
|
||||
if (s != null && !(s.equalsIgnoreCase("false") || s.equalsIgnoreCase("off"))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the logger to be used in logging. By default this returns
|
||||
|
@ -10,7 +10,7 @@ import net.sf.openrocket.startup.Application;
|
||||
* @author Sampo Niskanen <sampo.niskanen@iki.fi>
|
||||
*/
|
||||
public class Invalidator implements Invalidatable {
|
||||
private static final boolean USE_CHECKS = Prefs.useSafetyChecks();
|
||||
private static final boolean USE_CHECKS = Application.useSafetyChecks();
|
||||
|
||||
private static final LogHelper log = Application.getLogger();
|
||||
|
||||
|
@ -18,6 +18,7 @@ import net.sf.openrocket.startup.Application;
|
||||
* @author Sampo Niskanen <sampo.niskanen@iki.fi>
|
||||
*/
|
||||
public abstract class SafetyMutex {
|
||||
private static final boolean USE_CHECKS = Application.useSafetyChecks();
|
||||
private static final LogHelper log = Application.getLogger();
|
||||
|
||||
|
||||
@ -28,7 +29,7 @@ public abstract class SafetyMutex {
|
||||
* @return a new instance of a safety mutex
|
||||
*/
|
||||
public static SafetyMutex newInstance() {
|
||||
if (Prefs.useSafetyChecks()) {
|
||||
if (USE_CHECKS) {
|
||||
return new ConcreteSafetyMutex();
|
||||
} else {
|
||||
return new BogusSafetyMutex();
|
||||
|
Loading…
x
Reference in New Issue
Block a user