git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
1828f01
)
JAL-4160 JAL-3830 Improve jalview.bin.Launcher for launcher script launch with new...
author
Ben Soares
<b.soares@dundee.ac.uk>
Sat, 20 May 2023 09:59:53 +0000
(10:59 +0100)
committer
Ben Soares
<b.soares@dundee.ac.uk>
Sat, 20 May 2023 09:59:53 +0000
(10:59 +0100)
src/jalview/bin/Launcher.java
patch
|
blob
|
history
diff --git
a/src/jalview/bin/Launcher.java
b/src/jalview/bin/Launcher.java
index
c5268fa
..
2155f8d
100644
(file)
--- a/
src/jalview/bin/Launcher.java
+++ b/
src/jalview/bin/Launcher.java
@@
-26,6
+26,7
@@
import java.lang.management.ManagementFactory;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
+import java.util.concurrent.TimeUnit;
import jalview.util.ChannelProperties;
import jalview.util.LaunchUtils;
import jalview.util.ChannelProperties;
import jalview.util.LaunchUtils;
@@
-91,10
+92,12
@@
public class Launcher
String jvmmempc = null;
String jvmmemmax = null;
boolean debug = false;
String jvmmempc = null;
String jvmmemmax = null;
boolean debug = false;
- boolean help = false;
+ boolean wait = true;
boolean quiet = false;
boolean quiet = false;
+ // must set --debug before --launcher...
boolean launcherstop = false;
boolean launcherprint = false;
boolean launcherstop = false;
boolean launcherprint = false;
+ boolean launcherwait = false;
ArrayList<String> arguments = new ArrayList<>();
for (String arg : args)
{
ArrayList<String> arguments = new ArrayList<>();
for (String arg : args)
{
@@
-106,18
+109,30
@@
public class Launcher
{
quiet = true;
}
{
quiet = true;
}
- if (arg.equals("--help") || arg.startsWith("--help-"))
- {
- help = true;
- }
- if (arg.equals("--launcherprint"))
+ if (debug && arg.equals("--launcherprint"))
{
launcherprint = true;
}
{
launcherprint = true;
}
- if (arg.equals("--launcherstop"))
+ if (debug && arg.equals("--launcherstop"))
{
launcherstop = true;
}
{
launcherstop = true;
}
+ if (debug && arg.equals("--launcherwait"))
+ {
+ launcherwait = true;
+ }
+ // these quite immediately
+ if (arg.equals("--version") || arg.equals("--help")
+ || arg.startsWith("--help-")
+ || (debug && arg.equals("--launchernowait")))
+ {
+ wait = false;
+ }
+ // Don't add the --launcher... args to Jalview launch
+ if (arg.startsWith("--launcher"))
+ {
+ continue;
+ }
// jvmmempc and jvmmemmax args used to set memory and are not passed on to
// startClass
if (arg.startsWith(
// jvmmempc and jvmmemmax args used to set memory and are not passed on to
// startClass
if (arg.startsWith(
@@
-233,11
+248,8
@@
public class Launcher
String scalePropertyArg = HiDPISetting.getScalePropertyArg();
if (scalePropertyArg != null)
{
String scalePropertyArg = HiDPISetting.getScalePropertyArg();
if (scalePropertyArg != null)
{
- if (debug && !quiet)
- {
- System.out.println("Running " + startClass + " with scale setting "
- + scalePropertyArg);
- }
+ sysout(debug, quiet, "Running " + startClass + " with scale setting "
+ + scalePropertyArg);
command.add(scalePropertyArg);
}
command.add(scalePropertyArg);
}
@@
-246,35
+258,41
@@
public class Launcher
final ProcessBuilder builder = new ProcessBuilder(command);
final ProcessBuilder builder = new ProcessBuilder(command);
- if (!quiet && (Boolean
- .parseBoolean(System.getProperty("launcherprint", "false"))
- || (debug && launcherprint)))
+ if ((Boolean.parseBoolean(System.getProperty("launcherprint", "false"))
+ || launcherprint))
{
{
- System.out.println(
+ sysout(debug, quiet,
"LAUNCHER COMMAND: " + String.join(" ", builder.command()));
}
"LAUNCHER COMMAND: " + String.join(" ", builder.command()));
}
- if (debug && !quiet)
- {
- System.out.println("Running " + startClass + " with "
- + (memSetting == null ? "no memory setting"
- : ("memory setting " + memSetting)));
- }
+ sysout(debug, quiet,
+ "Running " + startClass + " with "
+ + (memSetting == null ? "no memory setting"
+ : ("memory setting " + memSetting)));
if (Boolean.parseBoolean(System.getProperty("launcherstop", "false"))
|| (debug && launcherstop))
{
if (Boolean.parseBoolean(System.getProperty("launcherstop", "false"))
|| (debug && launcherstop))
{
- if (!quiet)
- {
- System.out.println(
- "System property 'launcherstop' is set and not 'false'. Exiting.");
- }
+ sysout(debug, quiet,
+ "System property 'launcherstop' is set and not 'false'. Exiting.");
System.exit(0);
}
try
{
builder.inheritIO();
Process process = builder.start();
System.exit(0);
}
try
{
builder.inheritIO();
Process process = builder.start();
- process.waitFor();
+ if (wait || launcherwait)
+ {
+ sysout(debug, quiet, "Launching application process");
+ process.waitFor();
+ }
+ else
+ {
+ int waitInt = 0;
+ sysout(debug, quiet,
+ "Wait time for application process is " + waitInt + "ms");
+ process.waitFor(waitInt, TimeUnit.MILLISECONDS);
+ }
+ sysout(debug, quiet, "Launcher process ending");
} catch (IOException e)
{
if (e.getMessage().toLowerCase(Locale.ROOT).contains("memory"))
} catch (IOException e)
{
if (e.getMessage().toLowerCase(Locale.ROOT).contains("memory"))
@@
-314,4
+332,12
@@
public class Launcher
}
}
}
}
+ private static void sysout(boolean debug, boolean quiet, String message)
+ {
+ if (debug && !quiet)
+ {
+ System.out.println("LAUNCHERDEBUG - " + message);
+ }
+ }
+
}
}