|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.lang.Thread
stockDataRetrieval.NewsDownloaderThread
Threaded class to allow the aynchronous downloading of news stories pertaining to a single company.
| Nested Class Summary | |
private class |
NewsDownloaderThread.NotifyThread
Class to handle the notification of the owner class that the NewsDownloaderThread has completed. |
| Field Summary | |
private java.lang.Object |
registeredOwner
the object who spawned this thread, used to notify that owner when the thread completes |
private java.lang.String |
ticker
the ticker name which the current thread is responsible for for downloading news stories for |
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
NewsDownloaderThread(java.lang.String ticker,
java.lang.Object registeredOwner)
Constructor to initialize tell the thread its target |
|
| Method Summary | |
private java.util.ArrayList |
addFetchedStories(java.util.ArrayList oldStories,
java.util.ArrayList newStories)
Add the fetched stories to the growing stories array |
java.lang.String |
getTicker()
Gets the ticker name this thread is downloading |
private void |
notifyOwner()
Spawn a thread that now has the responsibility of notifying the owner of the thread. |
void |
run()
|
| 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, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
private java.lang.String ticker
private java.lang.Object registeredOwner
| Constructor Detail |
public NewsDownloaderThread(java.lang.String ticker,
java.lang.Object registeredOwner)
ticker - The target company the thread is to downloadregisteredOwner - The owner of this object who requires notification when the thread completes.
The owner can be null, in which case no notifications are sent when the thread
completes| Method Detail |
public java.lang.String getTicker()
private java.util.ArrayList addFetchedStories(java.util.ArrayList oldStories,
java.util.ArrayList newStories)
oldStories - the old list of stories on which to append newStoriesnewStories - the stories list gathered from a single page
public void run()
private void notifyOwner()
This prevents the thread from waiting unnecessarily queuing on the owner's synchronized notify function.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||