Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 74737 invoked from network); 2 Jun 2004 20:51:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 2 Jun 2004 20:51:56 -0000 Received: (qmail 93580 invoked by uid 500); 2 Jun 2004 20:52:11 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 93544 invoked by uid 500); 2 Jun 2004 20:52:11 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: dev@geronimo.apache.org Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 93521 invoked by uid 500); 2 Jun 2004 20:52:10 -0000 Delivered-To: apmail-incubator-geronimo-cvs@apache.org Received: (qmail 93502 invoked by uid 99); 2 Jun 2004 20:52:10 -0000 Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.27.1) with SMTP; Wed, 02 Jun 2004 13:52:10 -0700 Received: (qmail 74712 invoked by uid 1716); 2 Jun 2004 20:51:51 -0000 Date: 2 Jun 2004 20:51:51 -0000 Message-ID: <20040602205151.74711.qmail@minotaur.apache.org> From: jboynes@apache.org To: incubator-geronimo-cvs@apache.org Subject: cvs commit: incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/jmx GBeanMBean.java RawInvoker.java X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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) {