Skip to content

Commit a3b1848

Browse files
committed
FISH-12969 Payara Server Startup Fails in VSCODE Due to the CRaCCheckpointTo Option
1 parent d146828 commit a3b1848

2 files changed

Lines changed: 34 additions & 3 deletions

File tree

src/main/fish/payara/server/start/JDKVersion.ts

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { workspace } from 'vscode';
2323
import * as _ from "lodash";
2424
import * as fse from "fs-extra";
2525
import * as cp from 'child_process';
26+
import * as path from "path";
2627
import { JavaUtils } from '../tooling/utils/JavaUtils';
2728

2829
export class JDKVersion {
@@ -291,11 +292,16 @@ export class JDKVersion {
291292
}
292293
}
293294

294-
public static isCorrectJDK(jdkVersion: JDKVersion,
295+
public static isCorrectJDK(
296+
jdkVersion: JDKVersion,
295297
vendor: string | undefined,
296298
minVersion: JDKVersion | undefined,
297-
maxVersion: JDKVersion | undefined): boolean {
299+
maxVersion: JDKVersion | undefined,
300+
jvmOption: string | undefined,
301+
javaHome: string | undefined): boolean {
302+
298303
let correctJDK: boolean = true;
304+
299305
if (vendor !== undefined) {
300306
let jdkVendor: string | undefined = jdkVersion.getVendor();
301307
if (jdkVendor) {
@@ -304,15 +310,33 @@ export class JDKVersion {
304310
correctJDK = false;
305311
}
306312
}
313+
307314
if (correctJDK && minVersion) {
308315
correctJDK = jdkVersion.ge(minVersion);
309316
}
317+
310318
if (correctJDK && maxVersion) {
311319
correctJDK = jdkVersion.le(maxVersion);
312320
}
321+
322+
if (correctJDK &&
323+
jvmOption &&
324+
/^-XX:[+-]?CRaC.*/.test(jvmOption)) {
325+
326+
correctJDK = JDKVersion.isCRaCJDK(javaHome);
327+
}
328+
313329
return correctJDK;
314330
}
315331

332+
public static isCRaCJDK(javaHome: string | undefined): boolean {
333+
if (!javaHome) {
334+
return false;
335+
}
336+
const criuPath = path.join(javaHome, "lib", "criu");
337+
return fse.pathExistsSync(criuPath);
338+
}
339+
316340
/**
317341
* Parses the java version text
318342
*

src/main/fish/payara/server/start/StartTask.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,14 @@ export class StartTask {
4848
let optList: Array<string> = new Array<string>();
4949

5050
for (const jvmOption of jvmConfigReader.getJvmOptions()) {
51-
if (JDKVersion.isCorrectJDK(javaVersion, jvmOption.vendor, jvmOption.minVersion, jvmOption.maxVersion)) {
51+
if (JDKVersion.isCorrectJDK(
52+
javaVersion,
53+
jvmOption.vendor,
54+
jvmOption.minVersion,
55+
jvmOption.maxVersion,
56+
jvmOption.option,
57+
javaHome)) {
58+
5259
optList.push(jvmOption.option);
5360
}
5461
}

0 commit comments

Comments
 (0)