Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
base repository: wildfly/wildfly
Choose a Base Repository
wildfly/wildfly
2002simon01/jboss-as
ALRubinger/wildfly
ErikWRasmussen/jboss-as
KurtStam/jboss-as
Lerm/jboss-as
LinuxEvangelist/jboss-as
Mogztter/wildfly
OndraZizka/jboss-as
PayU-EMEA/jboss-as
aaronwalker/jboss-as
agibsonccc/jboss-as
akalachm/jboss-as
alesj/jboss-as
alns/jboss-as
aloubyansky/wildfly
aminorex/jboss-as
andersnorgaard/jboss-as
andredemathe/jboss-as
andytaylor/wildfly
aprilhu0/jboss-as
ashields/jboss-as
aslakknutsen/jboss-as
asoldano/wildfly
awirayaksa/jboss-as
bershath/jboss-as
bgeorges/jboss-as
blue61/jboss-as
bosschaert/jboss-as
bstansberry/wildfly
btison/jboss-as
cbue/jboss-as
charleswmiller/jboss-as
chikin/jboss-as
chriskriel/jboss-as
coberle/jboss-as
colmsean/jboss-as
ctomc/wildfly
dandreadis/wildfly
darranl/wildfly
dcaillia/jboss-as
denuno/jboss-as
deruelle/jboss-as
dhollandAtWex/dh-old-forks-jboss-as
dmlloyd/wildfly
dobozysaurus/jboss-as
dpospisil/wildfly
edbean/jboss-as
emannuel/jboss-as
emerile1/jboss-as
emuckenhuber/wildfly
esantana/jboss-as
fbricon/jboss-as
fedora-jboss-as/wildfly
fei-yin/jboss-as
fharms/wildfly
fregaham/jboss-as
fxlambda-twickly5/wildfly
garcimouche/jboss-as
goldmann/jboss-as
gonne/jboss-as
gvagenas/jboss-as
hamanju/jboss-as
hamming229/jboss-as
heiko-braun/wildfly
hgkmiracle/jboss-as
hunter-thom/jboss-as
ikaro/jboss-as
istudens/wildfly
jaikiran/wildfly
jamezp/wildfly
janpiel/jboss-as
java-coder/jboss-as
jayhowell/jboss-as
jbossejb3/jboss-as
jdmr/jboss-as
jdpgrailsdev/jboss-as
jeenapeter/jboss-as
jeffzhang/jboss-as
jeremiahshirk/jboss-as
jiwils/jboss-as
jlindesmith/jboss-as
jmartisk/wildfly
jocstar/jboss-as
joseph2000/jboss-as
jrwhitley/jboss-as
jswordfish/jboss-as
jtoerber/jboss-as
julianzhu/jboss-as
jwulf/jboss-as
kabir/wildfly
kbys/jboss-as
koledzhikov/jboss-as
kpiwko/wildfly
kylape/wildfly
ldevrie/jboss-as
lingling788/jboss-as
liweinan/jboss-as
luksa/wildfly
lydonchandra/jboss-as
maasvdberg/wildfly
madhumita/jboss-as
madhumita12/jboss-as
maerqiang/jboss-as
maeste/jboss-as
mageshbk/jboss-as
markmc/jboss-as
markyour/jboss-as
maschmid/jboss-as
matejonnet/jboss-as
mathieuancelin/jboss-as
mathieufortin01/jboss-as
mattdrees/jboss-as
maxandersen/jboss-as
maximilienw/jboss-as
mbogoevici/jboss-as
mbrasier/jboss-as
mdemerath/jboss-as
mgencur/jboss-as
michaelschuetz/jboss-as
miclark/jboss-as
migue/wildfly
mikebrock/jboss-as
mkiman/jboss-as
mlinhard/jboss-as
mmoyses/jboss-as
mojavelinux/jboss-as
mschwartzman/jboss-as
mstruk/jboss-as
nikkack/jboss-as
nookala/jboss-as
npfr/jboss-as
nscavell/jboss-as
ochaloup/wildfly
patmcdonough/jboss-as
pbielicki/jboss-as
pentarou/jboss-as
pepite/jboss-as
petbac/jboss-as
pferraro/wildfly
pmf8/jboss-as
pmuir/jboss-as
porobd/jboss-as
prabugp/jboss-as
pragnesh/jboss-as
prasad-deshpande/jboss-as
prcg66/jboss-as
pskopek/wildfly
pslegr/jboss-as
rachmatowicz/wildfly
rachmatowicz2/jboss-as
randythomas/jboss-as
rhusar/wildfly
richmidwinter/jboss-as
richsharples/jboss-as
ringerc/jboss-as
robertpanzer/jboss-as
robstryker/jboss-as
rsvoboda/wildfly
rzimmermann/jboss-as
sacdroid/jboss-as
samuelo/jboss-as
sasgww/jboss-as
scottmarlow/wildfly
sebersole/jboss-as
seeburger-ag/jboss-as
seko2000/jboss-as
sgilda/wildfly
shadangi/jboss-as
shuawest/jboss-as
sjancke/jboss-as
skoussou/jboss-as
smcgowan/wildfly
spreadline/jboss-as
ssilvert/wildfly
starksm64/jboss-as
starksmjboss/jboss-as
stliu/jboss-as
stuartwdouglas/wildfly
sujaybawaskar/jboss-as
tdiesler/wildfly
tfennelly/jboss-as
thammoud/jboss-as
thanhvc/jboss-as
thauser/jboss-as
thomasnymand/jboss-as
thunderlei/jboss-as
tomathome/jboss-as
tomwells/jboss-as
tristantarrant/wildfly
tyasuma/jboss-as
undertow-io/jboss-as
vladimirralev/jboss-as
vmariusvv/jboss-as
vratsel/jboss-as
weld/wildfly
wfink/wildfly
wolfc/jboss-as
zhigunovs/jboss-as
zhleonix/jboss-as
Nothing to show
base: 8172a4c
head repository: wildfly/wildfly
Choose a Head Repository
wildfly/wildfly
2002simon01/jboss-as
ALRubinger/wildfly
ErikWRasmussen/jboss-as
KurtStam/jboss-as
Lerm/jboss-as
LinuxEvangelist/jboss-as
Mogztter/wildfly
OndraZizka/jboss-as
PayU-EMEA/jboss-as
aaronwalker/jboss-as
agibsonccc/jboss-as
akalachm/jboss-as
alesj/jboss-as
alns/jboss-as
aloubyansky/wildfly
aminorex/jboss-as
andersnorgaard/jboss-as
andredemathe/jboss-as
andytaylor/wildfly
aprilhu0/jboss-as
ashields/jboss-as
aslakknutsen/jboss-as
asoldano/wildfly
awirayaksa/jboss-as
bershath/jboss-as
bgeorges/jboss-as
blue61/jboss-as
bosschaert/jboss-as
bstansberry/wildfly
btison/jboss-as
cbue/jboss-as
charleswmiller/jboss-as
chikin/jboss-as
chriskriel/jboss-as
coberle/jboss-as
colmsean/jboss-as
ctomc/wildfly
dandreadis/wildfly
darranl/wildfly
dcaillia/jboss-as
denuno/jboss-as
deruelle/jboss-as
dhollandAtWex/dh-old-forks-jboss-as
dmlloyd/wildfly
dobozysaurus/jboss-as
dpospisil/wildfly
edbean/jboss-as
emannuel/jboss-as
emerile1/jboss-as
emuckenhuber/wildfly
esantana/jboss-as
fbricon/jboss-as
fedora-jboss-as/wildfly
fei-yin/jboss-as
fharms/wildfly
fregaham/jboss-as
fxlambda-twickly5/wildfly
garcimouche/jboss-as
goldmann/jboss-as
gonne/jboss-as
gvagenas/jboss-as
hamanju/jboss-as
hamming229/jboss-as
heiko-braun/wildfly
hgkmiracle/jboss-as
hunter-thom/jboss-as
ikaro/jboss-as
istudens/wildfly
jaikiran/wildfly
jamezp/wildfly
janpiel/jboss-as
java-coder/jboss-as
jayhowell/jboss-as
jbossejb3/jboss-as
jdmr/jboss-as
jdpgrailsdev/jboss-as
jeenapeter/jboss-as
jeffzhang/jboss-as
jeremiahshirk/jboss-as
jiwils/jboss-as
jlindesmith/jboss-as
jmartisk/wildfly
jocstar/jboss-as
joseph2000/jboss-as
jrwhitley/jboss-as
jswordfish/jboss-as
jtoerber/jboss-as
julianzhu/jboss-as
jwulf/jboss-as
kabir/wildfly
kbys/jboss-as
koledzhikov/jboss-as
kpiwko/wildfly
kylape/wildfly
ldevrie/jboss-as
lingling788/jboss-as
liweinan/jboss-as
luksa/wildfly
lydonchandra/jboss-as
maasvdberg/wildfly
madhumita/jboss-as
madhumita12/jboss-as
maerqiang/jboss-as
maeste/jboss-as
mageshbk/jboss-as
markmc/jboss-as
markyour/jboss-as
maschmid/jboss-as
matejonnet/jboss-as
mathieuancelin/jboss-as
mathieufortin01/jboss-as
mattdrees/jboss-as
maxandersen/jboss-as
maximilienw/jboss-as
mbogoevici/jboss-as
mbrasier/jboss-as
mdemerath/jboss-as
mgencur/jboss-as
michaelschuetz/jboss-as
miclark/jboss-as
migue/wildfly
mikebrock/jboss-as
mkiman/jboss-as
mlinhard/jboss-as
mmoyses/jboss-as
mojavelinux/jboss-as
mschwartzman/jboss-as
mstruk/jboss-as
nikkack/jboss-as
nookala/jboss-as
npfr/jboss-as
nscavell/jboss-as
ochaloup/wildfly
patmcdonough/jboss-as
pbielicki/jboss-as
pentarou/jboss-as
pepite/jboss-as
petbac/jboss-as
pferraro/wildfly
pmf8/jboss-as
pmuir/jboss-as
porobd/jboss-as
prabugp/jboss-as
pragnesh/jboss-as
prasad-deshpande/jboss-as
prcg66/jboss-as
pskopek/wildfly
pslegr/jboss-as
rachmatowicz/wildfly
rachmatowicz2/jboss-as
randythomas/jboss-as
rhusar/wildfly
richmidwinter/jboss-as
richsharples/jboss-as
ringerc/jboss-as
robertpanzer/jboss-as
robstryker/jboss-as
rsvoboda/wildfly
rzimmermann/jboss-as
sacdroid/jboss-as
samuelo/jboss-as
sasgww/jboss-as
scottmarlow/wildfly
sebersole/jboss-as
seeburger-ag/jboss-as
seko2000/jboss-as
sgilda/wildfly
shadangi/jboss-as
shuawest/jboss-as
sjancke/jboss-as
skoussou/jboss-as
smcgowan/wildfly
spreadline/jboss-as
ssilvert/wildfly
starksm64/jboss-as
starksmjboss/jboss-as
stliu/jboss-as
stuartwdouglas/wildfly
sujaybawaskar/jboss-as
tdiesler/wildfly
tfennelly/jboss-as
thammoud/jboss-as
thanhvc/jboss-as
thauser/jboss-as
thomasnymand/jboss-as
thunderlei/jboss-as
tomathome/jboss-as
tomwells/jboss-as
tristantarrant/wildfly
tyasuma/jboss-as
undertow-io/jboss-as
vladimirralev/jboss-as
vmariusvv/jboss-as
vratsel/jboss-as
weld/wildfly
wfink/wildfly
wolfc/jboss-as
zhigunovs/jboss-as
zhleonix/jboss-as
Nothing to show
compare: c3c150e
  • 2 commits
  • 6 files changed
  • 0 commit comments
  • 2 contributors
