User: d_jencks
  Date: 02/03/08 12:59:28

  Modified:    src/main/org/jboss/ejb Container.java EjbModule.java
  Log:
  fixes for bug 526465, failed deployments don't clean up very well.  Reorganized a 
little bit also: bind into jndi on create step, and setup references to other 
resources in start step.
  
  Revision  Changes    Path
  1.81      +20 -7     jboss/src/main/org/jboss/ejb/Container.java
  
  Index: Container.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/Container.java,v
  retrieving revision 1.80
  retrieving revision 1.81
  diff -u -r1.80 -r1.81
  --- Container.java    7 Mar 2002 18:27:40 -0000       1.80
  +++ Container.java    8 Mar 2002 20:59:28 -0000       1.81
  @@ -82,7 +82,7 @@
   * @author <a href="mailto:[EMAIL PROTECTED]";>Scott Stark</a>.
   * @author <a href="[EMAIL PROTECTED]">Bill Burke</a>
   * @author <a href="mailto:[EMAIL PROTECTED]";>David Jencks</a>
  -* @version $Revision: 1.80 $
  +* @version $Revision: 1.81 $
   ** <p><b>Revisions:</b>
   *
   * <p><b>2001/07/26 bill burke:</b>
  @@ -185,6 +185,7 @@
      /** 
       * The name of the Remote invoker dedicated to this container, 
       * the type is set through deployment
  +    * @todo Make invokerType configurable through xml.
       */
      // marcf FIXME: FOR NOW ONLY JRMP (Debugging) but in the future make 
      // configurable from xml
  @@ -193,6 +194,10 @@
      
      // We need the visibility on the MBeanServer for prototyping, it will be removed 
