mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-05-02 14:46:22 -04:00
update more names from bisq* to haveno*
This commit is contained in:
parent
fae477fc51
commit
e8cc3d20f5
12 changed files with 66 additions and 66 deletions
|
@ -289,13 +289,13 @@ public class Scaffold {
|
|||
startBisqApp(bobdesktop, executor, countdownLatch);
|
||||
}
|
||||
|
||||
private void startBisqApp(HavenoAppConfig bisqAppConfig,
|
||||
private void startBisqApp(HavenoAppConfig havenoAppConfig,
|
||||
ExecutorService executor,
|
||||
CountDownLatch countdownLatch)
|
||||
throws IOException, InterruptedException {
|
||||
|
||||
HavenoProcess bisqProcess = createBisqProcess(bisqAppConfig);
|
||||
switch (bisqAppConfig) {
|
||||
HavenoProcess bisqProcess = createBisqProcess(havenoAppConfig);
|
||||
switch (havenoAppConfig) {
|
||||
case seednode:
|
||||
seedNodeTask = new SetupTask(bisqProcess, countdownLatch);
|
||||
seedNodeTaskFuture = executor.submit(seedNodeTask);
|
||||
|
@ -316,9 +316,9 @@ public class Scaffold {
|
|||
bobNodeTaskFuture = executor.submit(bobNodeTask);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("Unknown BisqAppConfig " + bisqAppConfig.name());
|
||||
throw new IllegalStateException("Unknown HavenoAppConfig " + havenoAppConfig.name());
|
||||
}
|
||||
log.info("Giving {} ms for {} to initialize ...", config.bisqAppInitTime, bisqAppConfig.appName);
|
||||
log.info("Giving {} ms for {} to initialize ...", config.bisqAppInitTime, havenoAppConfig.appName);
|
||||
MILLISECONDS.sleep(config.bisqAppInitTime);
|
||||
if (bisqProcess.hasStartupExceptions()) {
|
||||
bisqProcess.logExceptions(bisqProcess.getStartupExceptions(), log);
|
||||
|
@ -326,9 +326,9 @@ public class Scaffold {
|
|||
}
|
||||
}
|
||||
|
||||
private HavenoProcess createBisqProcess(HavenoAppConfig bisqAppConfig)
|
||||
private HavenoProcess createBisqProcess(HavenoAppConfig havenoAppConfig)
|
||||
throws IOException, InterruptedException {
|
||||
HavenoProcess bisqProcess = new HavenoProcess(bisqAppConfig, config);
|
||||
HavenoProcess bisqProcess = new HavenoProcess(havenoAppConfig, config);
|
||||
bisqProcess.verifyAppNotRunning();
|
||||
bisqProcess.verifyAppDataDirInstalled();
|
||||
return bisqProcess;
|
||||
|
|
|
@ -118,7 +118,7 @@ public enum HavenoAppConfig {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BisqAppConfig{" + "\n" +
|
||||
return "HavenoAppConfig{" + "\n" +
|
||||
" appName='" + appName + '\'' + "\n" +
|
||||
", startupScript='" + startupScript + '\'' + "\n" +
|
||||
", javaOpts='" + javaOpts + '\'' + "\n" +
|
||||
|
|
|
@ -43,7 +43,7 @@ import bisq.daemon.app.HavenoDaemonMain;
|
|||
@Slf4j
|
||||
public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess {
|
||||
|
||||
private final HavenoAppConfig bisqAppConfig;
|
||||
private final HavenoAppConfig havenoAppConfig;
|
||||
private final String baseCurrencyNetwork;
|
||||
private final String genesisTxId;
|
||||
private final int genesisBlockHeight;
|
||||
|
@ -53,9 +53,9 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess
|
|||
private final String findBisqPidScript;
|
||||
private final String debugOpts;
|
||||
|
||||
public HavenoProcess(HavenoAppConfig bisqAppConfig, ApiTestConfig config) {
|
||||
super(bisqAppConfig.appName, config);
|
||||
this.bisqAppConfig = bisqAppConfig;
|
||||
public HavenoProcess(HavenoAppConfig havenoAppConfig, ApiTestConfig config) {
|
||||
super(havenoAppConfig.appName, config);
|
||||
this.havenoAppConfig = havenoAppConfig;
|
||||
this.baseCurrencyNetwork = "XMR_STAGENET";
|
||||
this.genesisTxId = "30af0050040befd8af25068cc697e418e09c2d8ebd8d411d2240591b9ec203cf";
|
||||
this.genesisBlockHeight = 111;
|
||||
|
@ -65,7 +65,7 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess
|
|||
this.findBisqPidScript = (config.isRunningTest ? "." : "./apitest")
|
||||
+ "/scripts/get-bisq-pid.sh";
|
||||
this.debugOpts = config.enableBisqDebugging
|
||||
? " -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:" + bisqAppConfig.remoteDebugPort
|
||||
? " -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:" + havenoAppConfig.remoteDebugPort
|
||||
: "";
|
||||
}
|
||||
|
||||
|
@ -89,33 +89,33 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess
|
|||
@Override
|
||||
public void shutdown() {
|
||||
try {
|
||||
log.info("Shutting down {} ...", bisqAppConfig.appName);
|
||||
log.info("Shutting down {} ...", havenoAppConfig.appName);
|
||||
if (!isAlive(pid)) {
|
||||
this.shutdownExceptions.add(new IllegalStateException(format("%s already shut down", bisqAppConfig.appName)));
|
||||
this.shutdownExceptions.add(new IllegalStateException(format("%s already shut down", havenoAppConfig.appName)));
|
||||
return;
|
||||
}
|
||||
|
||||
String killCmd = "kill -15 " + pid;
|
||||
if (new BashCommand(killCmd).run().getExitStatus() != 0) {
|
||||
this.shutdownExceptions.add(new IllegalStateException(format("Could not shut down %s", bisqAppConfig.appName)));
|
||||
this.shutdownExceptions.add(new IllegalStateException(format("Could not shut down %s", havenoAppConfig.appName)));
|
||||
return;
|
||||
}
|
||||
|
||||
// Be lenient about the time it takes for a java app to shut down.
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (!isAlive(pid)) {
|
||||
log.info("{} stopped", bisqAppConfig.appName);
|
||||
log.info("{} stopped", havenoAppConfig.appName);
|
||||
break;
|
||||
}
|
||||
MILLISECONDS.sleep(2500);
|
||||
}
|
||||
|
||||
if (isAlive(pid)) {
|
||||
this.shutdownExceptions.add(new IllegalStateException(format("%s shutdown did not work", bisqAppConfig.appName)));
|
||||
this.shutdownExceptions.add(new IllegalStateException(format("%s shutdown did not work", havenoAppConfig.appName)));
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
this.shutdownExceptions.add(new IllegalStateException(format("Error shutting down %s", bisqAppConfig.appName), e));
|
||||
this.shutdownExceptions.add(new IllegalStateException(format("Error shutting down %s", havenoAppConfig.appName), e));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,21 +123,21 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess
|
|||
long pid = findBisqAppPid();
|
||||
if (pid >= 0)
|
||||
throw new IllegalStateException(format("%s %s already running with pid %d",
|
||||
bisqAppConfig.mainClassName, bisqAppConfig.appName, pid));
|
||||
havenoAppConfig.mainClassName, havenoAppConfig.appName, pid));
|
||||
}
|
||||
|
||||
public void verifyAppDataDirInstalled() {
|
||||
// If we're running an Alice or Bob daemon, make sure the dao-setup directory
|
||||
// are installed.
|
||||
switch (bisqAppConfig) {
|
||||
switch (havenoAppConfig) {
|
||||
case alicedaemon:
|
||||
case alicedesktop:
|
||||
case bobdaemon:
|
||||
case bobdesktop:
|
||||
File bisqDataDir = new File(config.rootAppDataDir, bisqAppConfig.appName);
|
||||
File bisqDataDir = new File(config.rootAppDataDir, havenoAppConfig.appName);
|
||||
if (!bisqDataDir.exists())
|
||||
throw new IllegalStateException(format("Application dataDir %s/%s not found",
|
||||
config.rootAppDataDir, bisqAppConfig.appName));
|
||||
config.rootAppDataDir, havenoAppConfig.appName));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -152,7 +152,7 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess
|
|||
String classpath = System.getProperty("java.class.path");
|
||||
String bisqCmd = getJavaOptsSpec()
|
||||
+ " " + java + " -cp " + classpath
|
||||
+ " " + bisqAppConfig.mainClassName
|
||||
+ " " + havenoAppConfig.mainClassName
|
||||
+ " " + String.join(" ", getOptsList())
|
||||
+ " &"; // run in background without nohup
|
||||
runBashCommand(bisqCmd);
|
||||
|
@ -163,7 +163,7 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess
|
|||
// are loaded from the root project's lib directory.
|
||||
private void runStartupScript() throws IOException, InterruptedException {
|
||||
String startupScriptPath = config.rootProjectDir
|
||||
+ "/" + bisqAppConfig.startupScript;
|
||||
+ "/" + havenoAppConfig.startupScript;
|
||||
String bisqCmd = getJavaOptsSpec()
|
||||
+ " " + startupScriptPath
|
||||
+ " " + String.join(" ", getOptsList())
|
||||
|
@ -173,15 +173,15 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess
|
|||
|
||||
private void runBashCommand(String bisqCmd) throws IOException, InterruptedException {
|
||||
String cmdDescription = config.runSubprojectJars
|
||||
? "java -> " + bisqAppConfig.mainClassName + " -> " + bisqAppConfig.appName
|
||||
: bisqAppConfig.startupScript + " -> " + bisqAppConfig.appName;
|
||||
? "java -> " + havenoAppConfig.mainClassName + " -> " + havenoAppConfig.appName
|
||||
: havenoAppConfig.startupScript + " -> " + havenoAppConfig.appName;
|
||||
BashCommand bashCommand = new BashCommand(bisqCmd);
|
||||
log.info("Starting {} ...\n$ {}", cmdDescription, bashCommand.getCommand());
|
||||
bashCommand.runInBackground();
|
||||
|
||||
if (bashCommand.getExitStatus() != 0)
|
||||
throw new IllegalStateException(format("Error starting BisqApp%n%s%nError: %s",
|
||||
bisqAppConfig.appName,
|
||||
havenoAppConfig.appName,
|
||||
bashCommand.getError()));
|
||||
|
||||
// Sometimes it takes a little extra time to find the linux process id.
|
||||
|
@ -197,26 +197,26 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess
|
|||
throw new IllegalStateException(format("Error finding pid for %s", this.name));
|
||||
|
||||
log.info("{} running with pid {}", cmdDescription, pid);
|
||||
log.info("Log {}", config.rootAppDataDir + "/" + bisqAppConfig.appName + "/bisq.log");
|
||||
log.info("Log {}", config.rootAppDataDir + "/" + havenoAppConfig.appName + "/bisq.log");
|
||||
}
|
||||
|
||||
private long findBisqAppPid() throws IOException, InterruptedException {
|
||||
// Find the pid of the java process by grepping for the mainClassName and appName.
|
||||
String findPidCmd = findBisqPidScript + " " + bisqAppConfig.mainClassName + " " + bisqAppConfig.appName;
|
||||
String findPidCmd = findBisqPidScript + " " + havenoAppConfig.mainClassName + " " + havenoAppConfig.appName;
|
||||
String psCmdOutput = new BashCommand(findPidCmd).run().getOutput();
|
||||
return (psCmdOutput == null || psCmdOutput.isEmpty()) ? -1 : Long.parseLong(psCmdOutput);
|
||||
}
|
||||
|
||||
private String getJavaOptsSpec() {
|
||||
return "export JAVA_OPTS=\"" + bisqAppConfig.javaOpts + debugOpts + "\"; ";
|
||||
return "export JAVA_OPTS=\"" + havenoAppConfig.javaOpts + debugOpts + "\"; ";
|
||||
}
|
||||
|
||||
private List<String> getOptsList() {
|
||||
return new ArrayList<>() {{
|
||||
add("--appName=" + bisqAppConfig.appName);
|
||||
add("--appDataDir=" + config.rootAppDataDir.getAbsolutePath() + "/" + bisqAppConfig.appName);
|
||||
add("--nodePort=" + bisqAppConfig.nodePort);
|
||||
add("--rpcBlockNotificationPort=" + bisqAppConfig.rpcBlockNotificationPort);
|
||||
add("--appName=" + havenoAppConfig.appName);
|
||||
add("--appDataDir=" + config.rootAppDataDir.getAbsolutePath() + "/" + havenoAppConfig.appName);
|
||||
add("--nodePort=" + havenoAppConfig.nodePort);
|
||||
add("--rpcBlockNotificationPort=" + havenoAppConfig.rpcBlockNotificationPort);
|
||||
add("--rpcUser=" + config.bitcoinRpcUser);
|
||||
add("--rpcPassword=" + config.bitcoinRpcPassword);
|
||||
add("--rpcPort=" + config.bitcoinRpcPort);
|
||||
|
@ -224,7 +224,7 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess
|
|||
add("--baseCurrencyNetwork=" + baseCurrencyNetwork);
|
||||
add("--useDevPrivilegeKeys=" + useDevPrivilegeKeys);
|
||||
add("--useLocalhostForP2P=" + useLocalhostForP2P);
|
||||
switch (bisqAppConfig) {
|
||||
switch (havenoAppConfig) {
|
||||
case seednode:
|
||||
break; // no extra opts needed for seed node
|
||||
case arbdaemon:
|
||||
|
@ -235,13 +235,13 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess
|
|||
case bobdesktop:
|
||||
add("--genesisBlockHeight=" + genesisBlockHeight);
|
||||
add("--genesisTxId=" + genesisTxId);
|
||||
if (bisqAppConfig.mainClassName.equals(HavenoDaemonMain.class.getName())) {
|
||||
if (havenoAppConfig.mainClassName.equals(HavenoDaemonMain.class.getName())) {
|
||||
add("--apiPassword=" + config.apiPassword);
|
||||
add("--apiPort=" + bisqAppConfig.apiPort);
|
||||
add("--apiPort=" + havenoAppConfig.apiPort);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("Unknown BisqAppConfig " + bisqAppConfig.name());
|
||||
throw new IllegalStateException("Unknown HavenoAppConfig " + havenoAppConfig.name());
|
||||
}
|
||||
}};
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess
|
|||
private File getJavaExecutable() {
|
||||
File javaHome = Paths.get(System.getProperty("java.home")).toFile();
|
||||
if (!javaHome.exists())
|
||||
throw new IllegalStateException(format("$JAVA_HOME not found, cannot run %s", bisqAppConfig.mainClassName));
|
||||
throw new IllegalStateException(format("$JAVA_HOME not found, cannot run %s", havenoAppConfig.mainClassName));
|
||||
|
||||
File javaExecutable = Paths.get(javaHome.getAbsolutePath(), "bin", "java").toFile();
|
||||
if (javaExecutable.exists() || javaExecutable.canExecute())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue