tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ramakanth Kunapuli" <kunapu...@gmail.com>
Subject Re: How do I expose Catalina MBeans through Java Platform MBeanServer
Date Fri, 16 Nov 2007 01:16:02 GMT
It appears the attached jar file was stripped. Here's the java source.

*

import* java.util.concurrent.CountDownLatch;

*

import* javax.management.MBeanServer;
*

import* javax.management.MBeanServerBuilder;
*

import* javax.management.MBeanServerDelegate;

*

public* *class* SingletonMBeanServerBuilder *extends* MBeanServerBuilder {

*private* *static* MBeanServer *theMBeanServer*;

*private* *static* MBeanServerDelegate *theMBeanServerDelegate*;

*private* *static* *final* CountDownLatch *mbeanServerInited* =
*new*CountDownLatch(1);

*private* *static* *final* CountDownLatch *mbeanServerDelegateInited* = *new
* CountDownLatch(1);

*public* SingletonMBeanServerBuilder() {

}

@Override

*public* MBeanServer newMBeanServer(String defaultDomain,

MBeanServer outer, MBeanServerDelegate delegate) {

*return* checkAndInitMBeanServer(defaultDomain, outer, delegate);

}

@Override

*public* MBeanServerDelegate newMBeanServerDelegate() {

*return* checkAndInitMBeanServerDelegate();

}

*private* MBeanServer checkAndInitMBeanServer(String defaultDomain,

MBeanServer outer, MBeanServerDelegate delegate) {

*synchronized* (*mbeanServerInited*) {

*if* (*mbeanServerInited*.getCount() != 0) {

*theMBeanServer* = *super*.newMBeanServer(defaultDomain, outer,

delegate);

*mbeanServerInited*.countDown();

}

}

*return* *theMBeanServer*;

}

*private* MBeanServerDelegate checkAndInitMBeanServerDelegate() {

*synchronized* (*mbeanServerDelegateInited*) {

*if* (*mbeanServerDelegateInited*.getCount() != 0) {

*theMBeanServerDelegate* = *super*.newMBeanServerDelegate();

*mbeanServerDelegateInited*.countDown();

}

}

*return* *theMBeanServerDelegate*;

}

}



On Nov 14, 2007 11:52 AM, Vamsavardhana Reddy <c1vamsi1c@gmail.com> wrote:

> What does the jar do?  It does not seem to contain source code.
>
> ++Vamsi
>
> On Nov 15, 2007 1:16 AM, Ramakanth Kunapuli <kunapulir@gmail.com> wrote:
>
> > It appears that tomcat uses different MBeanServer instance from Java's
> > platform MBeanServer.
> >
> > Here's a tech tip of making both Tomcat & Java use the same MBean Server
> > instance.
> >
> > Drop the attached jar file under <java_home>/jre/lib/ext.
> > Modify the java execution command to include the following system
> > property.
> > *
> > -Djavax.management.builder.initial=SingletonMBeanServerBuilder
> >
> >
> > *
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: dev-help@tomcat.apache.org
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message