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
AMBeanServerProxythat 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 voidaddNotificationListener(String sName, NotificationListener listener, NotificationFilter filter, Object oHandback)Adds a listener to a registered MBean.<R> Rexecute(Remote.Function<MBeanServer,R> function)Afunctionexecuted on the management node.ObjectgetAttribute(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.MBeanInfogetMBeanInfo(String sName)Return the MBeanInfo for a given MBean.Objectinvoke(String sName, String sOpName, Object[] aoParams, String[] asSignature)Invoke an operation on the specified MBean.booleanisMBeanRegistered(String sName)Check whether or not an MBean with the specified name is already registered.MBeanServerProxylocal()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.voidremoveNotificationListener(String sName, NotificationListener listener)Removes a listener from a registered MBean.voidremoveNotificationListener(String sName, NotificationListener listener, NotificationFilter filter, Object oHandback)Removes a listener from a registered MBean.voidsetAttribute(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- theMBeanServerto wrap
-
WrapperMBeanServerProxy
public WrapperMBeanServerProxy(Supplier<MBeanServer> supplier)
Create aWrapperMBeanServerProxy.- Parameters:
supplier- theSupplierof theMBeanServerto wrap
-
-
Method Detail
-
getMBeanInfo
public MBeanInfo getMBeanInfo(String sName)
Description copied from interface:MBeanServerProxyReturn the MBeanInfo for a given MBean.- Specified by:
getMBeanInfoin interfaceMBeanServerProxy- Parameters:
sName- the MBean name- Returns:
- the MBeanInfo for the MBean or
nullif the MBean does not exist
-
execute
public <R> R execute(Remote.Function<MBeanServer,R> function)
Description copied from interface:MBeanServerProxyAfunctionexecuted on the management node. The function is provided a local MBeanServer and can return any serializable result.- Specified by:
executein 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:MBeanServerProxyReturn a Map of attribute name to attribute value for a given MBean name.The attributes returned must evaluate successfully against the provided
Filterto be returned.- Specified by:
getAttributesin 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:MBeanServerProxyObtain the value of the specified MBean attribute.- Specified by:
getAttributein 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:MBeanServerProxySet the value of the specified MBean attribute.- Specified by:
setAttributein 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:MBeanServerProxyInvoke an operation on the specified MBean.- Specified by:
invokein 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:MBeanServerProxyGet the names of MBeans controlled by the MBean server that is collocated with thecluster registry.- Specified by:
queryNamesin interfaceMBeanServerProxy- Parameters:
sPattern- the MBean name pattern identifying MBean names to be retrieved; this pattern is the same as in theMBeanServer.queryNamesmethod; 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:MBeanServerProxyGet the names of MBeans controlled by the MBean server that is collocated with thecluster registry.- Specified by:
queryNamesin interfaceMBeanServerProxy- Parameters:
pattern- the MBean name pattern identifying MBean names to be retrieved; this pattern is the same as in theMBeanServer.queryNamesmethod; 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:MBeanServerProxyCheck whether or not an MBean with the specified name is already registered.- Specified by:
isMBeanRegisteredin interfaceMBeanServerProxy- Parameters:
sName- the MBean name- Returns:
- true iff the specified name is already registered
-
local
public MBeanServerProxy local()
Description copied from interface:MBeanServerProxyReturn a local onlyMBeanServerProxy.A local only proxy operates only on the MBeans that are local to this member.
- Specified by:
localin interfaceMBeanServerProxy- Returns:
- a local only
MBeanServerProxy
-
addNotificationListener
public void addNotificationListener(String sName, NotificationListener listener, NotificationFilter filter, Object oHandback)
Description copied from interface:MBeanServerProxyAdds a listener to a registered MBean.Notifications emitted by the MBean will be forwarded to the listener.
- Specified by:
addNotificationListenerin 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:MBeanServerProxyRemoves 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:
removeNotificationListenerin 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:MBeanServerProxyRemoves a listener from a registered MBean.The MBean must have a listener that exactly matches the given
listener,filter, andhandbackparameters. If there is more than one such listener, only one is removed.The
filterandhandbackparameters may be null if and only if they are null in a listener to be removed.- Specified by:
removeNotificationListenerin 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)
-
-