1
0
mirror of https://github.com/square/okhttp.git synced 2026-01-21 03:41:07 +03:00

Merge pull request #634 from rtyley/okhttpclient-is-threadsafe

Document that OkHttpClient is thread-safe
This commit is contained in:
Jesse Wilson
2014-03-11 18:44:58 -04:00

View File

@@ -40,7 +40,17 @@ import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import okio.ByteString;
/** Configures and creates HTTP connections. */
/**
* Configures and creates HTTP connections. Most applications can use a single
* OkHttpClient for all of their HTTP requests - benefiting from a shared
* response cache, thread pool, connection re-use, etc.
*
* Instances of OkHttpClient are intended to be fully configured before they're
* shared - once shared they should be treated as immutable and can safely be used
* to concurrently open new connections. If required, threads can call
* {@link #clone()} to make a shallow copy of the OkHttpClient that can be
* safely modified with further configuration changes.
*/
public final class OkHttpClient implements URLStreamHandlerFactory, Cloneable {
private final RouteDatabase routeDatabase;