public class WrapperMBeanServerProxy extends Object implements MBeanServerProxy
MBeanServerProxy
that wraps a MBeanServer
.Constructor and Description |
---|
WrapperMBeanServerProxy(MBeanServer server)
Create a
WrapperMBeanServerProxy . |
WrapperMBeanServerProxy(Supplier<MBeanServer> supplier)
Create a
WrapperMBeanServerProxy . |
Modifier and Type | Method and Description |
---|---|
void |
addNotificationListener(String sName,
NotificationListener listener,
NotificationFilter filter,
Object oHandback)
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 oHandback)
Removes a listener from a registered MBean.
|
void |
setAttribute(String sName,
String sAttr,
Object oValue)
Set the value of the specified MBean attribute.
|
public WrapperMBeanServerProxy(MBeanServer server)
WrapperMBeanServerProxy
.server
- the MBeanServer
to wrappublic WrapperMBeanServerProxy(Supplier<MBeanServer> supplier)
WrapperMBeanServerProxy
.supplier
- the Supplier
of the MBeanServer
to wrappublic MBeanInfo getMBeanInfo(String sName)
MBeanServerProxy
getMBeanInfo
in interface MBeanServerProxy
sName
- the MBean namenull
if the MBean does not existpublic <R> R execute(Remote.Function<MBeanServer,R> function)
MBeanServerProxy
function
executed on the management node.
The function is provided a local MBeanServer and can return any serializable
result.execute
in interface MBeanServerProxy
R
- the return typefunction
- the function to executepublic Map<String,Object> getAttributes(String sName, Filter<String> filter)
MBeanServerProxy
The attributes returned must evaluate successfully against the provided
Filter
to be returned.
getAttributes
in interface MBeanServerProxy
sName
- the MBean namefilter
- filter to limit the returned attributespublic Object getAttribute(String sName, String sAttr)
MBeanServerProxy
getAttribute
in interface MBeanServerProxy
sName
- the MBean namesAttr
- the attribute namepublic void setAttribute(String sName, String sAttr, Object oValue)
MBeanServerProxy
setAttribute
in interface MBeanServerProxy
sName
- the MBean namesAttr
- the attribute nameoValue
- the attribute valuepublic Object invoke(String sName, String sOpName, Object[] aoParams, String[] asSignature)
MBeanServerProxy
invoke
in interface MBeanServerProxy
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 namepublic Set<String> queryNames(String sPattern, Filter<ObjectName> filter)
MBeanServerProxy
cluster registry
.queryNames
in interface MBeanServerProxy
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 MBeanspublic Set<String> queryNames(ObjectName pattern, Filter<ObjectName> filter)
MBeanServerProxy
cluster registry
.queryNames
in interface MBeanServerProxy
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 MBeanspublic boolean isMBeanRegistered(String sName)
MBeanServerProxy
isMBeanRegistered
in interface MBeanServerProxy
sName
- the MBean namepublic MBeanServerProxy local()
MBeanServerProxy
MBeanServerProxy
.
A local only proxy operates only on the MBeans that are local to this member.
local
in interface MBeanServerProxy
MBeanServerProxy
public void addNotificationListener(String sName, NotificationListener listener, NotificationFilter filter, Object oHandback)
MBeanServerProxy
Notifications emitted by the MBean will be forwarded to the listener.
addNotificationListener
in interface MBeanServerProxy
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 notificationsoHandback
- the context to be sent to the listener when a notification is emittedMBeanServerProxy.removeNotificationListener(String, NotificationListener)
,
MBeanServerProxy.removeNotificationListener(String, NotificationListener, NotificationFilter, Object)
public void removeNotificationListener(String sName, NotificationListener listener)
MBeanServerProxy
If the listener is registered more than once, perhaps with different filters or callbacks, this method will remove all those registrations.
removeNotificationListener
in interface MBeanServerProxy
sName
- the name of the MBean on which the listener should be removedlistener
- the listener to be removedMBeanServerProxy.addNotificationListener(String, NotificationListener, NotificationFilter, Object)
public void removeNotificationListener(String sName, NotificationListener listener, NotificationFilter filter, Object oHandback)
MBeanServerProxy
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.
removeNotificationListener
in interface MBeanServerProxy
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 addedoHandback
- the handback that was specified when the listener was addedMBeanServerProxy.addNotificationListener(String, NotificationListener, NotificationFilter, Object)