Java Code Examples for javax.management.Notification#setSource()

The following examples show how to use javax.management.Notification#setSource() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultMBeanServerInterceptor.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void handleNotification(Notification notification,
                               Object handback) {
    if (notification != null) {
        if (notification.getSource() == mbean)
            notification.setSource(name);
    }

    /*
     * Listeners are not supposed to throw exceptions.  If
     * this one does, we could remove it from the MBean.  It
     * might indicate that a connector has stopped working,
     * for instance, and there is no point in sending future
     * notifications over that connection.  However, this
     * seems rather drastic, so instead we propagate the
     * exception and let the broadcaster handle it.
     */
    listener.handleNotification(notification, handback);
}
 
Example 2
Source File: DefaultMBeanServerInterceptor.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public void handleNotification(Notification notification,
                               Object handback) {
    if (notification != null) {
        if (notification.getSource() == mbean)
            notification.setSource(name);
    }

    /*
     * Listeners are not supposed to throw exceptions.  If
     * this one does, we could remove it from the MBean.  It
     * might indicate that a connector has stopped working,
     * for instance, and there is no point in sending future
     * notifications over that connection.  However, this
     * seems rather drastic, so instead we propagate the
     * exception and let the broadcaster handle it.
     */
    listener.handleNotification(notification, handback);
}
 
Example 3
Source File: DefaultMBeanServerInterceptor.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public void handleNotification(Notification notification,
                               Object handback) {
    if (notification != null) {
        if (notification.getSource() == mbean)
            notification.setSource(name);
    }

    /*
     * Listeners are not supposed to throw exceptions.  If
     * this one does, we could remove it from the MBean.  It
     * might indicate that a connector has stopped working,
     * for instance, and there is no point in sending future
     * notifications over that connection.  However, this
     * seems rather drastic, so instead we propagate the
     * exception and let the broadcaster handle it.
     */
    listener.handleNotification(notification, handback);
}
 
Example 4
Source File: DefaultMBeanServerInterceptor.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public void handleNotification(Notification notification,
                               Object handback) {
    if (notification != null) {
        if (notification.getSource() == mbean)
            notification.setSource(name);
    }

    /*
     * Listeners are not supposed to throw exceptions.  If
     * this one does, we could remove it from the MBean.  It
     * might indicate that a connector has stopped working,
     * for instance, and there is no point in sending future
     * notifications over that connection.  However, this
     * seems rather drastic, so instead we propagate the
     * exception and let the broadcaster handle it.
     */
    listener.handleNotification(notification, handback);
}
 
Example 5
Source File: DefaultMBeanServerInterceptor.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public void handleNotification(Notification notification,
                               Object handback) {
    if (notification != null) {
        if (notification.getSource() == mbean)
            notification.setSource(name);
    }

    /*
     * Listeners are not supposed to throw exceptions.  If
     * this one does, we could remove it from the MBean.  It
     * might indicate that a connector has stopped working,
     * for instance, and there is no point in sending future
     * notifications over that connection.  However, this
     * seems rather drastic, so instead we propagate the
     * exception and let the broadcaster handle it.
     */
    listener.handleNotification(notification, handback);
}
 
Example 6
Source File: DefaultMBeanServerInterceptor.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void handleNotification(Notification notification,
                               Object handback) {
    if (notification != null) {
        if (notification.getSource() == mbean)
            notification.setSource(name);
    }

    /*
     * Listeners are not supposed to throw exceptions.  If
     * this one does, we could remove it from the MBean.  It
     * might indicate that a connector has stopped working,
     * for instance, and there is no point in sending future
     * notifications over that connection.  However, this
     * seems rather drastic, so instead we propagate the
     * exception and let the broadcaster handle it.
     */
    listener.handleNotification(notification, handback);
}
 
Example 7
Source File: DefaultMBeanServerInterceptor.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public void handleNotification(Notification notification,
                               Object handback) {
    if (notification != null) {
        if (notification.getSource() == mbean)
            notification.setSource(name);
    }

    /*
     * Listeners are not supposed to throw exceptions.  If
     * this one does, we could remove it from the MBean.  It
     * might indicate that a connector has stopped working,
     * for instance, and there is no point in sending future
     * notifications over that connection.  However, this
     * seems rather drastic, so instead we propagate the
     * exception and let the broadcaster handle it.
     */
    listener.handleNotification(notification, handback);
}
 
Example 8
Source File: DefaultMBeanServerInterceptor.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public void handleNotification(Notification notification,
                               Object handback) {
    if (notification != null) {
        if (notification.getSource() == mbean)
            notification.setSource(name);
    }

    /*
     * Listeners are not supposed to throw exceptions.  If
     * this one does, we could remove it from the MBean.  It
     * might indicate that a connector has stopped working,
     * for instance, and there is no point in sending future
     * notifications over that connection.  However, this
     * seems rather drastic, so instead we propagate the
     * exception and let the broadcaster handle it.
     */
    listener.handleNotification(notification, handback);
}
 