in the future FIXME marcf
      //protected MBeanServer mbeanServer;
  +   /**
  +    * Describe variable <code>mbeanServer</code> here.
  +    * @todo make mbeanServer protected
  +    */
      public MBeanServer mbeanServer;
   
      /**
  @@ -493,24 +498,23 @@
         localContainerInvoker.create();
         if (localHomeInterface != null)
            ejbModule.addLocalHome(this, localContainerInvoker.getEJBLocalHome() );
  -      // Setup "java:comp/env" namespace
  -      setupEnvironment();
      }
      
      /**
       * A default implementation of starting the container service.
       * The container registers it's dynamic MBean interface in the JMX base.
  -    * FIXME marcf: give some more thought as to where to start and stop MBean 
registration.
  -    * stop could be a flag in the JMX server that essentially doesn't proxy 
invocations but the 
  -    * MBean would still be registered in the MBeanServer under the right name until 
undeploy
  -    *
  +    * 
       * The concrete container classes should override this method to introduce
       * implementation specific start behaviour.
       *
  +    * @todo implement the service lifecycle methods in an xmbean interceptor so 
  +    * non lifecycle managed ops are blocked when mbean is not started.
       * @throws Exception    An exception that occured during start
       */
      public void start() throws Exception
      {
  +      // Setup "java:comp/env" namespace
  +      setupEnvironment();
         started = true;
         localContainerInvoker.start();
      }
  @@ -597,6 +601,15 @@
      
      /**
       * Handle a operation invocation.
  +    *
  +    * @todo fix all the "remove when cl integrated" code", marc.
  +    *
  +    * @param ignored a <code>String</code> value
  +    * @param params an <code>Object[]</code> value
  +    * @param signature a <code>String[]</code> value
  +    * @return an <code>Object</code> value
  +    * @exception MBeanException if an error occurs
  +    * @exception ReflectionException if an error occurs
       */
      public Object invoke(String ignored, Object[] params, String[] signature)
         throws MBeanException, ReflectionException
  
  
  
  1.9       +69 -44    jboss/src/main/org/jboss/ejb/EjbModule.java
  
  Index: EjbModule.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/EjbModule.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- EjbModule.java    4 Mar 2002 06:01:14 -0000       1.8
  +++ EjbModule.java    8 Mar 2002 20:59:28 -0000       1.9
  @@ -67,7 +67,7 @@
    * 
    * @author <a href="mailto:[EMAIL PROTECTED]";>Rickard �berg</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>David Jencks</a>
  - * @version $Revision: 1.8 $
  + * @version $Revision: 1.9 $
    *
    * @jmx:mbean extends="org.jboss.system.ServiceMBean"
    */
  @@ -133,12 +133,11 @@
         this.name = deploymentInfo.url.toString();
      }
      /**
  -    * Add a container to this application. This is called by the
  -    * EJBDeployer.
  +    * Add a container to this application.
       *
       * @param   con  
       */
  -   public void addContainer(Container con)
  +   private void addContainer(Container con)
      {
         containers.put(con.getBeanMetaData().getEjbName(), con);
         con.setEjbModule(this);
  @@ -273,42 +272,58 @@
            setModuleName( lModule );
         }
         //Set up the beans in this module.
  -      for (Iterator beans = ((ApplicationMetaData) 
deploymentInfo.metaData).getEnterpriseBeans(); beans.hasNext(); ) 
  +      try 
         {
  -         BeanMetaData bean = (BeanMetaData) beans.next();
  -         
  -         log.info( "Deploying " + bean.getEjbName() );
  -         try 
  -         {
  -            addContainer( createContainer( bean, deploymentInfo ) );
  -         } 
  -         catch (Exception e) 
  +         for (Iterator beans = ((ApplicationMetaData) 
deploymentInfo.metaData).getEnterpriseBeans(); beans.hasNext(); ) 
            {
  -            log.error("error adding container to app.", e);
  -            throw e;
  -         } // end of try-catch
  -      }
  -      //only one iteration should be necessary, but we won't sweat it.   
  -      for (Iterator i = containers.values().iterator(); i.hasNext();)
  -      {
  -         Container con = (Container)i.next();
  -         ObjectName jmxName= con.getJmxName();
  -         server.registerMBean(con, jmxName);
  -         serviceController.create(jmxName);
  -         // Create JSR-77 EJB-Wrapper
  -         log.debug( "Application.create(), create JSR-77 EJB-Component" );
  -         ObjectName lEJB = EJB.create(
  -            server,
  -            getModuleName().toString(),
  -            con.getBeanMetaData()
  -         );
  -         if (debug) {
  -            log.debug( "Application.start(), EJB: " + lEJB );
  +            BeanMetaData bean = (BeanMetaData) beans.next();
  +            
  +            log.info( "Deploying " + bean.getEjbName() );
  +            //Container con = createContainer(bean, deploymentInfo);
  +            //addContainer(con);
  +            
  +            try 
  +            {
  +               addContainer( createContainer( bean, deploymentInfo ) );
  +            } 
  +            catch (Exception e) 
  +            {
  +               log.error("error adding container to app.", e);
  +               throw e;
  +            } // end of try-catch
            }
  -         if( lEJB != null ) {
  -            con.mEJBObjectName = lEJB.toString();
  +         //only one iteration should be necessary, but we won't sweat it.   
  +         //2 iterations are needed by cmp...jdbc/bridge/JDBCCMRFieldBridge which 
  +         //assumes persistence managers are all set up for every
  +         //bean in the relationship!
  +         for (Iterator i = containers.values().iterator(); i.hasNext();)
  +         {
  +            Container con = (Container)i.next();
  +            
  +            ObjectName jmxName= con.getJmxName();
  +            server.registerMBean(con, jmxName);
  +            serviceController.create(jmxName);
  +            // Create JSR-77 EJB-Wrapper
  +            log.debug( "Application.create(), create JSR-77 EJB-Component" );
  +            ObjectName lEJB = EJB.create(
  +               server,
  +               getModuleName().toString(),
  +               con.getBeanMetaData()
  +               );
  +            if (debug) {
  +               log.debug( "Application.start(), EJB: " + lEJB );
  +            }
  +            if( lEJB != null ) {
  +               con.mEJBObjectName = lEJB.toString();
  +            }
            }
         }
  +      catch (Exception e)
  +      {
  +         destroyService();
  +         throw e;
  +      } // end of try-catch
  +      
      }
   
      /**
  @@ -347,8 +362,7 @@
            }
            catch (Exception e)
            {
  -            //no log here, but this shouldn't happen.
  -            //log.error("unexpected exception stopping Container: " + 
con.getJmxName(), e);
  +            log.error("unexpected exception stopping Container: " + 
con.getJmxName(), e);
            } // end of try-catch
            
         }
  @@ -366,11 +380,18 @@
            try 
            {
               serviceController.destroy(con.getJmxName());
  +         }
  +         catch (Throwable e)
  +         {
  +            log.error("unexpected exception destroying Container: " + 
con.getJmxName(), e);
  +         } // end of try-catch
  +         try 
  +         {
               serviceController.remove(con.getJmxName());
            }
  -         catch (Exception e)
  +         catch (Throwable e)
            {
  -            //log.error("unexpected exception destroying Container: " + 
con.getJmxName(), e);
  +            log.error("unexpected exception destroying Container: " + 
con.getJmxName(), e);
            } // end of try-catch
         }
         log.info( "Remove JSR-77 EJB Module: " + getModuleName() );
  @@ -607,7 +628,8 @@
      * add the indicated interceptors to the container depending on the container
      * transcation type and metricsEnabled flag.
      *
  -   * FIXME marcf: frankly the transaction type stuff makes no sense to me, we have 
externalized
  +   *
  +   * @todo marcf: frankly the transaction type stuff makes no sense to me, we have 
externalized
      * the container stack construction in jbossxml and I don't see why or why there 
would be a 
      * type missmatch on the transaction
      * 
  @@ -712,8 +734,7 @@
      /**
      * createCOntainerInvoker DEPRACATED CONTAINER INVOKER DOES NOTHING BUT 
MANUFACTURE EJBs
      *
  -   * Move to EJBFactory, implement with ProxyFactory.   The EJBFactory must be made 
aware of invocation type
  -   *
  +   * @todo Leftover code in createContainerInvoker!! Move to EJBFactory, implement 
with ProxyFactory.   The EJBFactory must be made aware of invocation type
      * FIXME : TEMPORARY 
      */
      private static ContainerInvoker createContainerInvoker( ConfigurationMetaData 
conf,
  @@ -727,8 +748,10 @@
         
         // Just a nicety for 2.4 legacy users
         if (invoker.equals("org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker"))
  +      {
  +         log.warn("you are using deprecated JRMPContainerInvoker. Please change to 
org.jboss.proxy.ejb.ProxyFactory");
            invoker = "org.jboss.proxy.ejb.ProxyFactory";
  -      
  +      }
         try
         {
            
  @@ -740,8 +763,10 @@
         }
         
         if( ci instanceof XmlLoadable )
  +      {
            // the container invoker can load its configuration from the jboss.xml 
element
  -      ( (XmlLoadable) ci ).importXml( conf.getContainerInvokerConf() );
  +         ( (XmlLoadable) ci ).importXml( conf.getContainerInvokerConf() );
  +      }
         
         return ci;
      }
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to