Commits on Apr 09, 2019
from o.j.a.s.d.Attachments.JNDI_DEPENDENCIES
 to  o.j.a.s.d.Attachments.COMPONENT_JNDI_DEPENDENCIES attachment.
Before this fix JNDI_DEPENDENCY_SERVICE had too many dependencies.
With this fix applied JNDI_DEPENDENCY_SERVICE will now depend on
JNDI_AGGREGATION_SERVICES and these aggregation services
will reference COMPONENT_JNDI_DEPENDENCIES that were referenced
by JNDI_DEPENDENCY_SERVICE before. In other words we are decreasing
JNDI_DEPENDENCY_SERVICE dependencies count and reorganizing (simplifying)
its dependency tree.
Commits on Apr 14, 2019
[WFLY-9954] Fixing too many services and dependencies created for EJBs issue
@@ -22,6 +22,8 @@

package org.jboss.as.ee.component.deployers;

import java.util.HashMap;

import org.jboss.as.ee.component.Attachments;
import org.jboss.as.ee.component.EEModuleDescription;
import org.jboss.as.server.deployment.DeploymentPhaseContext;
@@ -31,6 +33,7 @@

/**
* @author <a href="mailto:david.lloyd@redhat.com">David M. Lloyd</a>
* @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
*/
public final class EEModuleInitialProcessor implements DeploymentUnitProcessor {

@@ -60,6 +63,7 @@ public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentU
appName = null;
}
deploymentUnit.putAttachment(Attachments.EE_MODULE_DESCRIPTION, new EEModuleDescription(appName, moduleName, earApplicationName, appClient));
deploymentUnit.putAttachment(org.jboss.as.server.deployment.Attachments.COMPONENT_JNDI_DEPENDENCIES, new HashMap<>());
}

