geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/service GeronimoMBean.java
Date Fri, 24 Oct 2003 22:41:56 GMT
dain        2003/10/24 15:41:56

  Modified:    modules/kernel/src/java/org/apache/geronimo/kernel/service
                        GeronimoMBean.java
  Log:
  Moved initialization code to postRegister, so we are not initializing
  if the registrtion process fails.
  Put doStop call in postDeregister in a try catch block to assure all
  targets are notified of a stop.  Exceptions are simply logged and ignored.
  
  Revision  Changes    Path
  1.2       +24 -5     incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/service/GeronimoMBean.java
  
  Index: GeronimoMBean.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/service/GeronimoMBean.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- GeronimoMBean.java	8 Sep 2003 04:38:35 -0000	1.1
  +++ GeronimoMBean.java	24 Oct 2003 22:41:56 -0000	1.2
  @@ -108,6 +108,17 @@
               throw new DeploymentException("No MBean info set for Geronimo MBean");
           }
   
  +        context = new GeronimoMBeanContext(server, this, name);
  +        return this.objectName;
  +    }
  +
  +    public void postRegister(Boolean registrationDone) {
  +        super.postRegister(registrationDone);
  +        if(!registrationDone.booleanValue()) {
  +            context = null;
  +            return;
  +        }
  +
           ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
           try {
               Thread.currentThread().setContextClassLoader(classLoader);
  @@ -125,25 +136,33 @@
                   operationInfoMap.put(new MethodKey(operationInfo.getName(), operationInfo.getParameterTypes()),
operationInfo);
               }
   
  -            context = new GeronimoMBeanContext(server, this, name);
               for (Iterator i = mbeanInfo.targets.values().iterator(); i.hasNext();) {
                   Object target = i.next();
                   if (target instanceof GeronimoMBeanTarget) {
  -                    ((GeronimoMBeanTarget) target).setMBeanContext(context);
  +                    try {
  +                        ((GeronimoMBeanTarget) target).setMBeanContext(context);
  +                    } catch (RuntimeException e) {
  +                        log.warn("Ignoring RuntimeException from setMBeanContext(context):
objectName" + context.getObjectName(), e);
  +                    }
                   }
               }
           } finally {
               Thread.currentThread().setContextClassLoader(oldClassLoader);
           }
  -        return this.objectName;
       }
   
       public void postDeregister() {
           super.postDeregister();
  +        ObjectName objectName = context.getObjectName();
  +        context = null;
           for (Iterator i = mbeanInfo.targets.values().iterator(); i.hasNext();) {
               Object target = i.next();
               if (target instanceof GeronimoMBeanTarget) {
  -                ((GeronimoMBeanTarget) target).setMBeanContext(null);
  +                try {
  +                    ((GeronimoMBeanTarget) target).setMBeanContext(null);
  +                } catch (RuntimeException e) {
  +                    log.warn("Ignoring RuntimeException from setMBeanContext(null): objectName"
+ objectName, e);
  +                }
               }
           }
       }
  
  
  

Mime
View raw message