getNumProxyServers
int proxyServerPool.getNumProxyServers ( int numProxyServers )
Description
Retrieve the number of available proxy servers.
Parameters
This method does not receive any parameters.
Return Values
Returns the number of available proxy servers, as an integer.
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 );
// Check number of available proxies
if (proxyServerPool.getNumProxyServers() < 4) {
{
// Repopulate available proxies
proxyServerPool.setRepopulateThreshold( 5 );
}
// 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 );
// Check number of available proxies
if (proxyServerPool.getNumProxyServers() < 4) {
{
// Repopulate available proxies
proxyServerPool.setRepopulateThreshold( 5 );
}
swilsonmc on 10/04/2011 at 11:22 am
- Printer-friendly version
- Login or register to post comments