Querying and filtering are actually performed by the MBean server itself, not by a separate MBean. This insures that such critical services are always available. Queries and filters are performed in a single operation, whose goal is to select the MBeans upon which management operations are performed.
Usually, a management application will perform a query in order to find the MBeans which will be the target of its management requests. To select MBeans, applications may specify:
An object name filter - This is an incomplete object name which the MBean server will try to match with the object names of all registered MBeans. All MBeans whose name matches the filter pattern will be selected. Filters may contain wildcards to select sets of MBeans, or a filter may be a complete object name which must be matched exactly. Filter rules are explained in detail in the JMX specification.
A query expression - A query is an object that represents a set of constraints applied to the attribute of an MBean. For each of the MBeans that passes the filter, the MBean server determines if the current state of the MBean satisfies the query expression. Queries usually test for attribute values or MBean class names.
For example, a filter could select all the MBeans whose object name contains "MyMBeans" and for which the attribute named color is currently equal to "red".
The result of a query operation is a list of MBean object names, which can then be used in other management requests.