Hi,

I have an application where I'm trying to read about 30 URLs at a time
from a 5000 URLs' list.

I have implemented 30 threads to retrieve the content.

I'm initialysing the HttpClient that way:

SchemeRegistry schemeRegistry = new SchemeRegistry();
schemeRegistry.register(new Scheme("http", 80,
PlainSocketFactory.getSocketFactory()));
schemeRegistry.register(new Scheme("https", 443,
SSLSocketFactory.getSocketFactory()));
PoolingClientConnectionManager cm = new
PoolingClientConnectionManager(schemeRegistry);
cm.setMaxTotal(200);
cm.setDefaultMaxPerRoute(20);
        
HttpParams params = new BasicHttpParams();
client = new DefaultHttpClient(cm, params);
client.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, new
Integer(45000));
client.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT,
new Integer(45000));
client.getParams().setParameter(CoreConnectionPNames.TCP_NODELAY, false);


However, when I'm running my threads and retrieving the content, I'm
often getting an UnknownHostException on an host I know it exists.

Like, if I have 500 URLs from this host, some of them will be retrieve
correctly and some will throw an UnknownHostException.

I'm wondering where it might be coming from.

Each thread is creating an HTTPGet method and is invoking it using the
client created above (only one instance of the client for the entire
application).

Initialy, I thought this was because of the DNS. But since it's the
same host that is sometime working, that mean it should be on the
cache now.

Should it be better for me to create one client per thread?

Thanks for your comments.

JM

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to