Package org.jppf.management.forwarding
Class AbstractMBeanForwarder
java.lang.Object
org.jppf.management.forwarding.AbstractMBeanForwarder
- Direct Known Subclasses:
DiagnosticsMBeanForwarder,JPPFNodeAdminMBeanForwarder,JPPFNodeMaintenanceMBeanForwarder,JPPFNodeProvisioningMBeanForwarder,JPPFNodeTaskMonitorMBeanForwarder,NodeConfigNotifierMBeanForwarder
Abstrat super class for generated node MBean forwarding proxies.
- Since:
- 6.2
- Author:
- Laurent Cohen
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractMBeanForwarder(JMXDriverConnectionWrapper jmx, String mbeanName) Initialize this forwarding proxy with the specified driver jmx connection and mbean name. -
Method Summary
Modifier and TypeMethodDescriptionaddNotificationListener(NodeSelector selector, NotificationListener listener) Add a listener to the MBean for all selected nodes, without filter or handback object.addNotificationListener(NodeSelector selector, NotificationListener listener, NotificationFilter filter, Object handback) Add a listener to the MBean for all selected nodes.<E> ResultsMap<String,E> getAttribute(NodeSelector selector, String attribute) Get the value of an attribute of the specified MBean for each specified node.<E> ResultsMap<String,E> invoke(NodeSelector selector, String methodName) Convenience method to invoke an MBean method that has no parameter.<E> ResultsMap<String,E> invoke(NodeSelector selector, String methodName, Object[] params, String[] signature) Invoke a method on the specified MBean of the selected nodes attached to the driver.voidRemove all listeners registered from this MBean forwarder.voidremoveNotificationListener(String listenerID) Remove a listener from this MBean forwarder.<E> ResultsMap<String,Void> setAttribute(NodeSelector selector, String attribute, E value) Set the value of an attribute of the specified MBean on the specified nodes attached to the driver.
-
Constructor Details
-
AbstractMBeanForwarder
Initialize this forwarding proxy with the specified driver jmx connection and mbean name.- Parameters:
jmx- a wrapper for the JMX connection to the driver.mbeanName- the name of the mbean to proxy for.- Throws:
Exception- if any error occurs.
-
-
Method Details
-
invoke
public <E> ResultsMap<String,E> invoke(NodeSelector selector, String methodName, Object[] params, String[] signature) throws Exception Invoke a method on the specified MBean of the selected nodes attached to the driver.- Type Parameters:
E- the type of results.- Parameters:
selector- a filter on the nodes attached to the driver, determines the nodes this method applies to.methodName- the name of the method to invoke.params- the method parameter values.signature- the types of the method parameters.- Returns:
- a mapping of node uuids to the result of invoking the MBean method on the corresponding node. Each result may be an exception.
Additionally, each result may benull, in particular if the invoked method has avoidreturn type. - Throws:
Exception- if the invocation failed.
-
invoke
Convenience method to invoke an MBean method that has no parameter.
This is equivalent to callingforwardInvoke(selector, name, methodName, (Object[]) null, (String[]) null).- Type Parameters:
E- the type of results.- Parameters:
selector- a filter on the nodes attached to the driver, determines the nodes this method applies to.methodName- the name of the method to invoke.- Returns:
- a mapping of node uuids to the result of invoking the MBean method on the corresponding node. Each result may be an exception.
Additionally, each result may benull, in particular if the invoked method has avoidreturn type. - Throws:
Exception- if the invocation failed.
-
getAttribute
public <E> ResultsMap<String,E> getAttribute(NodeSelector selector, String attribute) throws Exception Get the value of an attribute of the specified MBean for each specified node.- Type Parameters:
E- the type of results.- Parameters:
selector- a filter on the nodes attached to the driver, determines the nodes this method applies to.attribute- the name of the MBean attribute to read.- Returns:
- a mapping of node uuids to the result of getting the MBean attribute on the corresponding node. Each result may be an exception.
- Throws:
Exception- if the invocation failed.
-
setAttribute
public <E> ResultsMap<String,Void> setAttribute(NodeSelector selector, String attribute, E value) throws Exception Set the value of an attribute of the specified MBean on the specified nodes attached to the driver.- Type Parameters:
E- the type of the value to set.- Parameters:
selector- a filter on the nodes attached to the driver, determines the nodes this method applies to.attribute- the name of the MBean attribute to set.value- the value to set on the attribute.- Returns:
- a mapping of node uuids to an eventual exception resulting from setting the MBean attribute on the corresponding node.
- Throws:
Exception- if the invocation failed.
-
addNotificationListener
public String addNotificationListener(NodeSelector selector, NotificationListener listener) throws Exception Add a listener to the MBean for all selected nodes, without filter or handback object.- Parameters:
selector- a filter on the nodes attached to the driver, determines the nodes this method applies to.listener- The listener object which will handle the notifications emitted by the broadcaster.- Returns:
- a string which uniquely identifies the registered notification listener.
- Throws:
Exception- if any error occurs.
-
addNotificationListener
public String addNotificationListener(NodeSelector selector, NotificationListener listener, NotificationFilter filter, Object handback) throws Exception Add a listener to the MBean for all selected nodes.- Parameters:
selector- a filter on the nodes attached to the driver, determines the nodes this method applies to.listener- The listener object which will handle the notifications emitted by the broadcaster.filter- The filter object. If filter is null, no filtering occurs.handback- An opaque object to be sent back to the listener when a notification is emitted- Returns:
- a string which uniquely identifies the registered notification listener.
- Throws:
Exception- if any error occurs.
-
removeNotificationListener
Remove a listener from this MBean forwarder.- Parameters:
listenerID- a string which uniquely identifies the notification listener to remove.- Throws:
Exception- if any error occurs.
-
removeAllNotificationListeners
Remove all listeners registered from this MBean forwarder.- Throws:
Exception- if any error occurs.
-