|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread org.archive.crawler.framework.ToeThread
public class ToeThread
One "worker thread"; asks for CrawlURIs, processes them, repeats unless told otherwise.
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 |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
ToeThread(ToePool g,
int sn)
Create a ToeThread |
Method Summary | |
---|---|
CrawlController |
getController()
Get the CrawlController acossiated with this thread. |
java.lang.String |
getCurrentProcessorName()
|
HttpRecorder |
getHttpRecorder()
Used to get current threads HttpRecorder instance. |
java.lang.String[] |
getReports()
Get an array of report names offered by this Reporter. |
int |
getSerialNumber()
|
java.lang.Object |
getStep()
|
boolean |
isActive()
Is this thread validly processing a URI, not paused, waiting for a URI, or interrupted? |
protected void |
kill()
Terminates a thread. |
void |
progressStatisticsLegend(java.io.PrintWriter writer)
|
void |
progressStatisticsLine(java.io.PrintWriter writer)
|
void |
reportTo(java.io.PrintWriter writer)
Make a default report to the passed-in Writer. |
void |
reportTo(java.lang.String name,
java.io.PrintWriter pw)
Compiles and returns a report on its status. |
void |
retire()
Request that this thread retire (exit cleanly) at the earliest opportunity. |
void |
run()
(non-Javadoc) |
boolean |
shouldRetire()
Whether this thread should cleanly retire at the earliest opportunity. |
java.lang.String |
singleLineLegend()
Return a legend for the single-line summary report as a String. |
java.lang.String |
singleLineReport()
Return a short single-line summary report as a String. |
void |
singleLineReportTo(java.io.PrintWriter w)
Make a single-line summary report to the passed-in writer |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, 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 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ToeThread(ToePool g, int sn)
g
- ToeThreadGroupsn
- serial numberMethod Detail |
---|
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
Thread.run()
public int getSerialNumber()
public HttpRecorder getHttpRecorder()
getHttpRecorder
in interface HttpRecorderMarker
HttpRecorderMarker.getHttpRecorder()
public CrawlController getController()
protected void kill()
Calling this method will ensure that the current thread will stop processing as soon as possible (note: this may be never). Meant to 'short circuit' hung threads.
Current crawl uri will have its fetch status set accordingly and will be immediately returned to the frontier.
As noted before, this does not ensure that the thread will stop running (ever). But once evoked it will not try and communicate with other parts of crawler and will terminate as soon as control is established.
public java.lang.Object getStep()
public boolean isActive()
public void retire()
public boolean shouldRetire()
public void reportTo(java.lang.String name, java.io.PrintWriter pw)
reportTo
in interface Reporter
name
- Report name.pw
- Where to print.public void singleLineReportTo(java.io.PrintWriter w)
Reporter
singleLineReportTo
in interface Reporter
w
- PrintWriter to write to.public java.lang.String singleLineLegend()
Reporter
singleLineLegend
in interface Reporter
public java.lang.String[] getReports()
Reporter
getReports
in interface Reporter
public void reportTo(java.io.PrintWriter writer)
Reporter
reportTo
in interface Reporter
writer
- to receive reportpublic java.lang.String singleLineReport()
Reporter
singleLineReport
in interface Reporter
public void progressStatisticsLine(java.io.PrintWriter writer)
progressStatisticsLine
in interface ProgressStatisticsReporter
writer
- Where to write statistics.public void progressStatisticsLegend(java.io.PrintWriter writer)
progressStatisticsLegend
in interface ProgressStatisticsReporter
writer
- Where to write statistics legend.public java.lang.String getCurrentProcessorName()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |