public class ToeThread extends Thread implements org.archive.util.Reporter, org.archive.util.ProgressStatisticsReporter, org.archive.modules.fetcher.HostResolver, org.archive.io.SinkHandlerLogThread, org.archive.modules.ProcessorChain.ChainStatusReceiver
Modifier and Type | Class and Description |
---|---|
static class |
ToeThread.Step |
Thread.State, Thread.UncaughtExceptionHandler
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
ToeThread(org.archive.crawler.framework.ToePool g,
int sn)
Create a ToeThread
|
Modifier and Type | Method and Description |
---|---|
void |
atProcessor(org.archive.modules.Processor proc) |
org.archive.crawler.framework.CrawlController |
getController()
Get the CrawlController acossiated with this thread.
|
String |
getCurrentProcessorName() |
int |
getSerialNumber() |
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(PrintWriter writer) |
void |
progressStatisticsLine(PrintWriter writer) |
static void |
reportThread(Thread t,
PrintWriter pw) |
void |
reportTo(PrintWriter pw)
Compiles and returns a report on its status.
|
InetAddress |
resolve(String host) |
void |
retire()
Request that this thread retire (exit cleanly) at the earliest
opportunity.
|
void |
run()
(non-Javadoc)
|
void |
setStep(ToeThread.Step s,
String procName) |
String |
shortReportLegend() |
String |
shortReportLine() |
void |
shortReportLineTo(PrintWriter w) |
Map<String,Object> |
shortReportMap() |
boolean |
shouldRetire()
Whether this thread should cleanly retire at the earliest
opportunity.
|
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
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public ToeThread(org.archive.crawler.framework.ToePool g, int sn)
g
- ToeThreadGroupsn
- serial numberpublic void run()
run
in interface Runnable
run
in class Thread
Thread.run()
public void setStep(ToeThread.Step s, String procName)
s
- public void atProcessor(org.archive.modules.Processor proc)
atProcessor
in interface org.archive.modules.ProcessorChain.ChainStatusReceiver
public int getSerialNumber()
getSerialNumber
in interface org.archive.io.SinkHandlerLogThread
public org.archive.crawler.framework.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 Object getStep()
public boolean isActive()
public void retire()
public boolean shouldRetire()
public void reportTo(PrintWriter pw)
reportTo
in interface org.archive.util.Reporter
pw
- Where to print.public static void reportThread(Thread t, PrintWriter pw)
t
- Threadpw
- PrintWriterpublic Map<String,Object> shortReportMap()
public void shortReportLineTo(PrintWriter w)
w
- PrintWriter to write to.public String shortReportLegend()
public String shortReportLine()
public void progressStatisticsLine(PrintWriter writer)
progressStatisticsLine
in interface org.archive.util.ProgressStatisticsReporter
public void progressStatisticsLegend(PrintWriter writer)
progressStatisticsLegend
in interface org.archive.util.ProgressStatisticsReporter
public String getCurrentProcessorName()
getCurrentProcessorName
in interface org.archive.io.SinkHandlerLogThread
public InetAddress resolve(String host)
resolve
in interface org.archive.modules.fetcher.HostResolver
Copyright © 2005–2016 The Royal Danish Library, the Danish State and University Library, the National Library of France and the Austrian National Library.. All rights reserved.