geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jboy...@apache.org
Subject cvs commit: incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/jmx GBeanMBean.java RawInvoker.java
Date Wed, 02 Jun 2004 20:51:51 GMT
jboynes     2004/06/02 13:51:51

  Modified:    modules/kernel/src/java/org/apache/geronimo/gbean/jmx
                        GBeanMBean.java RawInvoker.java
  Log:
  Make GBean ref final, remove sync block
  Another 20ns gone
  
  Revision  Changes    Path
  1.19      +4 -18     incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBean.java
  
  Index: GBeanMBean.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBean.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- GBeanMBean.java	2 Jun 2004 05:33:03 -0000	1.18
  +++ GBeanMBean.java	2 Jun 2004 20:51:51 -0000	1.19
  @@ -157,7 +157,7 @@
       /**
        * A fast index based raw invoker for this GBean.
        */
  -    private RawInvoker rawInvoker;
  +    private final RawInvoker rawInvoker;
   
       /**
        * Constructa a GBeanMBean using the supplied gbeanInfo and class loader
  @@ -255,6 +255,8 @@
                   mbeanOperations,
                   // Is there any way to add notifications before an instance of the class
is created?
                   (MBeanNotificationInfo[]) notifications.toArray(new MBeanNotificationInfo[notifications.size()]));
  +
  +        rawInvoker = new RawInvoker(this);
       }
   
       /**
  @@ -515,10 +517,6 @@
               }
           }
   
  -        // create the raw invoker for this gbean.... this MUST be closed
  -        // when the gbean goes offline or we will get a memory leak
  -        rawInvoker = new RawInvoker(this);
  -
           return returnValue;
       }
   
  @@ -538,12 +536,6 @@
                   references[i].offline();
               }
   
  -            // clean up the raw invoker... this holds a reference to this gbean (a possible
memory leak)
  -            if (rawInvoker != null) {
  -                rawInvoker.close();
  -                rawInvoker = null;
  -            }
  -
               // well that didn't work, ditch the instance
               target = null;
           }
  @@ -563,12 +555,6 @@
           if (target instanceof GBean) {
               GBean gbean = (GBean) target;
               gbean.setGBeanContext(null);
  -        }
  -
  -        // clean up the raw invoker... this holds a reference to this gbean (a possible
memory leak)
  -        if (rawInvoker != null) {
  -            rawInvoker.close();
  -            rawInvoker = null;
           }
   
           offline = true;
  
  
  
  1.3       +7 -28     incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/RawInvoker.java
  
  Index: RawInvoker.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/RawInvoker.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RawInvoker.java	27 May 2004 01:05:59 -0000	1.2
  +++ RawInvoker.java	2 Jun 2004 20:51:51 -0000	1.3
  @@ -25,9 +25,9 @@
    * @version $Revision$ $Date$
    */
   public final class RawInvoker {
  -    private GBeanMBean gbean;
  -    private Map attributeIndex;
  -    private Map operationIndex;
  +    private final GBeanMBean gbean;
  +    private final Map attributeIndex;
  +    private final Map operationIndex;
   
       public RawInvoker(GBeanMBean gbean) {
           this.gbean = gbean;
  @@ -35,12 +35,6 @@
           operationIndex = gbean.getOperationIndex();
       }
   
  -    void close() {
  -        synchronized (this) {
  -            gbean = null;
  -        }
  -    }
  -
       public Map getAttributeIndex() {
           return attributeIndex;
       }
  @@ -49,12 +43,7 @@
           return operationIndex;
       }
   
  -    public Object getAttribute(int index) throws Exception {
  -        GBeanMBean gbean;
  -        synchronized (this) {
  -            gbean = this.gbean;
  -        }
  -
  +    public Object getAttribute(final int index) throws Exception {
           try {
               return gbean.getAttribute(index);
           } catch (ReflectionException e) {
  @@ -72,12 +61,7 @@
           }
       }
   
  -    public void setAttribute(int index, Object value) throws Exception {
  -        GBeanMBean gbean;
  -        synchronized (this) {
  -            gbean = this.gbean;
  -        }
  -
  +    public void setAttribute(final int index, final Object value) throws Exception {
           try {
               gbean.setAttribute(index, value);
           } catch (ReflectionException e) {
  @@ -95,12 +79,7 @@
           }
       }
   
  -    public Object invoke(int index, Object[] args) throws Exception {
  -        GBeanMBean gbean;
  -        synchronized (this) {
  -            gbean = this.gbean;
  -        }
  -
  +    public Object invoke(final int index, final Object[] args) throws Exception {
           try {
               return gbean.invoke(index, args);
           } catch (ReflectionException e) {
  
  
  

Mime
View raw message