final String scopedPersistenceUnitName,
final DeploymentUnit deploymentUnit) {
synchronized (existingResourceDescriptionResolver) {
final EntityManagerFactoryLookup entityManagerFactoryLookup = new EntityManagerFactoryLookup();
final Statistics statistics = managementAdaptor.getStatistics();
if (false == existingResourceDescriptionResolver.contains(managementAdaptor.getVersion())) {
// setup statistics (this used to be part of JPA subsystem startup)
ResourceDescriptionResolver resourceDescriptionResolver = new StandardResourceDescriptionResolver(
statistics.getResourceBundleKeyPrefix(), statistics.getResourceBundleName(), statistics.getClass().getClassLoader());
PathElement subsystemPE = PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, JPAExtension.SUBSYSTEM_NAME);
ManagementResourceRegistration deploymentResourceRegistration = deploymentUnit.getAttachment(DeploymentModelUtils.MUTABLE_REGISTRATION_ATTACHMENT);
ManagementResourceRegistration deploymentSubsystemRegistration =
deploymentResourceRegistration.getSubModel(PathAddress.pathAddress(subsystemPE));