tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgallim...@apache.org
Subject [5/6] tomee git commit: Ensure all container IDs from the app are examined, and use EJB name for debug printing
Date Mon, 05 Mar 2018 20:44:31 GMT
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/2e05749c
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/2e05749c
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/2e05749c

Branch: refs/heads/master
Commit: 2e05749c199661ea9f512ae60e8422e3952a8f70
Parents: 7124cee
Author: Jonathan Gallimore <jon@jrg.me.uk>
Authored: Wed Feb 28 12:44:55 2018 +0000
Committer: Jonathan Gallimore <jon@jrg.me.uk>
Committed: Mon Mar 5 15:53:54 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/2e05749c/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 19cf40e..cc30475 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
@@ -853,25 +853,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);
             }
 
@@ -2240,7 +2252,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())
         );
@@ -2251,7 +2263,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));
 
@@ -2265,25 +2277,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;
     }
 
@@ -2310,7 +2322,7 @@ public class AutoConfig implements DynamicDeployer, JndiConstants {
                                 containerInfo.id,
                                 containerInfoType.getName(),
                                 messagingType,
-                                bean.getId());
+                                bean.getEjbName());
 
                         return containerInfo.id;
                     } else {
@@ -2320,14 +2332,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;
                 }


Mime
View raw message