Skip to content

Commit

Permalink
Merge pull request #8840 from vespa-engine/gjoranv/container-isHosted
Browse files Browse the repository at this point in the history
Remove unnecessary use of 'isHostedVespa' in Containers.
  • Loading branch information
gjoranv committed Mar 19, 2019
2 parents 62dc056 + ea26234 commit 57165ee
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 23 deletions.
Expand Up @@ -16,7 +16,7 @@ public class LogserverContainer extends Container {
private final boolean useSeparateServiceTypeForLogserverContainer;

public LogserverContainer(AbstractConfigProducer parent, boolean useSeparateServiceTypeForLogserverContainer) {
super(parent, "" + 0, 0, true);
super(parent, "" + 0, 0);
this.useSeparateServiceTypeForLogserverContainer = useSeparateServiceTypeForLogserverContainer;
}

Expand Down
Expand Up @@ -37,7 +37,7 @@ public class ClusterControllerContainer extends Container implements
private final Set<String> bundles = new TreeSet<>();

public ClusterControllerContainer(AbstractConfigProducer parent, int index, boolean runStandaloneZooKeeper, boolean isHosted) {
super(parent, "" + index, index, isHosted);
super(parent, "" + index, index);
this.index = index;
addHandler(
new Handler(new ComponentModel(new BundleInstantiationSpecification(
Expand Down
Expand Up @@ -11,12 +11,18 @@
*/
public final class ApplicationContainer extends Container {

private static final String defaultHostedJVMArgs = "-XX:+UseOSErrorReporting -XX:+SuppressFatalErrorMessage";

private final boolean isHostedVespa;


public ApplicationContainer(AbstractConfigProducer parent, String name, int index, boolean isHostedVespa) {
super(parent, name, index, isHostedVespa);
this(parent, name, false, index, isHostedVespa);
}

public ApplicationContainer(AbstractConfigProducer parent, String name, boolean retired, int index, boolean isHostedVespa) {
super(parent, name, retired, index, isHostedVespa);
super(parent, name, retired, index);
this.isHostedVespa = isHostedVespa;
}

@Override
Expand All @@ -31,4 +37,17 @@ protected ContainerServiceType myServiceType() {
return ContainerServiceType.CONTAINER;
}

/** Returns the jvm arguments this should start with */
@Override
public String getJvmOptions() {
String jvmArgs = super.getJvmOptions();
return isHostedVespa && hasDocproc()
? ("".equals(jvmArgs) ? defaultHostedJVMArgs : defaultHostedJVMArgs + " " + jvmArgs)
: jvmArgs;
}

private boolean hasDocproc() {
return (parent instanceof ContainerCluster) && (((ContainerCluster)parent).getDocproc() != null);
}

}
Expand Up @@ -54,7 +54,6 @@ public abstract class Container extends AbstractService implements

protected final AbstractConfigProducer parent;
private final String name;
private final boolean isHostedVespa;
private boolean requireSpecificPorts = true;

private String clusterName = null;
Expand All @@ -72,16 +71,15 @@ public abstract class Container extends AbstractService implements

private final int numHttpServerPorts;
private static final int numRpcServerPorts = 2;
private static final String defaultHostedJVMArgs = "-XX:+UseOSErrorReporting -XX:+SuppressFatalErrorMessage";

public Container(AbstractConfigProducer parent, String name, int index, boolean isHostedVespa) {
this(parent, name, false, index, isHostedVespa);
protected Container(AbstractConfigProducer parent, String name, int index) {
this(parent, name, false, index);
}
public Container(AbstractConfigProducer parent, String name, boolean retired, int index, boolean isHostedVespa) {

protected Container(AbstractConfigProducer parent, String name, boolean retired, int index) {
super(parent, name);
this.name = name;
this.parent = parent;
this.isHostedVespa = isHostedVespa;
this.retired = retired;
this.index = index;

Expand Down Expand Up @@ -187,10 +185,6 @@ private void initDefaultJettyConnector() {
defaultHttpServer.addConnector(new ConnectorFactory("SearchServer", getSearchPort()));
}

private boolean hasDocproc() {
return (parent instanceof ContainerCluster) && (((ContainerCluster)parent).getDocproc() != null);
}

private ContainerServiceType myServiceType = null;

/** Subclasses must implement {@link #myServiceType()} for a custom service name. */
Expand Down Expand Up @@ -321,15 +315,6 @@ public void getConfig(QrConfig.Builder builder) {
}
}

/** Returns the jvm arguments this should start with */
@Override
public String getJvmOptions() {
String jvmArgs = super.getJvmOptions();
return isHostedVespa && hasDocproc()
? ("".equals(jvmArgs) ? defaultHostedJVMArgs : defaultHostedJVMArgs + " " + jvmArgs)
: jvmArgs;
}

/** Returns the jvm args set explicitly for this node */
public String getAssignedJvmOptions() { return super.getJvmOptions(); }

Expand Down

0 comments on commit 57165ee

Please sign in to comment.