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 Details

    • getMBeanInfo

      MBeanInfo getMBeanInfo(String sName)
      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

      <R> R execute(Remote.Function<MBeanServer,R> function)
      A function 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

      Map<String,Object> getAttributes(String sName, Filter<String> filter)
      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 name
      filter - filter to limit the returned attributes
      Returns:
      a Map of attribute name to attribute value
      Since:
      12.2.1.4.0
    • getAttribute

      Object getAttribute(String sName, String sAttr)
      Obtain the value of the specified MBean attribute.
      Parameters:
      sName - the MBean name
      sAttr - the attribute name
      Returns:
      the value of the retrieved attribute
    • setAttribute

      void setAttribute(String sName, String sAttr, Object oValue)
      Set the value of the specified MBean attribute.
      Parameters:
      sName - the MBean name
      sAttr - the attribute name
      oValue - the attribute value
    • invoke

      Object invoke(String sName, String sOpName, Object[] aoParams, String[] asSignature)
      Invoke an operation on the specified MBean.
      Parameters:
      sName - the MBean name to invoke the method on
      sOpName - the name of the method to be invoked
      aoParams - an array containing the method parameters
      asSignature - 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

      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.
      Parameters:
      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 retrieved
      filter - (optional) the filter to be applied for selecting MBeans
      Returns:
      a set of MBean names matching the pattern and the filter
    • queryNames

      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.
      Parameters:
      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 retrieved
      filter - (optional) the filter to be applied for selecting MBeans
      Returns:
      a set of MBean names matching the pattern and the filter
    • isMBeanRegistered

      boolean isMBeanRegistered(String sName)
      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

      Return a local only MBeanServerProxy.

      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 added
      listener - the listener object which will handle the notifications emitted by the registered MBean
      filter - the filter object. If filter is null, no filtering will be performed before handling notifications
      handback - the context to be sent to the listener when a notification is emitted
      See Also:
    • removeNotificationListener

      void removeNotificationListener(String sName, NotificationListener listener)
      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 removed
      listener - 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, 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.

      Parameters:
      sName - the name of the MBean on which the listener should be removed
      listener - the listener to be removed
      filter - the filter that was specified when the listener was added
      handback - the handback that was specified when the listener was added
      See Also: