getBasicPolicy
RetryPolicy RetryPolicyFactory.getBasicPolicy ( int retries, String scriptOnFail )
RetryPolicy RetryPolicyFactory.getBasicPolicy ( int retries, Runnable runnableOnFail )
RetryPolicy RetryPolicyFactory.getBasicPolicy ( int retries, Runnable runnableOnFail )
Description
Policy that retries if there was an error on the request by status code. Executes the runnable given before retrying.
Parameters
- retries How many times max to retry before failing
- scriptOnFail/runnableOnFail What to run (script or Runnable) if the policy shows an error on the page. This will be run just before the page is downloaded again. The script or Runnable will be executed in the current thread, so the scrapeable file will not be redownloaded until this runnable or script has finished executing.
Return Value
The RetryPolicy to set in the ScrapeableFile
Change Log
Version | Description |
---|---|
5.5.29a | Available in all editions. |
Examples
Set a basic retry policy
import com.screenscraper.util.retry.RetryPolicyFactory;
scrapeableFile.setRetryPolicy(RetryPolicyFactory.getBasicPolicy(5, "Rotate Proxy"));
scrapeableFile.setRetryPolicy(RetryPolicyFactory.getBasicPolicy(5, "Rotate Proxy"));
mikes on 11/21/2011 at 3:45 pm
- Printer-friendly version
- Login or register to post comments