public void undeploy(final DeploymentUnit context) {
@@ -21,6 +21,10 @@
*/
package org.jboss.as.ee.naming;

import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import org.jboss.as.ee.component.Attachments;
import org.jboss.as.ee.component.ComponentDescription;
import org.jboss.as.ee.component.ComponentNamingMode;
@@ -43,6 +47,7 @@
* Processor responsible for binding java:comp/InAppClientContainer
*
* @author Stuart Douglas
* @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
*/
public class InApplicationClientBindingProcessor implements DeploymentUnitProcessor {

@@ -85,7 +90,12 @@ private void bindServices(DeploymentUnit deploymentUnit, ServiceTarget serviceTa
serviceTarget.addService(inAppClientServiceName, inAppClientContainerService)
.addDependency(contextServiceName, ServiceBasedNamingStore.class, inAppClientContainerService.getNamingStoreInjector())
.install();
deploymentUnit.addToAttachmentList(org.jboss.as.server.deployment.Attachments.JNDI_DEPENDENCIES, inAppClientServiceName);
final Map<ServiceName, Set<ServiceName>> jndiComponentDependencies = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.COMPONENT_JNDI_DEPENDENCIES);
Set<ServiceName> jndiDependencies = jndiComponentDependencies.get(contextServiceName);
if (jndiDependencies == null) {
jndiComponentDependencies.put(contextServiceName, jndiDependencies = new HashSet<>());
}
jndiDependencies.add(inAppClientServiceName);
}


@@ -21,6 +21,10 @@
*/
package org.jboss.as.ee.naming;

import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import org.jboss.as.ee.component.Attachments;
import org.jboss.as.ee.component.ComponentDescription;
import org.jboss.as.ee.component.ComponentNamingMode;
@@ -47,6 +51,7 @@
* Processor responsible for binding java:comp/InstanceName
*
* @author Stuart Douglas
* @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
*/
public class InstanceNameBindingProcessor implements DeploymentUnitProcessor {

@@ -110,11 +115,14 @@ public void uninject() {
}
})
.install();
deploymentUnit.addToAttachmentList(org.jboss.as.server.deployment.Attachments.JNDI_DEPENDENCIES, instanceNameServiceName);

