Details
-
Feature Request
-
Resolution: Done
-
Major
-
7.0.0.Final
-
None
Description
An problem I ran into with using AS7 in a constrained environment that limited the number of processes/threads a user could create was the number of threads being created for the bootstrap service container. It would be useful if the ServiceContainer.ContainerExecutor thread pool max threads was externalized. The higher the core count the more threads are wasted if the purpose is to have as many AS7 instances running as possible as is the case with the openshift express environment.
One simple approach would be to externalize this via a system property that could be added to the ServerEnvironment ala:
diff --git a/server/src/main/java/org/jboss/as/server/BootstrapImpl.java b/server/src/main/java/org/jboss/as/server/BootstrapImpl.java index 60c78e7..3d93c5b 100644 --- a/server/src/main/java/org/jboss/as/server/BootstrapImpl.java +++ b/server/src/main/java/org/jboss/as/server/BootstrapImpl.java @@ -23,6 +23,7 @@ package org.jboss.as.server; import java.util.List; +import java.util.concurrent.TimeUnit; import org.jboss.as.controller.persistence.ConfigurationPersister; import org.jboss.modules.Module; @@ -46,7 +47,14 @@ import org.jboss.threads.JBossExecutors; * @author <a href="mailto:david.lloyd@redhat.com">David M. Lloyd</a> */ final class BootstrapImpl implements Bootstrap { - private final ServiceContainer container = ServiceContainer.Factory.create("jboss-as"); + private static int MAX_THREADS = 2; + static { + String maxThreads = SecurityActions.getSystemProperty("org.jboss.server.bootstrap.maxThreads"); + if(maxThreads != null) { + MAX_THREADS = Integer.decode(maxThreads); + } + } + private final ServiceContainer container = ServiceContainer.Factory.create("jboss-as", MAX_THREADS, 30, TimeUnit.SECONDS);