You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jg...@apache.org on 2018/02/28 12:45:36 UTC

[2/2] tomee git commit: Ensure all container IDs from the app are examined, and use EJB name for debug printing

Ensure all container IDs from the app are examined, and use EJB name for debug printing


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/ed3584cc
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/ed3584cc
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/ed3584cc

Branch: refs/heads/tomee-1.7.x
Commit: ed3584cc94b42e06cb93cf5586fbebb4dc0e1199
Parents: 9989679
Author: Jonathan Gallimore <jo...@jrg.me.uk>
Authored: Wed Feb 28 12:44:55 2018 +0000
Committer: Jonathan Gallimore <jo...@jrg.me.uk>
Committed: Wed Feb 28 12:44:55 2018 +0000

----------------------------------------------------------------------
 .../org/apache/openejb/config/AutoConfig.java   | 40 +++++++++++++-------
 1 file changed, 26 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/ed3584cc/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java b/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java
index 99bdf30..cffcf1e 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java
@@ -840,25 +840,37 @@ public class AutoConfig implements DynamicDeployer, JndiConstants {
 
             final String beanType = getType(bean);
             final Class<? extends ContainerInfo> containerInfoType = ConfigurationFactory.getContainerInfoType(beanType);
-            logger.debug("Bean type of bean {0} is {1}", bean.getId(), beanType);
+            logger.debug("Bean type of bean {0} is {1}", bean.getEjbName(), beanType);
 
             if (ejbDeployment.getContainerId() == null && !skipMdb(bean)) {
-                logger.debug("Container for bean {0} is not set, looking for a suitable container", bean.getId());
+                logger.debug("Container for bean {0} is not set, looking for a suitable container", bean.getEjbName());
 
                 String containerId = getUsableContainer(containerInfoType, bean, appResources);
                 if (containerId == null) {
-                    logger.debug("Suitable container for bean {0} not found, creating one", bean.getId());
+                    logger.debug("Suitable container for bean {0} not found, creating one", bean.getEjbName());
                     containerId = createContainer(containerInfoType, ejbDeployment, bean);
                 }
 
-                logger.debug("Setting container ID {0} for bean {0}", containerId, bean.getId());
+                logger.debug("Setting container ID {0} for bean {0}", containerId, bean.getEjbName());
                 ejbDeployment.setContainerId(containerId);
             }
 
+            logger.debug("Container ID for bean {0} is {1}", bean.getEjbName(), ejbDeployment.getContainerId());
+
             // create the container if it doesn't exist
             final List<String> containerIds = configFactory.getContainerIds();
-            containerIds.addAll(appResources.getContainerIds());
+
+            final Collection<ContainerInfo> containerInfos = appResources.getContainerInfos();
+            for (final ContainerInfo containerInfo : containerInfos) {
+                containerIds.add(containerInfo.id);
+            }
+
             if (!containerIds.contains(ejbDeployment.getContainerId()) && !skipMdb(bean)) {
+                logger.debug("Desired container {0} not found. Containers availble: {1}. Creating a new container.",
+                        ejbDeployment.getContainerId(),
+                        Join.join(", ", containerIds)
+                );
+
                 createContainer(containerInfoType, ejbDeployment, bean);
             }
 
@@ -2205,7 +2217,7 @@ public class AutoConfig implements DynamicDeployer, JndiConstants {
 
     private String getUsableContainer(final Class<? extends ContainerInfo> containerInfoType, final EnterpriseBean bean, final AppResources appResources) {
         logger.debug("Searching for usable container for bean: {0}. Available application containers: {1}, available system containers {2}",
-                bean.getId(),
+                bean.getEjbName(),
                 getContainerIds(appResources.getContainerInfos()),
                 getContainerIds(configFactory.getContainerInfos())
         );
@@ -2216,7 +2228,7 @@ public class AutoConfig implements DynamicDeployer, JndiConstants {
 
             final List<String> containerIds = appResources.containerIdsByType.get(messagingType);
             logger.debug("Searching for usable container for bean: {0} by messaging type: {1}. Potential application containers: {2}",
-                    bean.getId(),
+                    bean.getEjbName(),
                     messagingType,
                     Join.join(",", containerIds));
 
@@ -2230,25 +2242,25 @@ public class AutoConfig implements DynamicDeployer, JndiConstants {
         }
 
         logger.debug("Attempting to find a matching container for bean: {0} from application containers {1}",
-                bean.getId(),
+                bean.getEjbName(),
                 getContainerIds(appResources.getContainerInfos()));
 
         String containerInfo = matchContainer(containerInfoType, bean, appResources.getContainerInfos());
         if (containerInfo == null) { // avoid to build configFactory.getContainerInfos() if not needed
 
             logger.debug("Matching application container not found. Attempting to find a matching container for bean: {0} from system containers {1}",
-                    bean.getId(),
+                    bean.getEjbName(),
                     getContainerIds(appResources.getContainerInfos()));
 
             containerInfo = matchContainer(containerInfoType, bean, configFactory.getContainerInfos());
         }
 
         if (containerInfo != null) {
-            logger.debug("Using container {0} for bean {1}", containerInfo, bean.getId());
+            logger.debug("Using container {0} for bean {1}", containerInfo, bean.getEjbName());
             return containerInfo;
         }
 
-        logger.debug("No suitable existing container found for bean {0}", bean.getId());
+        logger.debug("No suitable existing container found for bean {0}", bean.getEjbName());
         return null;
     }
 
@@ -2275,7 +2287,7 @@ public class AutoConfig implements DynamicDeployer, JndiConstants {
                                 containerInfo.id,
                                 containerInfoType.getName(),
                                 messagingType,
-                                bean.getId());
+                                bean.getEjbName());
 
                         return containerInfo.id;
                     } else {
@@ -2285,14 +2297,14 @@ public class AutoConfig implements DynamicDeployer, JndiConstants {
                                 containerInfoType.getName(),
                                 messagingType,
                                 containerInfo.properties.get("MessageListenerInterface"),
-                                bean.getId());
+                                bean.getEjbName());
 
                     }
                 } else {
                     logger.debug("Container {0} matches container type {1} for bean {2}, this container will be used.",
                             containerInfo.id,
                             containerInfoType.getName(),
-                            bean.getId());
+                            bean.getEjbName());
 
                     return containerInfo.id;
                 }