From bfdbe00e3d0638b46a29ca408c91c0e17d832661 Mon Sep 17 00:00:00 2001 From: Markus Alexander Kuppe <tlaplus.net@lemmster.de> Date: Wed, 18 Jul 2018 06:37:40 +0200 Subject: [PATCH] Install Oracle JDK 8 if doJFR requested. See previous commit for context. With OpenJDK 11 this won't hopefully be no issue anymore. (http://openjdk.java.net/jeps/328) [Bug][Toolbox] --- .../jcloud/CloudDistributedTLCJob.java | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/org.lamport.tla.toolbox.jclouds/src/org/lamport/tla/toolbox/jcloud/CloudDistributedTLCJob.java b/org.lamport.tla.toolbox.jclouds/src/org/lamport/tla/toolbox/jcloud/CloudDistributedTLCJob.java index c44b6b667..6c23c9d0e 100644 --- a/org.lamport.tla.toolbox.jclouds/src/org/lamport/tla/toolbox/jcloud/CloudDistributedTLCJob.java +++ b/org.lamport.tla.toolbox.jclouds/src/org/lamport/tla/toolbox/jcloud/CloudDistributedTLCJob.java @@ -278,21 +278,21 @@ public class CloudDistributedTLCJob extends Job { // Send remote TLC's stdout to local stdout (this throws a TransportException // unless shutdown is postponed by a few minutes above). ByteStreams.copy(channel.getOutput(), System.out); -// if (doJfr) { -// // Get Java Flight Recording from remote machine and save if to a local file in -// // the current working directory. We call "cat" because sftclient#get fails with -// // the old net.schmizz.sshj and an update to the newer com.hierynomus seems -// // awful lot of work. -// channel = sshClient.execChannel("cat /mnt/tlc/tlc.jfr"); -// final InputStream output = channel.getOutput(); -// final String cwd = Paths.get(".").toAbsolutePath().normalize().toString() + File.separator; -// final File jfr = new File(cwd + "tlc.jfr"); -// ByteStreams.copy(output, new FileOutputStream(jfr)); -// if (jfr.length() == 0) { -// System.err.println("Received empty Java Flight recording. Not creating tlc.jfr file"); -// jfr.delete(); -// } -// } + if (doJfr) { + // Get Java Flight Recording from remote machine and save if to a local file in + // the current working directory. We call "cat" because sftclient#get fails with + // the old net.schmizz.sshj and an update to the newer com.hierynomus seems + // awful lot of work. + channel = sshClient.execChannel("cat /mnt/tlc/tlc.jfr"); + final InputStream output = channel.getOutput(); + final String cwd = Paths.get(".").toAbsolutePath().normalize().toString() + File.separator; + final File jfr = new File(cwd + "tlc.jfr"); + ByteStreams.copy(output, new FileOutputStream(jfr)); + if (jfr.length() == 0) { + System.err.println("Received empty Java Flight recording. Not creating tlc.jfr file"); + jfr.delete(); + } + } // Finally close the ssh connection. sshClient.disconnect(); monitor.subTask("TLC model checker process finished"); @@ -547,6 +547,8 @@ public class CloudDistributedTLCJob extends Job { + " && " + params.getHostnameSetup() + " && " + // Oracle Java 8 + + (doJfr ? "add-apt-repository ppa:webupd8team/java -y && " : "/bin/true && ") // Accept license before apt (dpkg) tries to present it to us (which fails due to 'noninteractive' mode below) // see http://stackoverflow.com/a/19391042 + "echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections && " @@ -594,6 +596,8 @@ public class CloudDistributedTLCJob extends Job { + "apt-get install --no-install-recommends mdadm e2fsprogs screen zip unattended-upgrades " + params.getExtraPackages() + " -y" + " && " + + (doJfr ? "apt-get install --no-install-recommends oracle-java8-installer oracle-java8-set-default -y " : "/bin/true") + + " && " // Delegate file system tuning to cloud specific code. + params.getOSFilesystemTuning() // Install Oracle Java8. It supports Java Mission -- GitLab