public interface MBeanServerProxy
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");
Modifier and Type | Method and Description |
---|---|
void |
addNotificationListener(String sName,
NotificationListener listener,
NotificationFilter filter,
Object handback)
Adds a listener to a registered MBean.
|
<R> R |
execute(Remote.Function<MBeanServer,R> function)
A
function executed on the management node. |
Object |
getAttribute(String sName,
String sAttr)
Obtain the value of the specified MBean attribute.
|
Map<String,Object> |
getAttributes(String sName,
Filter<String> filter)
Return a Map of attribute name to attribute value for a given MBean
name.
|
MBeanInfo |
getMBeanInfo(String sName)
Return the MBeanInfo for a given MBean.
|
Object |
invoke(String sName,
String sOpName,
Object[] aoParams,
String[] asSignature)
Invoke an operation on the specified MBean.
|
boolean |
isMBeanRegistered(String sName)
Check whether or not an MBean with the specified name is already registered.
|
MBeanServerProxy |
local()
Return a local only
MBeanServerProxy . |
Set<String> |
queryNames(ObjectName pattern,
Filter<ObjectName> filter)
Get the names of MBeans controlled by the MBean server that is collocated
with the
cluster registry . |
Set<String> |
queryNames(String sPattern,
Filter<ObjectName> filter)
Get the names of MBeans controlled by the MBean server that is collocated
with the
cluster 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.
|
MBeanInfo getMBeanInfo(String sName)
sName
- the MBean namenull
if the MBean does not exist<R> R execute(Remote.Function<MBeanServer,R> function)
function
executed on the management node.
The function is provided a local MBeanServer and can return any serializable
result.R
- the return typefunction
- the function to executeMap<String,Object> getAttributes(String sName, Filter<String> filter)
The attributes returned must evaluate successfully against the provided
Filter
to be returned.
sName
- the MBean namefilter
- filter to limit the returned attributesObject getAttribute(String sName, String sAttr)
sName
- the MBean namesAttr
- the attribute namevoid setAttribute(String sName, String sAttr, Object oValue)
sName
- the MBean namesAttr
- the attribute nameoValue
- the attribute valueObject invoke(String sName, String sOpName, Object[] aoParams, String[] asSignature)
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 nameSet<String> queryNames(String sPattern, Filter<ObjectName> filter)
cluster registry
.sPattern
- the MBean name pattern identifying MBean names to be
retrieved; this pattern is the same as in the MBeanServer.queryNames
method;
if null, the name of all registered MBeans will be retrievedfilter
- (optional) the filter to be applied for selecting MBeansSet<String> queryNames(ObjectName pattern, Filter<ObjectName> filter)
cluster registry
.pattern
- the MBean name pattern identifying MBean names to be
retrieved; this pattern is the same as in the MBeanServer.queryNames
method;
if null, the name of all registered MBeans will be retrievedfilter
- (optional) the filter to be applied for selecting MBeansboolean isMBeanRegistered(String sName)
sName
- the MBean nameMBeanServerProxy local()
MBeanServerProxy
.
A local only proxy operates only on the MBeans that are local to this member.
MBeanServerProxy
void addNotificationListener(String sName, NotificationListener listener, NotificationFilter filter, Object handback)
Notifications emitted by the MBean will be forwarded to the listener.
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 emittedremoveNotificationListener(String, NotificationListener)
,
removeNotificationListener(String, NotificationListener, NotificationFilter, Object)
void removeNotificationListener(String sName, NotificationListener listener)
If the listener is registered more than once, perhaps with different filters or callbacks, this method will remove all those registrations.
sName
- the name of the MBean on which the listener should be removedlistener
- the listener to be removedaddNotificationListener(String, NotificationListener, NotificationFilter, Object)
void removeNotificationListener(String sName, NotificationListener listener, NotificationFilter filter, Object handback)
The MBean must have a listener that exactly matches the
given listener
, filter
, and
handback
parameters. If there is more than one
such listener, only one is removed.
The filter
and handback
parameters
may be null if and only if they are null in a listener to be
removed.
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 addedaddNotificationListener(String, NotificationListener, NotificationFilter, Object)