Search in sources :

Example 1 with UnsolicitedNotification

use of javax.naming.ldap.UnsolicitedNotification in project jdk8u_jdk by JetBrains.

the class EventSupport method fireUnsolicited.

/**
     * Fire an event to unsolicited listeners.
     * package private;
     * Called by LdapCtx when its clnt receives an unsolicited notification.
     */
synchronized void fireUnsolicited(Object obj) {
    if (debug) {
        System.err.println("EventSupport.fireUnsolicited: " + obj + " " + unsolicited);
    }
    if (unsolicited == null || unsolicited.size() == 0) {
        // before a fired event event reaches here.
        return;
    }
    if (obj instanceof UnsolicitedNotification) {
        // Fire UnsolicitedNotification to unsolicited listeners
        UnsolicitedNotificationEvent evt = new UnsolicitedNotificationEvent(ctx, (UnsolicitedNotification) obj);
        queueEvent(evt, unsolicited);
    } else if (obj instanceof NamingException) {
        // Fire NamingExceptionEvent to unsolicited listeners.
        NamingExceptionEvent evt = new NamingExceptionEvent(ctx, (NamingException) obj);
        queueEvent(evt, unsolicited);
        // When an exception occurs, the unsolicited listeners
        // are automatically deregistered.
        // When LdapClient.processUnsolicited() fires a NamingException,
        // it will update its listener list so we don't have to.
        // Likewise for LdapCtx.
        unsolicited = null;
    }
}
Also used : UnsolicitedNotificationEvent(javax.naming.ldap.UnsolicitedNotificationEvent) UnsolicitedNotification(javax.naming.ldap.UnsolicitedNotification)

Aggregations

UnsolicitedNotification (javax.naming.ldap.UnsolicitedNotification)1 UnsolicitedNotificationEvent (javax.naming.ldap.UnsolicitedNotificationEvent)1