final Map<ServiceName, Set<ServiceName>> jndiComponentDependencies = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.COMPONENT_JNDI_DEPENDENCIES);
Set<ServiceName> jndiDependencies = jndiComponentDependencies.get(contextServiceName);
if (jndiDependencies == null) {
jndiComponentDependencies.put(contextServiceName, jndiDependencies = new HashSet<>());
}
jndiDependencies.add(instanceNameServiceName);
}


@Override
public void undeploy(DeploymentUnit context) {
}
@@ -21,7 +21,10 @@
*/
package org.jboss.as.naming.deployment;

import java.util.List;
import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import org.jboss.as.controller.capability.CapabilityServiceSupport;
import org.jboss.as.naming.service.NamingService;
@@ -32,6 +35,7 @@
import org.jboss.as.server.deployment.DeploymentUnitProcessor;
import org.jboss.msc.service.ServiceBuilder;
import org.jboss.msc.service.ServiceName;
import org.jboss.msc.service.ServiceTarget;

/**
* Adds a service that depends on all JNDI bindings from the deployment to be up.
@@ -40,37 +44,58 @@
* is necessary to ensure the deployment is not considered complete until add bindings are up
*
* @author Stuart Douglas
* @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
*/
public class JndiNamingDependencyProcessor implements DeploymentUnitProcessor {

private static final ServiceName JNDI_DEPENDENCY_SERVICE = ServiceName.of("jndiDependencyService");

private static final String JNDI_AGGREGATION_SERVICE_SUFFIX = "componentJndiDependencies";

@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {

DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
CapabilityServiceSupport support = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT);
ServiceName namingStoreServiceName = support.getCapabilityServiceName(NamingService.CAPABILITY_NAME);
//this will always be up but we need to make sure the naming service is
//not shut down before the deployment is undeployed when the container is shut down
phaseContext.addToAttachmentList(Attachments.NEXT_PHASE_DEPS, namingStoreServiceName);

List<ServiceName> dependencies = deploymentUnit.getAttachmentList(Attachments.JNDI_DEPENDENCIES);
final ServiceName serviceName = serviceName(deploymentUnit.getServiceName());
final ServiceBuilder<?> serviceBuilder = phaseContext.getServiceTarget().addService(serviceName, new RuntimeBindReleaseService());
for (final ServiceName dependency : dependencies) {
serviceBuilder.requires(dependency);
}
if(deploymentUnit.getParent() != null) {
for (final ServiceName jndiDependency : deploymentUnit.getParent().getAttachment(Attachments.JNDI_DEPENDENCIES)) {
serviceBuilder.requires(jndiDependency);
}
addAllDependencies(serviceBuilder, deploymentUnit.getAttachmentList(Attachments.JNDI_DEPENDENCIES));
Map<ServiceName, Set<ServiceName>> compJndiDeps = deploymentUnit.getAttachment(Attachments.COMPONENT_JNDI_DEPENDENCIES);
Set<ServiceName> aggregatingServices = installComponentJndiAggregatingServices(phaseContext.getServiceTarget(), compJndiDeps);
addAllDependencies(serviceBuilder, aggregatingServices);
if (deploymentUnit.getParent() != null) {
addAllDependencies(serviceBuilder, deploymentUnit.getParent().getAttachment(Attachments.JNDI_DEPENDENCIES));
compJndiDeps = deploymentUnit.getParent().getAttachment(Attachments.COMPONENT_JNDI_DEPENDENCIES);
aggregatingServices = installComponentJndiAggregatingServices(phaseContext.getServiceTarget(), compJndiDeps);
addAllDependencies(serviceBuilder, aggregatingServices);
}
serviceBuilder.requires(namingStoreServiceName);
serviceBuilder.install();
}

private static Set<ServiceName> installComponentJndiAggregatingServices(final ServiceTarget target, final Map<ServiceName, Set<ServiceName>> mappings) {
final Set<ServiceName> retVal = new HashSet<>();
ServiceBuilder sb;
ServiceName sn;
for (final Map.Entry<ServiceName, Set<ServiceName>> mapping : mappings.entrySet()) {
sn = mapping.getKey().append(JNDI_AGGREGATION_SERVICE_SUFFIX);
retVal.add(sn);
sb = target.addService(sn);
for (final ServiceName depName : mapping.getValue()) sb.requires(depName);
sb.install();
}
return retVal;
}

private static void addAllDependencies(final ServiceBuilder sb, final Collection<ServiceName> dependencies) {
for (final ServiceName dependency : dependencies) {
sb.requires(dependency);
}
}

public static ServiceName serviceName(final ServiceName deploymentUnitServiceName) {
return deploymentUnitServiceName.append(JNDI_DEPENDENCY_SERVICE);
}
@@ -21,6 +21,10 @@
*/
package org.jboss.as.txn.deployment;

import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import javax.transaction.TransactionSynchronizationRegistry;
import javax.transaction.UserTransaction;

@@ -52,6 +56,7 @@
* regardless of the presence of the {@link javax.annotation.Resource} annotation.
*
* @author Stuart Douglas
* @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
*/
public class TransactionJndiBindingProcessor implements DeploymentUnitProcessor {
@Override
@@ -96,7 +101,12 @@ private void bindServices(DeploymentUnit deploymentUnit, ServiceTarget serviceTa
new ManagedReferenceInjector<UserTransaction>(userTransactionBindingService.getManagedObjectInjector()))
.addDependency(contextServiceName, ServiceBasedNamingStore.class, userTransactionBindingService.getNamingStoreInjector())
.install();
deploymentUnit.addToAttachmentList(org.jboss.as.server.deployment.Attachments.JNDI_DEPENDENCIES,userTransactionServiceName);
final Map<ServiceName, Set<ServiceName>> jndiComponentDependencies = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.COMPONENT_JNDI_DEPENDENCIES);
Set<ServiceName> jndiDependencies = jndiComponentDependencies.get(contextServiceName);
if (jndiDependencies == null) {
jndiComponentDependencies.put(contextServiceName, jndiDependencies = new HashSet<>());
}
jndiDependencies.add(userTransactionServiceName);

final ServiceName transactionSynchronizationRegistryName = contextServiceName.append("TransactionSynchronizationRegistry");
BinderService transactionSyncBinderService = new BinderService("TransactionSynchronizationRegistry");
@@ -105,7 +115,7 @@ private void bindServices(DeploymentUnit deploymentUnit, ServiceTarget serviceTa
new ManagedReferenceInjector<TransactionSynchronizationRegistry>(transactionSyncBinderService.getManagedObjectInjector()))
.addDependency(contextServiceName, ServiceBasedNamingStore.class, transactionSyncBinderService.getNamingStoreInjector())
.install();
deploymentUnit.addToAttachmentList(org.jboss.as.server.deployment.Attachments.JNDI_DEPENDENCIES,transactionSynchronizationRegistryName);
jndiDependencies.add(transactionSynchronizationRegistryName);
}


