Package javax.mail
Class EventQueue
- java.lang.Object
-
- javax.mail.EventQueue
-
- All Implemented Interfaces:
java.lang.Runnable
class EventQueue extends java.lang.Object implements java.lang.Runnable
Package private class used by Store & Folder to dispatch events. This class implements an event queue, and a dispatcher thread that dequeues and dispatches events from the queue.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
EventQueue.QueueElement
A "struct" to put on the queue.(package private) static class
EventQueue.TerminatorEvent
A special event that causes the queue processing task to terminate.
-
Field Summary
Fields Modifier and Type Field Description private static java.util.WeakHashMap<java.lang.ClassLoader,EventQueue>
appq
private java.util.concurrent.Executor
executor
private java.util.concurrent.BlockingQueue<EventQueue.QueueElement>
q
-
Constructor Summary
Constructors Constructor Description EventQueue(java.util.concurrent.Executor ex)
Construct an EventQueue using the specified Executor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
enqueue(MailEvent event, java.util.Vector<? extends java.util.EventListener> vector)
Enqueue an event.(package private) static EventQueue
getApplicationEventQueue(java.util.concurrent.Executor ex)
Create (if necessary) an application-scoped event queue.void
run()
Pull events off the queue and dispatch them.(package private) void
terminateQueue()
Terminate the task running the queue, but only if there is a queue.
-
-
-
Field Detail
-
q
private volatile java.util.concurrent.BlockingQueue<EventQueue.QueueElement> q
-
executor
private java.util.concurrent.Executor executor
-
appq
private static java.util.WeakHashMap<java.lang.ClassLoader,EventQueue> appq
-
-
Method Detail
-
enqueue
void enqueue(MailEvent event, java.util.Vector<? extends java.util.EventListener> vector)
Enqueue an event.
-
terminateQueue
void terminateQueue()
Terminate the task running the queue, but only if there is a queue.
-
getApplicationEventQueue
static EventQueue getApplicationEventQueue(java.util.concurrent.Executor ex)
Create (if necessary) an application-scoped event queue. Application scoping is based on the thread's context class loader.
-
run
public void run()
Pull events off the queue and dispatch them.- Specified by:
run
in interfacejava.lang.Runnable
-
-