mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 01:41:11 +01:00
Refactor: Rename setup to setupUncaughtExceptionHandler
rename setupErrorHandler to checkCryptoPolicySetup move UncaughtExceptionHandler code to setupUncaughtExceptionHandler
This commit is contained in:
parent
b6e97e371e
commit
7ea3676c55
@ -40,16 +40,7 @@ public class CommonSetup {
|
||||
setSystemProperties();
|
||||
}
|
||||
|
||||
public static void setup(UncaughtExceptionHandler uncaughtExceptionHandler) {
|
||||
setupErrorHandler(uncaughtExceptionHandler);
|
||||
}
|
||||
|
||||
protected static void setSystemProperties() {
|
||||
if (Utilities.isLinux())
|
||||
System.setProperty("prism.lcdtext", "false");
|
||||
}
|
||||
|
||||
private static void setupErrorHandler(UncaughtExceptionHandler uncaughtExceptionHandler) {
|
||||
public static void setupUncaughtExceptionHandler(UncaughtExceptionHandler uncaughtExceptionHandler) {
|
||||
Thread.UncaughtExceptionHandler handler = (thread, throwable) -> {
|
||||
// Might come from another thread
|
||||
if (throwable.getCause() != null && throwable.getCause().getCause() != null &&
|
||||
@ -69,7 +60,15 @@ public class CommonSetup {
|
||||
};
|
||||
Thread.setDefaultUncaughtExceptionHandler(handler);
|
||||
Thread.currentThread().setUncaughtExceptionHandler(handler);
|
||||
}
|
||||
|
||||
protected static void setSystemProperties() {
|
||||
if (Utilities.isLinux())
|
||||
System.setProperty("prism.lcdtext", "false");
|
||||
}
|
||||
|
||||
//TODO not needed anymore
|
||||
private static void checkCryptoPolicySetup(UncaughtExceptionHandler uncaughtExceptionHandler) {
|
||||
try {
|
||||
CryptoUtils.checkCryptoPolicySetup();
|
||||
} catch (NoSuchAlgorithmException | LimitedKeyStrengthException e) {
|
||||
|
@ -22,8 +22,6 @@ import bisq.common.app.AppModule;
|
||||
import bisq.common.app.Version;
|
||||
import bisq.common.setup.CommonSetup;
|
||||
|
||||
import joptsimple.OptionSet;
|
||||
|
||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
|
||||
import java.util.concurrent.Executors;
|
||||
@ -72,7 +70,7 @@ public class BisqHeadlessAppMain extends BisqExecutable {
|
||||
@Override
|
||||
protected void launchApplication() {
|
||||
headlessApp = new BisqHeadlessApp();
|
||||
CommonSetup.setup(BisqHeadlessAppMain.this.headlessApp);
|
||||
CommonSetup.setupUncaughtExceptionHandler(BisqHeadlessAppMain.this.headlessApp);
|
||||
|
||||
UserThread.execute(this::onApplicationLaunched);
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ public class BisqDaemonMain extends BisqHeadlessAppMain implements BisqSetup.Bis
|
||||
@Override
|
||||
protected void launchApplication() {
|
||||
headlessApp = new BisqDaemon();
|
||||
CommonSetup.setup(BisqDaemonMain.this.headlessApp);
|
||||
CommonSetup.setupUncaughtExceptionHandler(BisqDaemonMain.this.headlessApp);
|
||||
|
||||
UserThread.execute(this::onApplicationLaunched);
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ public class BisqAppMain extends BisqExecutable {
|
||||
BisqAppMain.this.application = (BisqApp) application;
|
||||
|
||||
// Necessary to do the setup at this point to prevent Bouncy Castle errors
|
||||
CommonSetup.setup(BisqAppMain.this.application);
|
||||
CommonSetup.setupUncaughtExceptionHandler(BisqAppMain.this.application);
|
||||
// Map to user thread!
|
||||
UserThread.execute(this::onApplicationLaunched);
|
||||
});
|
||||
|
@ -50,7 +50,7 @@ public class SeedNodeMain extends ExecutableForAppWithP2p {
|
||||
super.doExecute();
|
||||
|
||||
checkMemory(config, this);
|
||||
CommonSetup.setup(this);
|
||||
CommonSetup.setupUncaughtExceptionHandler(this);
|
||||
|
||||
keepRunning();
|
||||
}
|
||||
|
@ -24,8 +24,6 @@ import bisq.common.UserThread;
|
||||
import bisq.common.app.AppModule;
|
||||
import bisq.common.setup.CommonSetup;
|
||||
|
||||
import joptsimple.OptionSet;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@ -47,7 +45,7 @@ public class StatisticsMain extends ExecutableForAppWithP2p {
|
||||
super.doExecute();
|
||||
|
||||
checkMemory(config, this);
|
||||
CommonSetup.setup(this);
|
||||
CommonSetup.setupUncaughtExceptionHandler(this);
|
||||
|
||||
keepRunning();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user