mirror of
https://github.com/square/okhttp.git
synced 2026-01-18 20:40:58 +03:00
Merge pull request #738 from square/jwilson_0420_kill_utility_code
Move unshared code out of Util.
This commit is contained in:
@@ -51,7 +51,7 @@ import java.util.concurrent.TimeUnit;
|
||||
* parameters do so before making HTTP connections, and that this class is
|
||||
* initialized lazily.
|
||||
*/
|
||||
public class ConnectionPool {
|
||||
public final class ConnectionPool {
|
||||
private static final int MAX_CONNECTIONS_TO_CLEANUP = 2;
|
||||
private static final long DEFAULT_KEEP_ALIVE_DURATION_MS = 5 * 60 * 1000; // 5 min
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ import java.net.Proxy;
|
||||
* </ul>
|
||||
* Each route is a specific selection of these options.
|
||||
*/
|
||||
public class Route {
|
||||
public final class Route {
|
||||
final Address address;
|
||||
final Proxy proxy;
|
||||
final InetSocketAddress inetSocketAddress;
|
||||
|
||||
@@ -36,7 +36,6 @@ import java.util.concurrent.ThreadFactory;
|
||||
import okio.Buffer;
|
||||
import okio.ByteString;
|
||||
import okio.Source;
|
||||
import okio.Timeout;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.NANOSECONDS;
|
||||
|
||||
@@ -44,16 +43,6 @@ import static java.util.concurrent.TimeUnit.NANOSECONDS;
|
||||
public final class Util {
|
||||
public static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
|
||||
public static final String[] EMPTY_STRING_ARRAY = new String[0];
|
||||
public static final Source EMPTY_SOURCE = new Source() {
|
||||
@Override public long read(Buffer sink, long byteCount) throws IOException {
|
||||
return -1;
|
||||
}
|
||||
@Override public Timeout timeout() {
|
||||
return Timeout.NONE;
|
||||
}
|
||||
@Override public void close() throws IOException {
|
||||
}
|
||||
};
|
||||
|
||||
/** A cheap and type-safe constant for the US-ASCII Charset. */
|
||||
public static final Charset US_ASCII = Charset.forName("US-ASCII");
|
||||
|
||||
@@ -6,11 +6,10 @@ import com.squareup.okhttp.Protocol;
|
||||
import com.squareup.okhttp.Request;
|
||||
import com.squareup.okhttp.Response;
|
||||
import com.squareup.okhttp.ResponseSource;
|
||||
import com.squareup.okhttp.internal.Util;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.util.Date;
|
||||
import okio.Buffer;
|
||||
import okio.BufferedSource;
|
||||
import okio.Okio;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
|
||||
@@ -31,7 +30,7 @@ public final class CacheStrategy {
|
||||
return 0;
|
||||
}
|
||||
@Override public BufferedSource source() {
|
||||
return Okio.buffer(Util.EMPTY_SOURCE);
|
||||
return new Buffer();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user