Methods Summary |
---|
private synchronized javax.mail.EventQueue$QueueElement | dequeue()Dequeue the oldest object on the queue.
Used only by the run() method.
while (tail == null)
wait();
QueueElement elt = tail;
tail = elt.prev;
if (tail == null) {
head = null;
} else {
tail.next = null;
}
elt.prev = elt.next = null;
return elt;
|
public synchronized void | enqueue(javax.mail.event.MailEvent event, java.util.Vector vector)Enqueue an event.
QueueElement newElt = new QueueElement(event, vector);
if (head == null) {
head = newElt;
tail = newElt;
} else {
newElt.next = head;
head.prev = newElt;
head = newElt;
}
notifyAll();
|
public void | run()Pull events off the queue and dispatch them.
QueueElement qe;
try {
loop:
while ((qe = dequeue()) != null) {
MailEvent e = qe.event;
Vector v = qe.vector;
for (int i = 0; i < v.size(); i++)
try {
e.dispatch(v.elementAt(i));
} catch (Throwable t) {
if (t instanceof InterruptedException)
break loop;
// ignore anything else thrown by the listener
}
qe = null; e = null; v = null;
}
} catch (InterruptedException e) {
// just die
}
|
void | stop()Stop the dispatcher so we can be destroyed.
if (qThread != null) {
qThread.interrupt(); // kill our thread
qThread = null;
}
|