Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.archive.crawler.framework
Class ToePool

    java.lang.Object
      java.lang.ThreadGroup
          org.archive.crawler.framework.ToePool

All Implemented Interfaces:
  java.lang.Thread.UncaughtExceptionHandler, Reporter

    public class ToePool

extends java.lang.ThreadGroup
implements Reporter

A collection of ToeThreads. The class manages the ToeThreads currently running. Including increasing and decreasing their number, keeping track of their state and it can be used to kill hung threads.

Author:
  Gordon Mohr, Kristinn Sigurdsson
See Also:
  `ToeThread`

Field Summary
`static java.lang.String` | `COMPACT_REPORT`
`protected CrawlController` | `controller`
`static int` | `DEFAULT_TOE_PRIORITY` run worker thread slightly lower than usual
`protected int` | `nextSerialNumber`
`protected static java.lang.String[]` | `REPORTS`
`static java.lang.String` | `STANDARD_REPORT`
`protected int` | `targetSize`

Constructor Summary
`ToePool(CrawlController c)` Constructor.

Method Summary
`void` | `cleanup()`
`protected void` | `compactReportTo(java.io.PrintWriter writer)`
`int` | `getActiveToeCount()`
`CrawlController` | `getController()`
`java.lang.String[]` | `getReports()` Get an array of report names offered by this Reporter.
`int` | `getToeCount()`
`void` | `killThread(int threadNumber, boolean replace)` Kills specified thread.
`void` | `reportTo(java.io.PrintWriter writer)` Make a default report to the passed-in Writer.
`void` | `reportTo(java.lang.String name, java.io.PrintWriter writer)` Make a report of the given name to the passed-in Writer, If null, give the default report.
`void` | `setSize(int newsize)` Change the number of ToeThreads.
`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
`protected void` | `standardReportTo(java.io.PrintWriter writer)`

Methods inherited from class java.lang.ThreadGroup
`activeCount, activeGroupCount, allowThreadSuspension, checkAccess, destroy, enumerate, enumerate, enumerate, enumerate, getMaxPriority, getName, getParent, interrupt, isDaemon, isDestroyed, list, parentOf, resume, setDaemon, setMaxPriority, stop, suspend, toString, uncaughtException`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### DEFAULT_TOE_PRIORITY

    public static int DEFAULT_TOE_PRIORITY

  run worker thread slightly lower than usual

### controller

    protected CrawlController controller

### nextSerialNumber

    protected int nextSerialNumber

### targetSize

    protected int targetSize

### STANDARD_REPORT

    public static java.lang.String STANDARD_REPORT

### COMPACT_REPORT

    public static java.lang.String COMPACT_REPORT

### REPORTS

    protected static java.lang.String[] REPORTS

Constructor Detail

### ToePool

    public ToePool(CrawlController c)

  Constructor. Creates a pool of ToeThreads.

  Parameters:
    `c` - A reference to the CrawlController for the current crawl.

Method Detail

### cleanup

    public void cleanup()

### getActiveToeCount

    public int getActiveToeCount()

  Returns:
    The number of ToeThreads that are not available (Approximation).

### getToeCount

    public int getToeCount()

  Returns:
    The number of ToeThreads. This may include killed ToeThreads that were not replaced.

### setSize

    public void setSize(int newsize)

  Change the number of ToeThreads.

  Parameters:
    `newsize` - The new number of ToeThreads.

### killThread

    public void killThread(int threadNumber,
                           boolean replace)

  Kills specified thread. Killed thread can be optionally replaced with a new thread.

  WARNING: This operation should be used with great care. It may destabilize the crawler.

  Parameters:
    `threadNumber` - Thread to kill
    `replace` - If true then a new thread will be created to take the killed threads place. Otherwise the total number of threads will decrease by one.

### getController

    public CrawlController getController()

  Returns:
    Instance of CrawlController.

### getReports

    public java.lang.String[] getReports()

  Description copied from interface: `Reporter`
  Get an array of report names offered by this Reporter. A name in brackets indicates a free-form String, in accordance with the informal description inside the brackets, may yield a useful report.

  Specified by:
    `getReports` in interface `Reporter`
  Returns:
    String array of report names, empty if there is only one report type

### reportTo

    public void reportTo(java.lang.String name,
                         java.io.PrintWriter writer)

  Description copied from interface: `Reporter`
  Make a report of the given name to the passed-in Writer, If null, give the default report.

  Specified by:
    `reportTo` in interface `Reporter`
    `writer` - to receive report

### standardReportTo

    protected void standardReportTo(java.io.PrintWriter writer)

### compactReportTo

    protected void compactReportTo(java.io.PrintWriter writer)

### singleLineReportTo

    public void singleLineReportTo(java.io.PrintWriter w)

  Description copied from interface: `Reporter`
  Make a single-line summary report to the passed-in writer

  Specified by:
    `singleLineReportTo` in interface `Reporter`
  Parameters:
    `w` - to receive report

### singleLineLegend

    public java.lang.String singleLineLegend()

  Description copied from interface: `Reporter`
  Return a legend for the single-line summary report as a String.

  Specified by:
    `singleLineLegend` in interface `Reporter`
  Returns:
    String single-line summary legend

### singleLineReport

    public java.lang.String singleLineReport()

  Description copied from interface: `Reporter`
  Return a short single-line summary report as a String.

  Specified by:
    `singleLineReport` in interface `Reporter`
  Returns:
    String single-line summary report

### reportTo

    public void reportTo(java.io.PrintWriter writer)

  Description copied from interface: `Reporter`
  Make a default report to the passed-in Writer. Should be equivalent to reportTo(null, writer)

  Specified by:
    `reportTo` in interface `Reporter`
  Parameters:
    `writer` - to receive report

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2008 Internet Archive. All Rights Reserved.