public class WeldBootstrapService extends Object implements org.jboss.msc.Service
| Modifier and Type | Field and Description |
|---|---|
static org.jboss.msc.service.ServiceName |
INTERNAL_SERVICE_NAME
The actual service name the bootstrap service is installed under.
|
static org.jboss.msc.service.ServiceName |
SERVICE_NAME
The service name that external services depend on
|
| Constructor and Description |
|---|
WeldBootstrapService(WeldDeployment deployment,
org.jboss.weld.bootstrap.api.Environment environment,
String deploymentName,
Consumer<WeldBootstrapService> weldBootstrapServiceConsumer,
Supplier<org.jboss.weld.manager.api.ExecutorServices> executorServicesSupplier,
Supplier<ExecutorService> serverExecutorSupplier,
Supplier<org.jboss.weld.security.spi.SecurityServices> securityServicesSupplier,
Supplier<org.jboss.weld.transaction.spi.TransactionServices> weldTransactionServicesSupplier,
org.jboss.msc.service.ServiceName deploymentServiceName,
org.jboss.msc.service.ServiceName weldBootstrapServiceName) |
| Modifier and Type | Method and Description |
|---|---|
<T extends org.jboss.weld.bootstrap.api.Service> |
addWeldService(Class<T> type,
T service)
Adds a
Service to the deployment. |
Set<org.jboss.weld.bootstrap.spi.BeanDeploymentArchive> |
getBeanDeploymentArchives()
get all beans deployment archives in the deployment
|
org.jboss.weld.manager.BeanManagerImpl |
getBeanManager()
Gets the
BeanManager linked to the root bean deployment archive. |
org.jboss.weld.manager.BeanManagerImpl |
getBeanManager(String beanArchiveId)
Gets the
BeanManager for a given bean deployment archive id. |
boolean |
isStarted() |
void |
start(org.jboss.msc.service.StartContext context)
Starts the weld container
|
void |
stop(org.jboss.msc.service.StopContext context)
This is a no-op if
WeldStartService.start(StartContext) completes normally and the shutdown is performed in
WeldStartService.stop(org.jboss.msc.service.StopContext). |
public static final org.jboss.msc.service.ServiceName SERVICE_NAME
public static final org.jboss.msc.service.ServiceName INTERNAL_SERVICE_NAME
The reasons for this dual service name setup is kinda complex, and relates to https://issues.redhat.com/browse/JBEAP-18634 Because Weld cannot be restarted if an attempt is made to restart the service then we need to bail out and restart the whole deployment.
If we just do a check in the start method that looks like: if (restartRequired) { doRestart(); return; } Then the service startup will technically complete successfully, and dependent services can still start before the restart actually takes effect (as MSC is directional, it keep starting services that have all their dependencies met before it start to take services down).
To get around this we use two different service names, with the service that other services depend on only being installed at the end of the start() method. This means that in the case of a restart this will not be installed, so no dependent services will be started as they are missing their dependency.
public WeldBootstrapService(WeldDeployment deployment, org.jboss.weld.bootstrap.api.Environment environment, String deploymentName, Consumer<WeldBootstrapService> weldBootstrapServiceConsumer, Supplier<org.jboss.weld.manager.api.ExecutorServices> executorServicesSupplier, Supplier<ExecutorService> serverExecutorSupplier, Supplier<org.jboss.weld.security.spi.SecurityServices> securityServicesSupplier, Supplier<org.jboss.weld.transaction.spi.TransactionServices> weldTransactionServicesSupplier, org.jboss.msc.service.ServiceName deploymentServiceName, org.jboss.msc.service.ServiceName weldBootstrapServiceName)
public void start(org.jboss.msc.service.StartContext context)
start in interface org.jboss.msc.ServiceIllegalStateException - if the container is already runningpublic void stop(org.jboss.msc.service.StopContext context)
WeldStartService.start(StartContext) completes normally and the shutdown is performed in
WeldStartService.stop(org.jboss.msc.service.StopContext).stop in interface org.jboss.msc.Servicepublic org.jboss.weld.manager.BeanManagerImpl getBeanManager(String beanArchiveId)
BeanManager for a given bean deployment archive id.IllegalStateException - if the container is not runningIllegalArgumentException - if the bean deployment archive id is not foundpublic <T extends org.jboss.weld.bootstrap.api.Service> void addWeldService(Class<T> type, T service)
Service to the deployment. This method must not be called after the container has startedpublic org.jboss.weld.manager.BeanManagerImpl getBeanManager()
BeanManager linked to the root bean deployment archive. This BeanManager has access to all beans in a
deploymentIllegalStateException - if the container is not runningpublic Set<org.jboss.weld.bootstrap.spi.BeanDeploymentArchive> getBeanDeploymentArchives()
public boolean isStarted()
Copyright © 2021 JBoss by Red Hat. All rights reserved.