# Class MBeanServerNotificationFilter

java.lang.Object
javax.management.NotificationFilterSupport
javax.management.relation.MBeanServerNotificationFilter

All Implemented Interfaces:
  `Serializable, NotificationFilter`

public class MBeanServerNotificationFilter extends NotificationFilterSupport
Filter for `MBeanServerNotification`. This filter filters MBeanServerNotification notifications by selecting the ObjectNames of interest and the operations (registration, unregistration, both) of interest (corresponding to notification types).

The serialVersionUID of this class is `2605900539589789736L`.

Since:
  1.5
See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MBeanServerNotificationFilter()`
  Creates a filter selecting all MBeanServerNotification notifications for all ObjectNames.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `disableAllObjectNames()`
  Disables any MBeanServerNotification (all ObjectNames are deselected).
  `void`
  `disableObjectName(ObjectName objectName)`
  Disables MBeanServerNotifications concerning given ObjectName.
  `void`
  `enableAllObjectNames()`
  Enables all MBeanServerNotifications (all ObjectNames are selected).
  `void`
  `enableObjectName(ObjectName objectName)`
  Enables MBeanServerNotifications concerning given ObjectName.
  `Vector<ObjectName>`
  `getDisabledObjectNames()`
  Gets all the ObjectNames disabled.
  `Vector<ObjectName>`
  `getEnabledObjectNames()`
  Gets all the ObjectNames enabled.
  `boolean`
  `isNotificationEnabled(Notification notif)`
  Invoked before sending the specified notification to the listener.

  ### Methods declared in class NotificationFilterSupport

  `disableAllTypes, disableType, enableType, getEnabledTypes`
  Modifier and Type
  Method
  Description
  `void`
  `disableAllTypes()`
  Disables all notification types.
  `void`
  `disableType(String prefix)`
  Removes the given prefix from the prefix list.
  `void`
  `enableType(String prefix)`
  Enables all the notifications the type of which starts with the specified prefix to be sent to the listener.
  `Vector<String>`
  `getEnabledTypes()`
  Gets all the enabled notification types for this filter.

  ### Methods declared in class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
  Modifier and Type
  Method
  Description
  `protected Object`
  `clone()`
  Creates and returns a copy of this object.
  `boolean`
  `equals(Object obj)`
  Indicates whether some other object is "equal to" this one.
  `protected void`
  `finalize()`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Finalization is deprecated and subject to removal in a future release.
  `final Class<?>`
  `getClass()`
  Returns the runtime class of this `Object`.
  `int`
  `hashCode()`
  Returns a hash code value for this object.
  `final void`
  `notify()`
  Wakes up a single thread that is waiting on this object's monitor.
  `final void`
  `notifyAll()`
  Wakes up all threads that are waiting on this object's monitor.
  `String`
  `toString()`
  Returns a string representation of the object.
  `final void`
  `wait()`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted.
  `final void`
  `wait(long timeoutMillis)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
  `final void`
  `wait(long timeoutMillis, int nanos)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

- ## Constructor Details

  - ### MBeanServerNotificationFilter

    public MBeanServerNotificationFilter()
    Creates a filter selecting all MBeanServerNotification notifications for all ObjectNames.

- ## Method Details

  - ### disableAllObjectNames

    public void disableAllObjectNames()
    Disables any MBeanServerNotification (all ObjectNames are deselected).

  - ### disableObjectName

    public void disableObjectName(ObjectName objectName) throws IllegalArgumentException
    Disables MBeanServerNotifications concerning given ObjectName.
    Parameters:
      `objectName` - ObjectName no longer of interest
    Throws:
      `IllegalArgumentException` - if the given ObjectName is null

  - ### enableAllObjectNames

    public void enableAllObjectNames()
    Enables all MBeanServerNotifications (all ObjectNames are selected).

  - ### enableObjectName

    public void enableObjectName(ObjectName objectName) throws IllegalArgumentException
    Enables MBeanServerNotifications concerning given ObjectName.
    Parameters:
      `objectName` - ObjectName of interest
    Throws:
      `IllegalArgumentException` - if the given ObjectName is null

  - ### getEnabledObjectNames

    public Vector<ObjectName> getEnabledObjectNames()
    Gets all the ObjectNames enabled.
    Returns:
      Vector of ObjectNames:

      - null means all ObjectNames are implicitly selected, except the ObjectNames explicitly deselected

      - empty means all ObjectNames are deselected, i.e. no ObjectName selected.

  - ### getDisabledObjectNames

    public Vector<ObjectName> getDisabledObjectNames()
    Gets all the ObjectNames disabled.
    Returns:
      Vector of ObjectNames:

      - null means all ObjectNames are implicitly deselected, except the ObjectNames explicitly selected

      - empty means all ObjectNames are selected, i.e. no ObjectName deselected.

  - ### isNotificationEnabled

    public boolean isNotificationEnabled(Notification notif) throws IllegalArgumentException
    Invoked before sending the specified notification to the listener.

    If:

    - the ObjectName of the concerned MBean is selected (explicitly OR (implicitly and not explicitly deselected))

    AND

    - the type of the operation (registration or unregistration) is selected

    then the notification is sent to the listener.

    Specified by:
      `isNotificationEnabled` in interface `NotificationFilter`
    Overrides:
      `isNotificationEnabled` in class `NotificationFilterSupport`
    Parameters:
      `notif` - The notification to be sent.
    Returns:
      true if the notification has to be sent to the listener, false otherwise.
    Throws:
      `IllegalArgumentException` - if null parameter