Example usage for javax.management Notification getClass

List of usage examples for javax.management Notification getClass

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:com.buschmais.maexo.test.spring.SpringTest.java

/**
 * Test notification listener./*  w  ww .  j ava  2s .c o m*/
 * 
 * @throws InterruptedException
 */
public void test_notificationListener() throws InterruptedException {
    String newValue = "a new value";
    this.standardMBean.setAttribute(newValue);
    // notifications may be asynchronous, wait some time
    Thread.sleep(1000);
    Notification notification = this.notificationListener.getLastNotification();
    assertNotNull(notification);
    assertEquals(NOTIFICATION_HANDBACK, this.notificationListener.getLastHandback());
    if (notification instanceof AttributeChangeNotification) {
        AttributeChangeNotification attributeChangeNotification = (AttributeChangeNotification) notification;
        assertEquals(newValue, attributeChangeNotification.getNewValue());
    } else {
        super.fail("expected instance of " + AttributeChangeNotification.class.getName() + ", received "
                + notification.getClass().getName());
    }
}

From source file:org.josso.gateway.event.security.NotificationSSOEventListener.java

/**
 * Sends the SSOEvent found in this notification instance source property to the wrapped listener.
 *
 * @param notification a SSOEventNotification instance containing the SSOEvent.
 * @param object       the object that generated the notification.
 *//* ww w .ja va2s.  c o m*/
public void handleNotification(Notification notification, Object object) {

    if (logger.isDebugEnabled())
        logger.debug("Received notification " + notification + " for listener : " + listener);

    if (notification instanceof SSOEventNotification) {

        SSOEventNotification ssoNotification = (SSOEventNotification) notification;
        SSOEvent ssoEvent = ssoNotification.getEvent();
        listener.handleSSOEvent(ssoEvent);
        return;
    }

    logger.warn("Unknown notification type :  " + notification.getClass().getName());
}