Java Reference
In-Depth Information
* parameter specifies the class that the spider is to
* report progress to.
*
* @param report
* A class that implements the SpiderReportable
* interface, that will receive information that
* the spider finds.
* @param timeout
* How many miliseconds to wait for data.
* @throws ClassNotFoundException
* Thrown if an error occurs while creating the
* workload manager.
* @throws IllegalAccessException
* Thrown if an error occurs while creating the
* workload manager.
* @throws InstantiationException
* Thrown if an error occurs while creating the
* workload manager.
* @throws WorkloadException
* Exception thrown if there are any issues with
* the workload.
*/
public Spider(SpiderOptions options, SpiderReportable report)
throws InstantiationException, IllegalAccessException,
ClassNotFoundException, WorkloadException
{
this.options = options;
this.report = report;
this.workloadManager = (WorkloadManager) Class.forName(
options.workloadManager).newInstance();
this.workloadManager.init(this);
report.init(this);
this.tasks = new SynchronousQueue<Runnable>();
this.threadPool = new ThreadPoolExecutor(
options.corePoolSize,
options.maximumPoolSize,
options.keepAliveTime,
TimeUnit.SECONDS,
this.tasks);
this.threadPool.setRejectedExecutionHandler(
new ThreadPoolExecutor.CallerRunsPolicy());
// add filters
if (options.filter != null)
Search WWH ::




Custom Search