views:

1087

answers:

2

I've looked at http://code.google.com/appengine/docs/java/urlfetch/overview.html but the code does not show a pooling example, i mean if i want to fetch www.example.com/1.html, www.example.com/3.html, www.example.com/3.html, ...., www.example.com/1000.html

I'd have to open 1000 connection and close 1000 connections. I think I could just open 1 connection 'keep-alive', and issue 1000 request and then close it. that should be faster. but i have no idea how to do that using url.openStream()

+1  A: 

Unfortunately, as the docs for Java App Engine say, at this time "The Java API for the URL Fetch service only supports synchronous requests". The Python version of App Engine does support async requests, so, if porting to Python is just unthinkable, you may wait in the reasonable hope that such functionality will eventually be in the Java side too. After all, the Python version has been around for a year more, so of course it's more mature, stable, and function-rich.

Alex Martelli
He's not talking specifically about async requests, but rather about reusing one connection for multiple requests.
Nick Johnson
+3  A: 

The URLFetch service operates at a higher level of abstraction than individual connections, and the native Python and Java libraries that use it are modified to use this service. As such, you have no direct control over connections - but you can expect that the underlying service will keep connections open when it deems it appropriate.

Nick Johnson