|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.Observable
ecologylab.generic.ObservableDebug
ecologylab.concurrent.Monitor
ecologylab.concurrent.DownloadMonitor<T>
public class DownloadMonitor<T extends Downloadable>
Non-linear flow multiplexer. Tracks downloads of Downloadable objects. Dispatches
downloaded media to the appropriate DispatchTarget.
Looks out for timeout conditions. In case they happen, records state in the bad
slot, and dispatches, as well.
| Field Summary | |
|---|---|
static int |
HIGH_PRIORITY
|
static int |
HIGHER_PRIORITY
|
static int |
LOW_PRIORITY
|
static int |
MAX_WAIT_TIME
|
static int |
MID_PRIORITY
|
| Constructor Summary | |
|---|---|
DownloadMonitor(java.lang.String name,
int numDownloadThreads)
|
|
DownloadMonitor(java.lang.String name,
int numDownloadThreads,
int priorityBoost)
|
|
| Method Summary | |
|---|---|
void |
cancelDownload(Downloadable thatDownloadable)
Cancel a download that has been queued, but not yet started. |
void |
clear()
Stop performing downloads, and then Get rid of queued DownloadClosures. |
void |
download(T thatDownloadable,
DispatchTarget<T> dispatchTarget)
Entry point for Downloadables that want to be downloaded by 1 of our
performDownload() threads. |
StatusReporter |
getStatus()
|
static NewPorterStemmer |
getStemmer()
|
boolean |
highNumberWaiting()
|
int |
highPriority()
|
boolean |
isPaused()
|
int |
lowPriority()
|
boolean |
midNumberWaiting()
|
int |
midPriority()
|
void |
pause()
|
void |
pause(boolean paused)
|
int |
pending()
|
void |
printQueue()
|
void |
setHurry(boolean hurry)
|
void |
setNoWait(boolean noWait)
Set whether or not this download monitor needs to wait after each download attempt |
void |
setStatus(StatusReporter status)
|
int |
size()
|
void |
stop()
|
void |
stop(boolean kill)
Stop our threads. |
int |
toDownloadSize()
check the number of elements in the toDownload Queue |
java.lang.String |
toString()
|
void |
unpause()
|
void |
waitIfTooManyPending()
|
int |
waitingToDownload()
|
| Methods inherited from class ecologylab.concurrent.Monitor |
|---|
done, notify, notifyAll, wait, wait, waitForDone |
| Methods inherited from class ecologylab.generic.ObservableDebug |
|---|
debug, debug, debugA, debugA, debugI, debugI, error, getClassName, print, println, println, println, show, superString |
| Methods inherited from class java.util.Observable |
|---|
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int HIGHER_PRIORITY
public static final int HIGH_PRIORITY
public static final int MID_PRIORITY
public static final int LOW_PRIORITY
public static final int MAX_WAIT_TIME
| Constructor Detail |
|---|
public DownloadMonitor(java.lang.String name,
int numDownloadThreads)
public DownloadMonitor(java.lang.String name,
int numDownloadThreads,
int priorityBoost)
| Method Detail |
|---|
public void download(T thatDownloadable,
DispatchTarget<T> dispatchTarget)
Downloadables that want to be downloaded by 1 of our
performDownload() threads. Starts the performDownload() threads, if necessary.
After performDownload() is called on the Downloadable, then in the normal case, downloadDone()
is called, and then the DispatchTarget is called. In the error case, handleIOError() or
handleTimeout() is called.
download in interface DownloadProcessor<T extends Downloadable>public void cancelDownload(Downloadable thatDownloadable)
thatDownloadable - public void pause()
public void unpause()
public void pause(boolean paused)
public java.lang.String toString()
toString in class ObservableDebugpublic void stop()
stop in interface DownloadProcessor<T extends Downloadable>public void stop(boolean kill)
public int waitingToDownload()
public boolean highNumberWaiting()
public boolean midNumberWaiting()
public int lowPriority()
public int midPriority()
public int highPriority()
public int pending()
public void setNoWait(boolean noWait)
noWait - public void setHurry(boolean hurry)
public static NewPorterStemmer getStemmer()
public int toDownloadSize()
public void clear()
public void waitIfTooManyPending()
public void printQueue()
public StatusReporter getStatus()
public void setStatus(StatusReporter status)
public boolean isPaused()
public int size()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||