Class NetworkDispatcher

  extended by java.lang.Thread
      extended by
All Implemented Interfaces:

public class NetworkDispatcher
extends java.lang.Thread

Provides a thread for performing network dispatch from a queue of requests. Requests added to the specified queue are processed from the network via a specified Network interface. Responses are committed to cache, if eligible, using a specified DiskCache interface. Valid responses and errors are posted back to the caller via a Delivery.

Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
Field Summary
Fields inherited from class java.lang.Thread
Constructor Summary
NetworkDispatcher(java.util.concurrent.BlockingQueue<Request> queue, Network network, DiskCache cache, Delivery delivery)
          Creates a new network dispatcher thread.
Method Summary
 void quit()
          Forces this dispatcher to quit immediately.
 void run()
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail


public NetworkDispatcher(java.util.concurrent.BlockingQueue<Request> queue,
                         Network network,
                         DiskCache cache,
                         Delivery delivery)
Creates a new network dispatcher thread. You must call Thread.start() in order to begin processing.

queue - Queue of incoming requests for triage
network - Network interface to use for performing requests
cache - Cache interface to use for writing responses to cache
delivery - Delivery interface to use for posting responses
Method Detail


public void quit()
Forces this dispatcher to quit immediately. If any requests are still in the queue, they are not guaranteed to be processed.


public void run()
Specified by:
run in interface java.lang.Runnable
run in class java.lang.Thread