@@ -21,7 +21,9 @@
*/
package org.jboss.as.weld.deployment.processors;

import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Supplier;

@@ -53,7 +55,6 @@
import org.jboss.as.weld.util.Utils;
import org.jboss.msc.service.ServiceBuilder;
import org.jboss.msc.service.ServiceName;
import org.jboss.msc.service.ServiceRegistry;
import org.jboss.msc.service.ServiceTarget;
import org.jboss.msc.value.ImmediateValue;
import org.jboss.msc.value.InjectedValue;
@@ -76,9 +77,6 @@ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitPro
return;
}

final Collection<ServiceName> dependencies = deploymentUnit.getAttachment(Attachments.JNDI_DEPENDENCIES);


BeanDeploymentArchiveImpl rootBda = deploymentUnit
.getAttachment(WeldAttachments.DEPLOYMENT_ROOT_BEAN_DEPLOYMENT_ARCHIVE);
if (rootBda == null) {
@@ -111,30 +109,35 @@ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitPro
if (DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit) || deploymentUnit.getName().endsWith(".jar")) {
// bind the bean manager to JNDI
final ServiceName moduleContextServiceName = ContextNames.contextServiceNameOfModule(moduleDescription.getApplicationName(), moduleDescription.getModuleName());
bindBeanManager(serviceTarget, beanManagerServiceName, moduleContextServiceName, dependencies, phaseContext.getServiceRegistry());
bindBeanManager(deploymentUnit, serviceTarget, beanManagerServiceName, moduleContextServiceName);
}


