Example usage for javax.management Notification setSource

List of usage examples for javax.management Notification setSource

Introduction

In this page you can find the example usage for javax.management Notification setSource.

Prototype

public void setSource(Object source) 

Source Link

Document

Sets the source.

Usage

From source file:kr.okplace.job.support.JobExecutionNotificationPublisher.java

/**
 * Publish the provided message to an external listener if there is one.
 * //from www  . j a  va 2  s  .c  om
 * @param message the message to publish
 */
private void publish(String message) {

    if (notificationPublisher != null) {
        Notification notification = new Notification("JobExecutionApplicationEvent", this, notificationCount++,
                message);
        /*
         * We can't create a notification with a null source, but we can set
         * it to null after creation(!). We want it to be null so that
         * Spring will replace it automatically with the ObjectName (in
         * ModelMBeanNotificationPublisher).
         */
        notification.setSource(null);
        notificationPublisher.sendNotification(notification);
    }
}

From source file:org.springframework.batch.sample.jmx.JobExecutionNotificationPublisher.java

/**
 * Publish the provided message to an external listener if there is one.
 * //from  w w w .  j a va  2  s. com
 * @param message the message to publish
 */
private void publish(String message) {
    if (notificationPublisher != null) {
        Notification notification = new Notification("JobExecutionApplicationEvent", this, notificationCount++,
                message);
        /*
         * We can't create a notification with a null source, but we can set
         * it to null after creation(!). We want it to be null so that
         * Spring will replace it automatically with the ObjectName (in
         * ModelMBeanNotificationPublisher).
         */
        notification.setSource(null);
        notificationPublisher.sendNotification(notification);
    }
}