src/share/classes/com/sun/jndi/ldap/EventQueue.java
Print this page
*** 23,33 ****
* questions.
*/
package com.sun.jndi.ldap;
- import java.io.*;
import java.util.Vector;
import java.util.EventObject;
import javax.naming.event.NamingEvent;
import javax.naming.event.NamingExceptionEvent;
--- 23,32 ----
*** 50,62 ****
private static class QueueElement {
QueueElement next = null;
QueueElement prev = null;
EventObject event = null;
! Vector vector = null;
! QueueElement(EventObject event, Vector vector) {
this.event = event;
this.vector = vector;
}
}
--- 49,61 ----
private static class QueueElement {
QueueElement next = null;
QueueElement prev = null;
EventObject event = null;
! Vector<NamingListener> vector = null;
! QueueElement(EventObject event, Vector<NamingListener> vector) {
this.event = event;
this.vector = vector;
}
}
*** 85,95 ****
* the event.</em>
* If the event is a <tt>NamingExceptionEvent</tt>, then all listeners
* are notified.
* @param vector List of NamingListeners that will be notified of event.
*/
! synchronized void enqueue(EventObject event, Vector vector) {
QueueElement newElt = new QueueElement(event, vector);
if (head == null) {
head = newElt;
tail = newElt;
--- 84,94 ----
* the event.</em>
* If the event is a <tt>NamingExceptionEvent</tt>, then all listeners
* are notified.
* @param vector List of NamingListeners that will be notified of event.
*/
! synchronized void enqueue(EventObject event, Vector<NamingListener> vector) {
QueueElement newElt = new QueueElement(event, vector);
if (head == null) {
head = newElt;
tail = newElt;
*** 131,141 ****
QueueElement qe;
try {
while ((qe = dequeue()) != null) {
EventObject e = qe.event;
! Vector v = qe.vector;
for (int i = 0; i < v.size(); i++) {
// Dispatch to corresponding NamingListener
// The listener should only be getting the event that
--- 130,140 ----
QueueElement qe;
try {
while ((qe = dequeue()) != null) {
EventObject e = qe.event;
! Vector<NamingListener> v = qe.vector;
for (int i = 0; i < v.size(); i++) {
// Dispatch to corresponding NamingListener
// The listener should only be getting the event that
*** 143,158 ****
// instanceof subinterfaces.)
// It is the responsibility of the enqueuer to
// only enqueue events with listseners of the correct type.
if (e instanceof NamingEvent) {
! ((NamingEvent)e).dispatch((NamingListener)v.elementAt(i));
// An exception occurred: if notify all naming listeners
} else if (e instanceof NamingExceptionEvent) {
! ((NamingExceptionEvent)e).dispatch(
! (NamingListener)v.elementAt(i));
} else if (e instanceof UnsolicitedNotificationEvent) {
((UnsolicitedNotificationEvent)e).dispatch(
(UnsolicitedNotificationListener)v.elementAt(i));
}
}
--- 142,156 ----
// instanceof subinterfaces.)
// It is the responsibility of the enqueuer to
// only enqueue events with listseners of the correct type.
if (e instanceof NamingEvent) {
! ((NamingEvent)e).dispatch(v.elementAt(i));
// An exception occurred: if notify all naming listeners
} else if (e instanceof NamingExceptionEvent) {
! ((NamingExceptionEvent)e).dispatch(v.elementAt(i));
} else if (e instanceof UnsolicitedNotificationEvent) {
((UnsolicitedNotificationEvent)e).dispatch(
(UnsolicitedNotificationListener)v.elementAt(i));
}
}