//bind the bm into java:comp for all components that require it
for (ComponentDescription component : moduleDescription.getComponentDescriptions()) {
if (component.getNamingMode() == ComponentNamingMode.CREATE) {
final ServiceName compContextServiceName = ContextNames.contextServiceNameOfComponent(moduleDescription.getApplicationName(), moduleDescription.getModuleName(), component.getComponentName());
bindBeanManager(serviceTarget, beanManagerServiceName, compContextServiceName, dependencies, phaseContext.getServiceRegistry());
bindBeanManager(deploymentUnit, serviceTarget, beanManagerServiceName, compContextServiceName);
}
}
deploymentUnit.addToAttachmentList(Attachments.SETUP_ACTIONS, new WeldContextSetup());
}

private void bindBeanManager(ServiceTarget serviceTarget, ServiceName beanManagerServiceName, ServiceName contextServiceName, final Collection<ServiceName> dependencies, final ServiceRegistry serviceRegistry) {
private void bindBeanManager(DeploymentUnit deploymentUnit, ServiceTarget serviceTarget, ServiceName beanManagerServiceName, ServiceName contextServiceName) {
final ServiceName beanManagerBindingServiceName = contextServiceName.append("BeanManager");
dependencies.add(beanManagerBindingServiceName);
BinderService beanManagerBindingService = new BinderService("BeanManager");
final BeanManagerManagedReferenceFactory referenceFactory = new BeanManagerManagedReferenceFactory();
beanManagerBindingService.getManagedObjectInjector().inject(referenceFactory);
serviceTarget.addService(beanManagerBindingServiceName, beanManagerBindingService)
.addDependency(contextServiceName, ServiceBasedNamingStore.class, beanManagerBindingService.getNamingStoreInjector())
.addDependency(beanManagerServiceName, BeanManager.class, referenceFactory.beanManager)
.install();
final Map<ServiceName, Set<ServiceName>> jndiComponentDependencies = deploymentUnit.getAttachment(Attachments.COMPONENT_JNDI_DEPENDENCIES);
Set<ServiceName> jndiDependencies = jndiComponentDependencies.get(contextServiceName);
if (jndiDependencies == null) {
jndiComponentDependencies.put(contextServiceName, jndiDependencies = new HashSet<>());
}
jndiDependencies.add(beanManagerBindingServiceName);
}

@Override

No commit comments for this range

You can’t perform that action at this time.