public void addOptions(JvmElement jvmElement, List<String> command) { if (jvmElement == null) { throw HostControllerLogger.ROOT_LOGGER.nullVar("jvm"); } if (command == null) { throw HostControllerLogger.ROOT_LOGGER.nullVar("command"); } JvmOptionsBuilder builder = BUILDERS.get(jvmElement.getJvmType()); if (builder == null) { throw HostControllerLogger.ROOT_LOGGER.unknown("jvm", jvmElement.getJvmType()); } builder.addToOptions(jvmElement, command); }
@Override void addPermGen(JvmElement jvmElement, List<String> command) { String permgen = jvmElement.getPermgenSize(); String maxPermgen = jvmElement.getMaxPermgen(); if (maxPermgen == null && permgen != null) { maxPermgen = permgen; } if (permgen == null && maxPermgen != null) { permgen = maxPermgen; } if (permgen != null) { command.add("-XX:PermSize=" + permgen); } if (maxPermgen != null) { command.add("-XX:MaxPermSize=" + maxPermgen); } }
public static void addJvmOption(JvmElement element, String value) { element.getJvmOptions().addOption(value); }
public static void setJavaagent(JvmElement element, String value) { element.setJavaagent(value); }
public static void setAgentPath(JvmElement element, String value) { element.setAgentPath(value); }
public static void setStack(JvmElement element, String value) { element.setStack(value); }
public static void setMaxPermgen(JvmElement element, String value) { element.setMaxPermgen(value); }
public static void setPermgenSize(JvmElement element, String value) { element.setPermgenSize(value); }
public static void setMaxHeap(JvmElement element, String value) { element.setMaxHeap(value); }
public static void setHeapSize(JvmElement element, String value) { element.setHeapSize(value); }
public static void setDebugOptions(JvmElement element, String value) { element.setDebugOptions(value); }
public static void setDebugEnabled(JvmElement element, boolean value) { element.setDebugEnabled(value); }
public static JvmElement create(JvmType type) { JvmElement element = new JvmElement("test"); element.setJvmType(type); return element; }
void addToOptions(JvmElement jvmElement, List<String> command) { String heap = jvmElement.getHeapSize(); String maxHeap = jvmElement.getMaxHeap(); // FIXME not the correct place to establish defaults if (maxHeap == null && heap != null) { maxHeap = heap; } if (heap == null && maxHeap != null) { heap = maxHeap; } addPermGen(jvmElement, command); // Add to command if (heap != null) { command.add("-Xms" + heap); } if (maxHeap != null) { command.add("-Xmx" + maxHeap); } if (jvmElement.getStack() != null) { command.add("-Xss" + jvmElement.getStack()); } if (jvmElement.getAgentPath() != null) { command.add("-agentpath:" + jvmElement.getAgentPath()); } if (jvmElement.getAgentLib() != null) { command.add("-agentlib:" + jvmElement.getAgentLib()); } if (jvmElement.getJavaagent() != null) { command.add("-javaagent:" + jvmElement.getJavaagent()); } if (jvmElement.isDebugEnabled() != null && jvmElement.isDebugEnabled() && jvmElement.getDebugOptions() != null) { command.add(jvmElement.getDebugOptions()); } List<String> options = jvmElement.getJvmOptions().getOptions(); if (options.size() > 0) { String jvmName = jvmElement.getName(); for (String option : options) { if (!checkOption( heap != null && option.startsWith("-Xms"), jvmName, option, Element.HEAP.toString())) { continue; } if (!checkOption( maxHeap != null && option.startsWith("-Xmx"), jvmName, option, Element.HEAP.toString())) { continue; } if (!checkOption( jvmElement.getStack() != null && option.startsWith("-Xss"), jvmName, option, Element.STACK.toString())) { continue; } if (!checkOption( jvmElement.isDebugEnabled() != null && jvmElement.isDebugEnabled() && jvmElement.getDebugOptions() != null && (option.startsWith("-Xrunjdwp") || option.startsWith("-agentlib:jdwp")), jvmName, option, Attribute.DEBUG_OPTIONS.toString())) { continue; } if (!checkOption( jvmElement.getAgentPath() != null && option.startsWith("-agentpath:"), jvmName, option, Element.AGENT_PATH.toString())) { continue; } if (!checkOption( jvmElement.getAgentLib() != null && option.startsWith("-agentlib:"), jvmName, option, Element.AGENT_LIB.toString())) { continue; } if (!checkOption( jvmElement.getAgentLib() != null && option.startsWith("-javaagent:"), jvmName, option, Element.AGENT_LIB.toString())) { continue; } if (!checkOption( jvmElement.getJavaagent() != null && option.startsWith("-Xmx"), jvmName, option, Element.JAVA_AGENT.toString())) { continue; } if (!checkOption( jvmElement.getJavaagent() != null && option.startsWith("-XX:PermSize"), jvmName, option, Element.PERMGEN.toString())) { continue; } if (!checkOption( jvmElement.getJavaagent() != null && option.startsWith("-XX:MaxPermSize"), jvmName, option, Element.PERMGEN.toString())) { continue; } command.add(option); } } }
@Override void addPermGen(JvmElement jvmElement, List<String> command) { if (jvmElement.getPermgenSize() != null || jvmElement.getMaxPermgen() != null) { ROOT_LOGGER.ignoringPermGen(type, jvmElement.getName()); } }