Package com.tangosol.net.management
Class WrapperMBeanServerProxy
- java.lang.Object
-
- com.tangosol.net.management.WrapperMBeanServerProxy
-
- All Implemented Interfaces:
MBeanServerProxy
public class WrapperMBeanServerProxy extends Object implements MBeanServerProxy
AMBeanServerProxy
that wraps aMBeanServer
.- Author:
- jk 2019.05.30
-
-
Constructor Summary
Constructors Constructor Description WrapperMBeanServerProxy(Supplier<MBeanServer> supplier)
Create aWrapperMBeanServerProxy
.WrapperMBeanServerProxy(MBeanServer server)
Create aWrapperMBeanServerProxy
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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)
Afunction
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 onlyMBeanServerProxy
.Set<String>
queryNames(String sPattern, Filter<ObjectName> filter)
Get the names of MBeans controlled by the MBean server that is collocated with thecluster registry
.Set<String>
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 oHandback)
Removes a listener from a registered MBean.void
setAttribute(String sName, String sAttr, Object oValue)
Set the value of the specified MBean attribute.
-
-
-
Constructor Detail
-
WrapperMBeanServerProxy
public WrapperMBeanServerProxy(MBeanServer server)
Create aWrapperMBeanServerProxy
.- Parameters:
server
- theMBeanServer
to wrap
-
WrapperMBeanServerProxy
public WrapperMBeanServerProxy(Supplier<MBeanServer> supplier)
Create aWrapperMBeanServerProxy
.- Parameters:
supplier
- theSupplier
of theMBeanServer
to wrap
-
-
Method Detail
-
getMBeanInfo
public MBeanInfo getMBeanInfo(String sName)
Description copied from interface:MBeanServerProxy
Return the MBeanInfo for a given MBean.- Specified by:
getMBeanInfo
in interfaceMBeanServerProxy
- Parameters:
sName
- the MBean name- Returns:
- the MBeanInfo for the MBean or
null
if the MBean does not exist
-
execute
public <R> R execute(Remote.Function<MBeanServer,R> function)
Description copied from interface:MBeanServerProxy
Afunction
executed on the management node. The function is provided a local MBeanServer and can return any serializable result.- Specified by:
execute
in interfaceMBeanServerProxy
- Type Parameters:
R
- the return type- Parameters:
function
- the function to execute- Returns:
- the result returned by the function
-
getAttributes
public Map<String,Object> getAttributes(String sName, Filter<String> filter)
Description copied from interface:MBeanServerProxy
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.- Specified by:
getAttributes
in interfaceMBeanServerProxy
- Parameters:
sName
- the MBean namefilter
- filter to limit the returned attributes- Returns:
- a Map of attribute name to attribute value
-
getAttribute
public Object getAttribute(String sName, String sAttr)
Description copied from interface:MBeanServerProxy
Obtain the value of the specified MBean attribute.- Specified by:
getAttribute
in interfaceMBeanServerProxy
- Parameters:
sName
- the MBean namesAttr
- the attribute name- Returns:
- the value of the retrieved attribute
-
setAttribute
public void setAttribute(String sName, String sAttr, Object oValue)
Description copied from interface:MBeanServerProxy
Set the value of the specified MBean attribute.- Specified by:
setAttribute
in interfaceMBeanServerProxy
- Parameters:
sName
- the MBean namesAttr
- the attribute nameoValue
- the attribute value
-
invoke
public Object invoke(String sName, String sOpName, Object[] aoParams, String[] asSignature)
Description copied from interface:MBeanServerProxy
Invoke an operation on the specified MBean.- Specified by:
invoke
in interfaceMBeanServerProxy
- 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
public Set<String> queryNames(String sPattern, Filter<ObjectName> filter)
Description copied from interface:MBeanServerProxy
Get the names of MBeans controlled by the MBean server that is collocated with thecluster registry
.- Specified by:
queryNames
in interfaceMBeanServerProxy
- 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
public Set<String> queryNames(ObjectName pattern, Filter<ObjectName> filter)
Description copied from interface:MBeanServerProxy
Get the names of MBeans controlled by the MBean server that is collocated with thecluster registry
.- Specified by:
queryNames
in interfaceMBeanServerProxy
- 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
public boolean isMBeanRegistered(String sName)
Description copied from interface:MBeanServerProxy
Check whether or not an MBean with the specified name is already registered.- Specified by:
isMBeanRegistered
in interfaceMBeanServerProxy
- Parameters:
sName
- the MBean name- Returns:
- true iff the specified name is already registered
-
local
public MBeanServerProxy local()
Description copied from interface:MBeanServerProxy
Return a local onlyMBeanServerProxy
.A local only proxy operates only on the MBeans that are local to this member.
- Specified by:
local
in interfaceMBeanServerProxy
- Returns:
- a local only
MBeanServerProxy
-
addNotificationListener
public void addNotificationListener(String sName, NotificationListener listener, NotificationFilter filter, Object oHandback)
Description copied from interface:MBeanServerProxy
Adds a listener to a registered MBean.Notifications emitted by the MBean will be forwarded to the listener.
- Specified by:
addNotificationListener
in interfaceMBeanServerProxy
- 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 notificationsoHandback
- the context to be sent to the listener when a notification is emitted- See Also:
MBeanServerProxy.removeNotificationListener(String, NotificationListener)
,MBeanServerProxy.removeNotificationListener(String, NotificationListener, NotificationFilter, Object)
-
removeNotificationListener
public void removeNotificationListener(String sName, NotificationListener listener)
Description copied from interface:MBeanServerProxy
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.
- Specified by:
removeNotificationListener
in interfaceMBeanServerProxy
- Parameters:
sName
- the name of the MBean on which the listener should be removedlistener
- the listener to be removed- See Also:
MBeanServerProxy.addNotificationListener(String, NotificationListener, NotificationFilter, Object)
-
removeNotificationListener
public void removeNotificationListener(String sName, NotificationListener listener, NotificationFilter filter, Object oHandback)
Description copied from interface:MBeanServerProxy
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.- Specified by:
removeNotificationListener
in interfaceMBeanServerProxy
- 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 addedoHandback
- the handback that was specified when the listener was added- See Also:
MBeanServerProxy.addNotificationListener(String, NotificationListener, NotificationFilter, Object)
-
-