Package com.tangosol.net.management
Interface MBeanServerProxy
- All Known Implementing Classes:
WrapperMBeanServerProxy
public interface MBeanServerProxy
MBeanServerProxy allows any cluster node that runs the Management service
to obtain and set attributes or invoke methods on registered MBeans.
Application logic can use MBeanServerProxy as follows:
Cluster cluster = CacheFactory.ensureCluster(); Registry registry = cluster.getManagement(); MBeanServerProxy proxy = registry.getMBeanServerProxy(); String sName = registry.ensureGlobalName( "type=PartitionAssignment,service=partitioned,responsibility=DistributionCoordinator"); String sStatusHA = (String) proxy.getAttribute(sName, "HAStatus");
- Since:
- Coherence 12.2.1
- Author:
- bbc 2014.09.24
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addNotificationListener
(String sName, NotificationListener listener, NotificationFilter filter, Object handback) Adds a listener to a registered MBean.<R> R
execute
(Remote.Function<MBeanServer, R> function) Afunction
executed on the management node.getAttribute
(String sName, String sAttr) Obtain the value of the specified MBean attribute.getAttributes
(String sName, Filter<String> filter) Return a Map of attribute name to attribute value for a given MBean name.getMBeanInfo
(String sName) Return the MBeanInfo for a given MBean.Invoke an operation on the specified MBean.boolean
isMBeanRegistered
(String sName) Check whether or not an MBean with the specified name is already registered.local()
Return a local onlyMBeanServerProxy
.queryNames
(String sPattern, Filter<ObjectName> filter) Get the names of MBeans controlled by the MBean server that is collocated with thecluster registry
.queryNames
(ObjectName pattern, Filter<ObjectName> filter) Get the names of MBeans controlled by the MBean server that is collocated with thecluster registry
.void
removeNotificationListener
(String sName, NotificationListener listener) Removes a listener from a registered MBean.void
removeNotificationListener
(String sName, NotificationListener listener, NotificationFilter filter, Object handback) Removes a listener from a registered MBean.void
setAttribute
(String sName, String sAttr, Object oValue) Set the value of the specified MBean attribute.
-
Method Details
-
getMBeanInfo
Return the MBeanInfo for a given MBean.- Parameters:
sName
- the MBean name- Returns:
- the MBeanInfo for the MBean or
null
if the MBean does not exist
-
execute
Afunction
executed on the management node. The function is provided a local MBeanServer and can return any serializable result.- Type Parameters:
R
- the return type- Parameters:
function
- the function to execute- Returns:
- the result returned by the function
- Since:
- 12.2.1.4.0
-
getAttributes
Return a Map of attribute name to attribute value for a given MBean name.The attributes returned must evaluate successfully against the provided
Filter
to be returned.- Parameters:
sName
- the MBean namefilter
- filter to limit the returned attributes- Returns:
- a Map of attribute name to attribute value
- Since:
- 12.2.1.4.0
-
getAttribute
Obtain the value of the specified MBean attribute.- Parameters:
sName
- the MBean namesAttr
- the attribute name- Returns:
- the value of the retrieved attribute
-
setAttribute
Set the value of the specified MBean attribute.- Parameters:
sName
- the MBean namesAttr
- the attribute nameoValue
- the attribute value
-
invoke
Invoke an operation on the specified MBean.- Parameters:
sName
- the MBean name to invoke the method onsOpName
- the name of the method to be invokedaoParams
- an array containing the method parametersasSignature
- an optional array containing the method signatures, this parameter is only necessary if there are multiple methods with the same name- Returns:
- the result of invocation
-
queryNames
Get the names of MBeans controlled by the MBean server that is collocated with thecluster registry
.- Parameters:
sPattern
- the MBean name pattern identifying MBean names to be retrieved; this pattern is the same as in theMBeanServer.queryNames
method; if null, the name of all registered MBeans will be retrievedfilter
- (optional) the filter to be applied for selecting MBeans- Returns:
- a set of MBean names matching the pattern and the filter
-
queryNames
Get the names of MBeans controlled by the MBean server that is collocated with thecluster registry
.- Parameters:
pattern
- the MBean name pattern identifying MBean names to be retrieved; this pattern is the same as in theMBeanServer.queryNames
method; if null, the name of all registered MBeans will be retrievedfilter
- (optional) the filter to be applied for selecting MBeans- Returns:
- a set of MBean names matching the pattern and the filter
-
isMBeanRegistered
Check whether or not an MBean with the specified name is already registered.- Parameters:
sName
- the MBean name- Returns:
- true iff the specified name is already registered
-
local
MBeanServerProxy local()Return a local onlyMBeanServerProxy
.A local only proxy operates only on the MBeans that are local to this member.
- Returns:
- a local only
MBeanServerProxy
-
addNotificationListener
void addNotificationListener(String sName, NotificationListener listener, NotificationFilter filter, Object handback) Adds a listener to a registered MBean.Notifications emitted by the MBean will be forwarded to the listener.
- Parameters:
sName
- the name of the MBean on which the listener should be addedlistener
- the listener object which will handle the notifications emitted by the registered MBeanfilter
- the filter object. If filter is null, no filtering will be performed before handling notificationshandback
- the context to be sent to the listener when a notification is emitted- See Also:
-
removeNotificationListener
Removes a listener from a registered MBean.If the listener is registered more than once, perhaps with different filters or callbacks, this method will remove all those registrations.
- Parameters:
sName
- the name of the MBean on which the listener should be removedlistener
- the listener to be removed- See Also:
-
removeNotificationListener
void removeNotificationListener(String sName, NotificationListener listener, NotificationFilter filter, Object handback) Removes a listener from a registered MBean.The MBean must have a listener that exactly matches the given
listener
,filter
, andhandback
parameters. If there is more than one such listener, only one is removed.The
filter
andhandback
parameters may be null if and only if they are null in a listener to be removed.- Parameters:
sName
- the name of the MBean on which the listener should be removedlistener
- the listener to be removedfilter
- the filter that was specified when the listener was addedhandback
- the handback that was specified when the listener was added- See Also:
-