Example 9
Source File: DefaultMBeanServerInterceptor.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
public void handleNotification(Notification notification,
                               Object handback) {
    if (notification != null) {
        if (notification.getSource() == mbean)
            notification.setSource(name);
    }

    /*
     * Listeners are not supposed to throw exceptions.  If
     * this one does, we could remove it from the MBean.  It
     * might indicate that a connector has stopped working,
     * for instance, and there is no point in sending future
     * notifications over that connection.  However, this
     * seems rather drastic, so instead we propagate the
     * exception and let the broadcaster handle it.
     */
    listener.handleNotification(notification, handback);
}
 
Example 10
Source File: CustomBean2.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
public void sendNotificationToMe(String name) {
  long sequence = sequenceNumber++;
  Notification n = new AttributeChangeNotification(this, sequenceNumber, System.currentTimeMillis(),
      name, "A", "long", sequence, sequenceNumber);
  n.setSource(RemoteTestModule.getMyVmid());
  sendNotification(n);
}
 
Example 11
Source File: OldMBeanServerTest.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public void handleNotification(
        Notification notification, Object handback) {
    if (notification.getSource() == userMBean)
        notification.setSource(name);
    userListener.handleNotification(notification, handback);
}
 
Example 12
Source File: OldMBeanServerTest.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public void handleNotification(
        Notification notification, Object handback) {
    if (notification.getSource() == userMBean)
        notification.setSource(name);
    userListener.handleNotification(notification, handback);
}
 
Example 13
Source File: OldMBeanServerTest.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
public void handleNotification(
        Notification notification, Object handback) {
    if (notification.getSource() == userMBean)
        notification.setSource(name);
    userListener.handleNotification(notification, handback);
}
 
Example 14
Source File: OldMBeanServerTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public void handleNotification(
        Notification notification, Object handback) {
    if (notification.getSource() == userMBean)
        notification.setSource(name);
    userListener.handleNotification(notification, handback);
}
 
Example 15
Source File: OldMBeanServerTest.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public void handleNotification(
        Notification notification, Object handback) {
    if (notification.getSource() == userMBean)
        notification.setSource(name);
    userListener.handleNotification(notification, handback);
}
 
Example 16
Source File: OldMBeanServerTest.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public void handleNotification(
        Notification notification, Object handback) {
    if (notification.getSource() == userMBean)
        notification.setSource(name);
    userListener.handleNotification(notification, handback);
}
 
Example 17
Source File: OldMBeanServerTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
public void handleNotification(
        Notification notification, Object handback) {
    if (notification.getSource() == userMBean)
        notification.setSource(name);
    userListener.handleNotification(notification, handback);
}
 
Example 18
Source File: ModelMBeanNotificationPublisher.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Replaces the notification source if necessary to do so.
 * From the {@link Notification javadoc}:
 * <i>"It is strongly recommended that notification senders use the object name
 * rather than a reference to the MBean object as the source."</i>
 * @param notification the {@link Notification} whose
 * {@link javax.management.Notification#getSource()} might need massaging
 */
private void replaceNotificationSourceIfNecessary(Notification notification) {
	if (notification.getSource() == null || notification.getSource().equals(this.managedResource)) {
		notification.setSource(this.objectName);
	}
}
 
Example 19
Source File: ModelMBeanNotificationPublisher.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Replaces the notification source if necessary to do so.
 * From the {@link Notification javadoc}:
 * <i>"It is strongly recommended that notification senders use the object name
 * rather than a reference to the MBean object as the source."</i>
 * @param notification the {@link Notification} whose
 * {@link javax.management.Notification#getSource()} might need massaging
 */
private void replaceNotificationSourceIfNecessary(Notification notification) {
	if (notification.getSource() == null || notification.getSource().equals(this.managedResource)) {
		notification.setSource(this.objectName);
	}
}
 
Example 20
Source File: ModelMBeanNotificationPublisher.java    From spring4-understanding with Apache License 2.0 2 votes vote down vote up
/**
 * From the {@link Notification javadoc}:
 * <p><i>"It is strongly recommended that notification senders use the object name
 * rather than a reference to the MBean object as the source."</i>
 * @param notification the {@link Notification} whose
 * {@link javax.management.Notification#getSource()} might need massaging
 */
private void replaceNotificationSourceIfNecessary(Notification notification) {
	if (notification.getSource() == null || notification.getSource().equals(this.managedResource)) {
		notification.setSource(this.objectName);
	}
}