Class SingleMBeanServerAccess

java.lang.Object
org.jolokia.server.core.util.jmx.SingleMBeanServerAccess
All Implemented Interfaces:
MBeanServerAccess

public class SingleMBeanServerAccess extends Object implements MBeanServerAccess
A simple executor which uses only a single connection. It does not support update change detection.
Since:
14.01.14
Author:
roland
  • Constructor Details

    • SingleMBeanServerAccess

      public SingleMBeanServerAccess(MBeanServerConnection pConnection)
      Constructor for wrapping a remote connection
      Parameters:
      pConnection - remote connection to wrap
  • Method Details

    • each

      Description copied from interface: MBeanServerAccess
      Iterate over all MBeanServers managed and call the handler via a callback. If is null or a pattern, the MBean names are queried on each MBeanServer and feed into the callback. If it is a full object name, then all MBeanServers are called with this object name in turn.
      Specified by:
      each in interface MBeanServerAccess
      Parameters:
      pObjectName - object name to lookup, which can be a pattern in which case a query is performed.
      pCallback - the action to be called for each MBean found on every server
      Throws:
      IOException
      ReflectionException
      MBeanException
    • call

      Description copied from interface: MBeanServerAccess
      Call an action an the first MBeanServer on which the action does not throw an InstanceNotFoundException will considered to be successful and this method returns with the return value of the succesful action. If no action was succesful, an IllegalArgumentException is raised (containing the last InstanceNotFoundException from the last tried server)
      Specified by:
      call in interface MBeanServerAccess
      Type Parameters:
      R - type of the return value
      Parameters:
      pObjectName - objectname given through to the action
      pMBeanAction - the action to call
      pExtraArgs - any extra args given also to the action
      Returns:
      the return value of the succesful action
      Throws:
      IOException
      ReflectionException
      MBeanException - if the JMX call causes an issue
      AttributeNotFoundException
      InstanceNotFoundException
    • queryNames

      public Set<ObjectName> queryNames(ObjectName pObjectName) throws IOException
      Description copied from interface: MBeanServerAccess
      Query all MBeanServer and return the union of all results
      Specified by:
      queryNames in interface MBeanServerAccess
      Parameters:
      pObjectName - pattern to query for. If null, then all MBean of all MBeanServers are returned
      Returns:
      the found MBeans
      Throws:
      IOException - if called remotely and an IOError occured.
    • destroy

      public void destroy()
    • hasMBeansListChangedSince

      public boolean hasMBeansListChangedSince(long pTimestamp)
      Description copied from interface: MBeanServerAccess
      Check whether the set of MBeans in all managed MBeanServer has been changed since the given time. The input is the epoch time in seconds, however, milliseconds would be much more appropriate. However, the Jolokia responses contain currently time measured in seconds. This should be changed in a future version, but this implies a quite heavy API changed (and if this is changed, the key "timestamp" should be changed to "time", too, in order to fail early in case of problems). In order to avoid inconsistencies for sub-second updates, we are comparing conservatively (so hasBeenUpdated might return "true" more often than required).
      Specified by:
      hasMBeansListChangedSince in interface MBeanServerAccess
      Parameters:
      pTimestamp - seconds since 1.1.1970
      Returns:
      true if the MBeans has been updated since this time, false otherwise
    • getMBeanServers

      public Set<MBeanServerConnection> getMBeanServers()
      Get all MBeanServers which are handled by this manager
      Specified by:
      getMBeanServers in interface MBeanServerAccess
      Returns:
      set of MBeanServers to handle (in the proper merge order)