Hello, I am a JMX newbie, i have successfully write some standard mbean follows the example in the Jboss docs. I plan to do some serious component using this model, therefore i post this message to verify with you gurus and hope to get some comments and feedbacks.
My objective of using mbean is to create a caching layer at the server side where some data retrieve through session bean will be cached at the mbean. The client (web-client, java client) will access the mbean to retrieve data, only if the data is not available in the cache it will invoke the session bean(which will retrieve data from database). So rougly the flow would be client -> mbean -> session bean -> database. What i currently did were; 1. Create a mbean that's serializable and bind the mbean to a jndi server using the following code. The mbean have some static Map for caching. private void bind(Context ctx, String name, Object val)throws NamingException{ Name n; for (n = ctx.getNameParser("").parse(name); n.size() > 1; n = n.getSuffix(1)){ String ctxName = n.get(0); try{ ctx = (Context) ctx.lookup(ctxName); }catch (NameNotFoundException namenotfoundexception){ ctx = ctx.createSubcontext(ctxName); } } ctx.bind(n.get(0), val); } 2. invoke the mbean through jboss RMIConnector, using the RMIAdapter bind at the Following jndi name "jmx/rmi/RMIAdaptor". Then I will invoke the mbean using the RemoteMBeanServer instance. RMIAdaptor adaptor = (RMIAdaptor)context.lookup(jndiName); RemoteMBeanServer server = new RMIConnectorImpl(adaptor); My questions are: 1. Is it appropriate to implement my objective using mbean or there is better altenatives? 2. I notice in the example there is NonSerializable binding. What is the different in binding A serializable or non serializable mbean? If I require to access the mbean remotely which is more appropriate? 3. If I had a serializable mbean, does that meant each time I invoke the mbean I will get a copy of the mbean or a 'proxy' of the mbean? From my testing I found that whenver I invoke the mbean through the connector, the changes is reflect at the server. 4. Does the mbean only instantiated once in the server JVM, meaning all the client will access the same mbean instance? If no, can I create a singleton mbean? 5. what's the different between RMIAdaptor and RMIConnector? Thanks. Any comments and suggestions are very much appreciated. Regards, Stephen ------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user