1
0
mirror of https://github.com/square/okhttp.git synced 2025-11-26 06:43:09 +03:00

Refactor towards an OkHttpClient.Builder.

Still some work to do on method naming, but this was the interesting part.
Also very much need to rename OkUrlFactory in tests to urlFactory, otherwise
the client.client stuff becomes madness.
This commit is contained in:
jwilson
2015-12-31 02:31:17 -05:00
parent db9c2db40b
commit f2461183e8
63 changed files with 1391 additions and 1069 deletions

View File

@@ -120,9 +120,10 @@ public final class Crawler {
int threadCount = 20;
long cacheByteCount = 1024L * 1024L * 100L;
OkHttpClient client = new OkHttpClient();
Cache cache = new Cache(new File(args[0]), cacheByteCount);
client.setCache(cache);
OkHttpClient client = new OkHttpClient.Builder()
.setCache(cache)
.build();
Crawler crawler = new Crawler(client);
crawler.queue.add(HttpUrl.parse(args[1]));