[jboss-dev-forums] [Design of JMX on JBoss (JBoss/JMX)] - my first JMX

anand_anan2k do-not-reply at jboss.com
Thu Mar 6 21:24:42 EST 2008


Hi All,

I'm new to JMX and got some basic questions related to deployment of Mbeans and registering of mbeans. 

Got some code for mbean.

Mbean interface :

public interface HelloMBean { 
 
    public void sayHello(); 
    public int add(int x, int y); 
 
    public String getName(); 
 
    public int getCacheSize(); 
    public void setCacheSize(int size); 
} 


mbean implementation :

public class Hello implements HelloMBean { 
    public void sayHello() { 
	System.out.println("hello, world"); 
    } 
 
    public int add(int x, int y) { 
	return x + y; 
    } 
 
    public String getName() { 
	return this.name; 
    } 
 
 
    public int getCacheSize() { 
	return this.cacheSize; 
    } 
 
    public synchronized void setCacheSize(int size) { 
	this.cacheSize = size; 
 
	System.out.println("Cache size now " + this.cacheSize); 
    } 
 
    private final String name = "Reginald"; 
    private int cacheSize = DEFAULT_CACHE_SIZE; 
    private static final int DEFAULT_CACHE_SIZE = 200; 
} 

Now , i would like to know , how to deploy the above code in JBOSS server and make the mbean register.

Are there any descriptor and i need to update , so that jboss will invoke the mbean registering function and the startup. 

And please let me know , how i can lookup those mbean services.

Thanks,
Elangovan.

Hello.java

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4134730#4134730

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4134730



More information about the jboss-dev-forums mailing list