Class Dispatcher

  extended byjava.lang.Thread
      extended byjegg.impl.Dispatcher
All Implemented Interfaces:

public class Dispatcher
extends java.lang.Thread

Used to dispatch messages to eggs. An instance of this class may be used to dispatch messages to multiple eggs, but it will always dispatch only a single message at a time.

When this class is loaded, a special dispatcher is created that is used to dispatch messages for eggs that were constructed without explicit specification of a dispatcher for the egg.

If a particular egg may take a long time to handle a message dispatched to it, then that egg should be constructed with its own dispatcher (see Egg(Object,Dispatcher)).

The Dispatcher class provides the fundamental mechanism that decouples an Egg implementation from its execution thread. The Dispatcher wraps the thread, not the Egg.

Field Summary
static Dispatcher DEFAULT_DISPATCHER
          The default scheduler
static java.lang.String DEFAULT_DISPATCHER_NAME
Fields inherited from class java.lang.Thread
Method Summary
static Dispatcher getAnonymousDispatcher()
static Dispatcher getDispatcher(java.lang.String name, boolean start)
static java.util.Iterator iterator()
 void run()
          Implementation of the Thread superclass run method.
 void start()
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, stop, stop, suspend, toString, yield
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Field Detail


public static final java.lang.String DEFAULT_DISPATCHER_NAME
See Also:
Constant Field Values


public static final Dispatcher DEFAULT_DISPATCHER
The default scheduler

Method Detail


public static java.util.Iterator iterator()


public static Dispatcher getDispatcher(java.lang.String name,
                                       boolean start)


public static Dispatcher getAnonymousDispatcher()


public void start()


public final void run()
Implementation of the Thread superclass run method. This implementation delivers messsages in turn to each egg. Messages are dispatched based on priority.

Copyright © 2004 . All Rights Reserved.