commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: [modeler] Use existing server
Date Mon, 29 Jul 2002 21:22:05 GMT


On Mon, 29 Jul 2002 costinm@covalent.net wrote:

> Date: Mon, 29 Jul 2002 13:51:03 -0700 (PDT)
> From: costinm@covalent.net
> Reply-To: Jakarta Commons Developers List <commons-dev@jakarta.apache.org>
> To: Jakarta Commons Developers List <commons-dev@jakarta.apache.org>
> Subject: [modeler] Use existing server
>
>
> There is a problem when the modeler is used togheter with dynamic
> or static mbeans ( that don't use modeler ). The problem is that
> modeler will _create_ an mbean server, and those other beans will
> use a different server.
>
> Here's the patch, let me know if it's ok:
>

+1, but of course it will only work if every other user of JMX follows the
same algorithm.  Maybe we need some sort of mini-discovery goodie?

Can you go ahead and apply it (so I can hook you on doing some other
improvements on Modeler later :-)?

> Costin

Craig

>
> Index: src/java/org/apache/commons/modeler/Registry.java
> ===================================================================
> RCS file:
> /home/cvs/jakarta-commons/modeler/src/java/org/apache/commons/modeler/Registry.java,v
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 Registry.java
> --- src/java/org/apache/commons/modeler/Registry.java   30 Apr 2002
> 20:58:52 -0000      1.1.1.1
> +++ src/java/org/apache/commons/modeler/Registry.java   29 Jul 2002
> 20:27:52 -0000
> @@ -241,8 +241,13 @@
>      public synchronized static MBeanServer getServer() {
>
>          if (server == null) {
> -            log.info("Creating MBeanServer");
> -            server = MBeanServerFactory.createMBeanServer();
> +            if( MBeanServerFactory.findMBeanServer(null).size() > 0 ) {
> +                log.info("Using existing MBeanServer");
> +
> server=(MBeanServer)MBeanServerFactory.findMBeanServer(null).get(0);
> +            } else {
> +                log.info("Creating MBeanServer");
> +                server=MBeanServerFactory.createMBeanServer();
> +            }
>          }
>          return (server);
>
> Costin
>
>
> --
> To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message