User: d_jencks
  Date: 01/11/30 07:49:35

  Modified:    src/main/org/jboss/system ServiceController.java
  Log:
  Fixed problem with mbeans throwing exception in start and becoming non-removable
  
  Revision  Changes    Path
  1.16      +25 -13    jboss/src/main/org/jboss/system/ServiceController.java
  
  Index: ServiceController.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/system/ServiceController.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- ServiceController.java    2001/11/26 03:19:46     1.15
  +++ ServiceController.java    2001/11/30 15:49:35     1.16
  @@ -41,7 +41,7 @@
    * @see org.jboss.system.Service
    * @author <a href="mailto:[EMAIL PROTECTED]";>Marc Fleury</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>David Jencks</a>
  - * @version $Revision: 1.15 $ <p>
  + * @version $Revision: 1.16 $ <p>
    *
    * <b>Revisions:</b> <p>
    *
  @@ -235,7 +235,6 @@
                     } // end of if ()   
                     //Now, does the needed mbean exist? if not, note suspension.
                     //We could use the mbean server or our own service map.
  -                  //if (!nameToServiceMap.containsKey(ref)) 
                     if (!startedServices.contains(ref)) 
                     {
                        //Not there, mark suspended.
  @@ -253,7 +252,14 @@
            throw e;
         }
         String serviceFactory = mbeanElement.getAttribute("serviceFactory");
  -      registerAndStartService(objectName, serviceFactory);
  +      try 
  +      {
  +         registerAndStartService(objectName, serviceFactory);
  +      } 
  +      catch (Exception e) 
  +         //ignore errors, we created the mbean so we have to return the name
  +      {} // end of try-catch
  +      
         return objectName;
      }
   
  @@ -275,8 +281,6 @@
         catch (Exception e) 
         {
            log.error("Problem in registerAndStartService", e);
  -         //dont let anyone think we're started if we're not!
  -         nameToServiceMap.remove(serviceName);
            throw e;
         } // end of try-catch
   
  @@ -302,7 +306,12 @@
       */
      public void undeploy(ObjectName objectName) throws Exception
      {
  -      stop(objectName);
  +      try 
  +      {
  +         stop(objectName);
  +      } 
  +      catch (Exception e) 
  +      { } // end of try-catch
         //We are not needing anyone or waiting for anyone
         ArrayList weNeededList = (ArrayList)mbeanToMBeanRefsMap.remove(objectName);
         if (weNeededList != null) 
  @@ -350,8 +359,8 @@
            
            //Remove from local maps
            startedServices.remove(objectName);
  -         Service service = (Service)nameToServiceMap.remove(objectName);
  -
  +         //Service service = (Service)nameToServiceMap.remove(objectName);
  +         nameToServiceMap.remove(objectName);
            // Remove the MBean from the MBeanServer
            server.unregisterMBean(objectName);
   
  @@ -625,7 +634,7 @@
       *
       * @param e The exception to be logged.
       */
  -   private void logException(Throwable e)
  +   private void logException(String message, Throwable e)
      {
         if (e instanceof RuntimeErrorException)
         {
  @@ -647,8 +656,7 @@
         {
            e = ((ReflectionException)e).getTargetException();
         }
  -      e.printStackTrace();
  -      log.error(e);
  +      log.error(message, e);
      }
   
      private void markWaiting(ObjectName missing, ObjectName waiting)
  @@ -775,11 +783,15 @@
               }
               catch (JMRuntimeException e)
               {
  -               logException(e);
  +               logException("JMRuntimeException thrown during ServiceProxy 
operation " +
  +                            name + " on mbean " + objectName, e);
  +               throw e;
               }
               catch (JMException e)
               {
  -               logException(e);
  +               logException("JMException thrown during ServiceProxy operation " +
  +                            name + " on mbean " + objectName, e);
  +               throw e;
               }
            }
   
  
  
  

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

Reply via email to