Querying and filtering are performed by the MBean server, not by a separate MBean. This ensures that such critical services are always available. Queries and filters are performed in a single operation, whose goal is to select the MBeans on which management operations are performed.
Usually, a management application performs a query to find the MBeans that are the target of its management requests. To select MBeans, applications can specify the following.
An object name filter, which is a possibly incomplete object name that the MBean server tries to match with the object names of all registered MBeans. All MBeans whose names match the filter pattern are selected. Filters can contain wildcards to select sets of MBeans, or a filter can be a complete object name that must be matched exactly. Filter rules are explained in detail in the JMX specification.
A query expression, which is an object that represents a set of constraints applied to the attribute of an MBean. For each MBean 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 names contain 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.