setRepopulateThreshold

void proxyServerPool.setRepopulateThreshold ( int repopulateThreshold )

Description

Set threshold to get more proxy servers.

Parameters

  • repopulateThreshold Lowest number of proxies before more proxies are requested.

Return Values

Returns void.

Change Log

Version Description
4.5 Available for all editions.

Examples

Write Good Proxies to File

 import com.screenscraper.util.*;

 // Create a new ProxyServerPool object.
 proxyServerPool = new ProxyServerPool();

 // Must be set on the session before other calls are made
 session.setProxyServerPool(proxyServerPool);

 // This tells the pool to populate itself from a file
 proxyServerPool.populateFromFile( "proxies.txt" );

 // Validate proxies up to 25 proxies at a time.
 proxyServerPool.setNumProxiesToValidateConcurrently( 25 );

 // Set timout interval
 proxyServerPool.filter( 7 );

 // Write good proxies to file
 proxyServerPool.writeProxyPoolToFile( "good_proxies.txt" );

 // Write Proxy Servers to log
 proxyServerPool.outputProxyServersToLog();

 // As a scraping session runs, screen-scraper will filter out
 // proxies that become non-responsive. If the number of proxies
 // gets down to a specified level, screen-scraper can repopulate
 // itself. Thats what this method call controls.

 proxyServerPool.setRepopulateThreshold( 5 );