org.yajul.jmx
Class JmxBridge
java.lang.Object
org.yajul.jmx.JmxBridge
public class JmxBridge
- extends java.lang.Object
Provides an in-JVM bridge between a JMX service and a POJO implementation
that lives inside an EAR or a WAR deployment. The bridge is a singleton
that contains a set of proxy objects associated with the implementation class
name. The proxy objects are initialized by a startup Servlet (or any
object that has access to the EAR/WAR class loader). The lifecycle calls
from the JMX bean are routed through the proxy to the implementation POJO.
What you need to use it:
- A JMX Management Bean, deployed as a JMX service
(a '.sar' in JBoss). The MBean code will not load the implementation class
directly, but it will know the name of the class.
- An implementation POJO, deployed in a WAR or EAR. This must implement
org.yajul.ee5.jmx.Lifecycle.
- A startup Servlet, or equivalent code that gets executed when the EAR/WAR
is deployed. This is what will instantiate and register the POJO
implementation with the bridge singleton.
Usage:
- Create the implementation POJO in your WAR/EAR module. Implement
the Lifecycle interface. NOTE: Do not package the YAJUL jars inside the
EAR or WAR.
- Create or modify an existing startup Servlet. Call the register() method
in the JmxBridge singleton for each implementation POJO.
- Create the JMX MBean. In the JMX MBean methods, get the proxy using
the implementation class name (Don't link directly with the class, that
would defeat the purpose!). Delegate the start() and stop() methods to
the proxy.
- Package the JMX MBean appropriately for your container. Make sure the
jar with the JmxBridge code is in the 'root' classloader, and not deployed
with the JMX MBean, otherwise the bridge will not function. In JBoss
you can do this by simply adding the YAJUL jar to the server lib
directory.
- Deploy the YAJUL jar, the JMX MBean, and the EAR or WAR. When the
server starts you should see the Proxy being registered and the POJO
implementation being created when the startup Servlet runs.
User: Joshua Davis
Date: Aug 29, 2007
Time: 5:58:11 AM
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JmxBridge
public JmxBridge()
getInstance
public static JmxBridge getInstance()
reset
public void reset()
getProxy
public Proxy getProxy(java.lang.String implementationClassName)
register
public void register(java.lang.Class implClass)
throws java.lang.Exception
- Register a specific implementation class with the bridge. Invoke this from a suitable class loading context. For example, from
a startup Servlet.
- Parameters:
implClass
- the implementation class.
- Throws:
java.lang.Exception
- if the proxies created by the MBeans could not be initialized.
initializeProxies
public void initializeProxies()
throws java.lang.Exception
- Initializes all the proxies. Invoke this from a suitable class loading context. For example, from
a startup Servlet.
- Throws:
java.lang.Exception
- if the proxies created by the MBeans could not be initialized.
Copyright © 2008. All Rights Reserved.