X Tutup
The Wayback Machine - https://web.archive.org/web/20201221072814/https://github.com/redhat-developer/vscode-java/pull/861
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

override defaults for containers #861

Draft
wants to merge 1 commit into
base: master
from

Conversation

@gorkem
Copy link
Member

@gorkem gorkem commented Mar 28, 2019

Overrides default JVM values when started on a container.

src/javaServerStarter.ts Outdated
import { StreamInfo, Executable, ExecutableOptions } from 'vscode-languageclient';
import { RequirementsData } from './requirements';
import { getJavaEncoding } from './settings';

declare var v8debug;
const DEBUG = (typeof v8debug === 'object') || startedInDebugMode();
const DEFAULT_VM_ARGS = '-noverify -Xmx1G -XX:+UseG1GC -XX:+UseStringDeduplication';

This comment has been minimized.

@fbricon

fbricon Mar 28, 2019
Collaborator

I'm not sure if there's a way to get the default pref value from the VS Code API, but if you can't, you can instead read the default value from the package.json directly with something like

 let extensionPackage = require(ExtensionContext.asAbsolutePath('./package.json'));

This comment has been minimized.

@fbricon

fbricon Mar 28, 2019
Collaborator

See WorkspaceConfiguration.inspect(key).defaultValue

src/javaServerStarter.ts Outdated
@@ -61,6 +63,9 @@ function prepareParams(requirements: RequirementsData, javaConfiguration, worksp
}

let vmargs = javaConfiguration.get('jdt.ls.vmargs', '');
if( DEFAULT_VM_ARGS === vmargs && isDocker() ) {
vmargs = '-XX:+UseContainerSupport -XX:MaxRAMPercentage=80';

This comment has been minimized.

@fbricon

fbricon Mar 28, 2019
Collaborator

you're losing -noverify -XX:+UseG1GC -XX:+UseStringDeduplication

src/javaServerStarter.ts Outdated
@@ -61,6 +63,9 @@ function prepareParams(requirements: RequirementsData, javaConfiguration, worksp
}

let vmargs = javaConfiguration.get('jdt.ls.vmargs', '');
if( DEFAULT_VM_ARGS === vmargs && isDocker() ) {

This comment has been minimized.

@fbricon

fbricon Mar 28, 2019
Collaborator

DEFAULT_VM_ARGS = javaConfiguration.inspect('jdt.ls.vmargs').defaultValue

@snjeza
Copy link
Contributor

@snjeza snjeza commented Mar 28, 2019

"-XX:+UseContainerSupport -XX:MaxRAMPercentage=80" requires JDK 10.
Che-7 uses JDK 8 - https://github.com/eclipse/che-plugin-registry/blob/master/plugins/org.eclipse.che.vscode-redhat.java/0.38.0/meta.yaml

@gorkem
Copy link
Member Author

@gorkem gorkem commented Mar 29, 2019

@snjeza -XX:+UseContainerSupport has been back ported to java8u191, changelog

@snjeza
Copy link
Contributor

@snjeza snjeza commented Mar 29, 2019

@gorkem I have added '-XX:+UseContainerSupport -XX:MaxRAMPercentage=80' to JDK 1.8.0_201 and got the following error:

Improperly specified VM option 'MaxRAMPercentage=80'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
@snjeza
Copy link
Contributor

@snjeza snjeza commented Mar 30, 2019

JDK 1.8.0_201 recognizes '-XX:+UseContainerSupport -XX:MaxRAMPercentage=80.0' . See https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8219312

…rted on a container.
@gorkem gorkem force-pushed the gorkem:container_start branch to 2f2aa09 Mar 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.
X Tutup