Upgraded HttpCore to version 4.4.5

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1770506 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2016-11-19 16:40:54 +00:00
parent db671e6ef0
commit 0514407d8c
305 changed files with 614 additions and 753 deletions

View File

@ -32,10 +32,8 @@ import java.net.URI;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpEntityEnclosingRequest;
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.protocol.HTTP;
@NotThreadSafe
class InternalEntityEnclosingHttpRequest extends InternalHttpRequest implements HttpEntityEnclosingRequest {
private HttpEntity entity;

View File

@ -34,7 +34,6 @@ import java.util.concurrent.atomic.AtomicReference;
import org.apache.http.HttpVersion;
import org.apache.http.ProtocolVersion;
import org.apache.http.RequestLine;
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.Configurable;
import org.apache.http.client.methods.HttpExecutionAware;
@ -44,7 +43,6 @@ import org.apache.http.message.AbstractHttpMessage;
import org.apache.http.message.BasicRequestLine;
import org.apache.http.util.Args;
@NotThreadSafe
class InternalHttpRequest extends AbstractHttpMessage
implements HttpUriRequest, HttpExecutionAware, Configurable {

View File

@ -57,7 +57,8 @@ import org.apache.http.HttpVersion;
import org.apache.http.ProtocolException;
import org.apache.http.ProtocolVersion;
import org.apache.http.RequestLine;
import org.apache.http.annotation.ThreadSafe;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.ResponseHandler;
@ -126,7 +127,7 @@ import org.apache.http.util.VersionInfo;
* @deprecated (4.3) use {@link CachingHttpClientBuilder} or {@link CachingHttpClients}.
*/
@Deprecated
@ThreadSafe // So long as the responseCache implementation is threadsafe
@Contract(threading = ThreadingBehavior.SAFE_CONDITIONAL)
public class CachingHttpClient implements HttpClient {
/**

View File

@ -26,13 +26,10 @@
*/
package org.apache.http.client.cache;
import org.apache.http.annotation.Immutable;
/**
* Records static constants for various HTTP header names.
* @since 4.1
*/
@Immutable
public class HeaderConstants {
public static final String GET_METHOD = "GET";

View File

@ -26,7 +26,6 @@
*/
package org.apache.http.client.cache;
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.HttpContext;
@ -34,7 +33,6 @@ import org.apache.http.protocol.HttpContext;
/**
* @since 4.3
*/
@NotThreadSafe
public class HttpCacheContext extends HttpClientContext {
/**

View File

@ -36,7 +36,8 @@ import org.apache.http.Header;
import org.apache.http.HeaderIterator;
import org.apache.http.ProtocolVersion;
import org.apache.http.StatusLine;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.client.utils.DateUtils;
import org.apache.http.message.HeaderGroup;
import org.apache.http.protocol.HTTP;
@ -51,7 +52,7 @@ import org.apache.http.util.Args;
*
* @since 4.1
*/
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
public class HttpCacheEntry implements Serializable {
private static final long serialVersionUID = -6300496422359477413L;

View File

@ -26,15 +26,12 @@
*/
package org.apache.http.client.cache;
import org.apache.http.annotation.NotThreadSafe;
/**
* Used to limiting the size of an incoming response body of
* unknown size that is optimistically being read in anticipation
* of caching it.
* @since 4.1
*/
@NotThreadSafe // reached
public class InputLimit {
private final long value;

View File

@ -28,7 +28,8 @@ package org.apache.http.impl.client.cache;
import java.io.IOException;
import org.apache.http.annotation.ThreadSafe;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.client.cache.HttpCacheEntry;
import org.apache.http.client.cache.HttpCacheStorage;
import org.apache.http.client.cache.HttpCacheUpdateCallback;
@ -43,7 +44,7 @@ import org.apache.http.client.cache.HttpCacheUpdateCallback;
*
* @since 4.1
*/
@ThreadSafe
@Contract(threading = ThreadingBehavior.SAFE)
public class BasicHttpCacheStorage implements HttpCacheStorage {
private final CacheMap entries;

View File

@ -33,19 +33,17 @@ import java.security.SecureRandom;
import java.util.Formatter;
import java.util.Locale;
import org.apache.http.annotation.GuardedBy;
import org.apache.http.annotation.ThreadSafe;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
/**
* Should produce reasonably unique tokens.
*/
@ThreadSafe
@Contract(threading = ThreadingBehavior.SAFE)
class BasicIdGenerator {
private final String hostname;
private final SecureRandom rnd;
@GuardedBy("this")
private long count;
public BasicIdGenerator() {

View File

@ -33,12 +33,13 @@ import java.io.Serializable;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.client.cache.HttpCacheEntry;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.Args;
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
class CacheEntity implements HttpEntity, Serializable {
private static final long serialVersionUID = -3467082284120936233L;

View File

@ -36,7 +36,8 @@ import java.util.ListIterator;
import org.apache.http.Header;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.client.cache.HeaderConstants;
import org.apache.http.client.cache.HttpCacheEntry;
import org.apache.http.client.cache.Resource;
@ -52,7 +53,7 @@ import org.apache.http.util.Args;
*
* @since 4.1
*/
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
class CacheEntryUpdater {
private final ResourceFactory resourceFactory;

View File

@ -37,7 +37,8 @@ import org.apache.http.Header;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.client.cache.HeaderConstants;
import org.apache.http.client.cache.HttpCacheEntry;
import org.apache.http.client.cache.HttpCacheInvalidator;
@ -51,7 +52,7 @@ import org.apache.http.protocol.HTTP;
*
* @since 4.1
*/
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
class CacheInvalidator implements HttpCacheInvalidator {
private final HttpCacheStorage storage;

View File

@ -40,7 +40,8 @@ import org.apache.http.Header;
import org.apache.http.HeaderElement;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.client.cache.HeaderConstants;
import org.apache.http.client.cache.HttpCacheEntry;
import org.apache.http.client.utils.URIUtils;
@ -48,7 +49,7 @@ import org.apache.http.client.utils.URIUtils;
/**
* @since 4.1
*/
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
class CacheKeyGenerator {
private static final URI BASE_URI = URI.create("http://example.com/");

View File

@ -31,7 +31,8 @@ import java.util.Date;
import org.apache.http.Header;
import org.apache.http.HeaderElement;
import org.apache.http.HttpRequest;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.client.cache.HeaderConstants;
import org.apache.http.client.cache.HttpCacheEntry;
import org.apache.http.client.utils.DateUtils;
@ -40,7 +41,7 @@ import org.apache.http.protocol.HTTP;
/**
* @since 4.1
*/
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
class CacheValidityPolicy {
public static final long MAX_AGE = 2147483648L;

View File

@ -33,7 +33,8 @@ import org.apache.http.HeaderElement;
import org.apache.http.HttpRequest;
import org.apache.http.HttpVersion;
import org.apache.http.ProtocolVersion;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.client.cache.HeaderConstants;
/**
@ -41,7 +42,7 @@ import org.apache.http.client.cache.HeaderConstants;
*
* @since 4.1
*/
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
class CacheableRequestPolicy {
private final Log log = LogFactory.getLog(getClass());

View File

@ -33,7 +33,8 @@ import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.HttpVersion;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.client.cache.HeaderConstants;
import org.apache.http.client.cache.HttpCacheEntry;
import org.apache.http.client.methods.CloseableHttpResponse;
@ -48,7 +49,7 @@ import org.apache.http.protocol.HTTP;
*
* @since 4.1
*/
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
class CachedHttpResponseGenerator {
private final CacheValidityPolicy validityStrategy;

View File

@ -35,7 +35,8 @@ import org.apache.http.HeaderElement;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
import org.apache.http.HttpStatus;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.client.cache.HeaderConstants;
import org.apache.http.client.cache.HttpCacheEntry;
import org.apache.http.client.utils.DateUtils;
@ -46,7 +47,7 @@ import org.apache.http.client.utils.DateUtils;
*
* @since 4.1
*/
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
class CachedResponseSuitabilityChecker {
private final Log log = LogFactory.getLog(getClass());

View File

@ -49,7 +49,8 @@ import org.apache.http.HttpVersion;
import org.apache.http.ProtocolException;
import org.apache.http.ProtocolVersion;
import org.apache.http.RequestLine;
import org.apache.http.annotation.ThreadSafe;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.client.cache.CacheResponseStatus;
import org.apache.http.client.cache.HeaderConstants;
import org.apache.http.client.cache.HttpCacheContext;
@ -99,7 +100,7 @@ import org.apache.http.util.VersionInfo;
*
* @since 4.3
*/
@ThreadSafe // So long as the responseCache implementation is threadsafe
@Contract(threading = ThreadingBehavior.SAFE_CONDITIONAL)
public class CachingExec implements ClientExecChain {
private final static boolean SUPPORTS_RANGE_AND_CONTENT_RANGE_HEADERS = false;

View File

@ -29,7 +29,6 @@ package org.apache.http.impl.client.cache;
import java.io.File;
import org.apache.http.annotation.Immutable;
import org.apache.http.impl.client.CloseableHttpClient;
/**
@ -38,7 +37,6 @@ import org.apache.http.impl.client.CloseableHttpClient;
*
* @since 4.3
*/
@Immutable
public class CachingHttpClients {
private CachingHttpClients() {

View File

@ -32,12 +32,10 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.io.SequenceInputStream;
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.client.cache.Resource;
import org.apache.http.entity.AbstractHttpEntity;
import org.apache.http.util.Args;
@NotThreadSafe
class CombinedEntity extends AbstractHttpEntity {
private final Resource resource;

View File

@ -31,7 +31,8 @@ import java.util.Map;
import org.apache.http.Header;
import org.apache.http.HeaderElement;
import org.apache.http.ProtocolException;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.client.cache.HeaderConstants;
import org.apache.http.client.cache.HttpCacheEntry;
import org.apache.http.client.methods.HttpRequestWrapper;
@ -39,7 +40,7 @@ import org.apache.http.client.methods.HttpRequestWrapper;
/**
* @since 4.1
*/
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
class ConditionalRequestBuilder {
/**

View File

@ -26,19 +26,20 @@
*/
package org.apache.http.impl.client.cache;
import org.apache.http.annotation.ThreadSafe;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
/**
* Implements a bounded failure cache. The oldest entries are discarded when
* the maximum size is exceeded.
*
* @since 4.3
*/
@ThreadSafe
@Contract(threading = ThreadingBehavior.SAFE)
public class DefaultFailureCache implements FailureCache {
static final int DEFAULT_MAX_SIZE = 1000;

View File

@ -32,7 +32,8 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.client.cache.HttpCacheEntry;
import org.apache.http.client.cache.HttpCacheEntrySerializationException;
import org.apache.http.client.cache.HttpCacheEntrySerializer;
@ -45,7 +46,7 @@ import org.apache.http.client.cache.HttpCacheEntrySerializer;
*
* @since 4.1
*/
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
public class DefaultHttpCacheEntrySerializer implements HttpCacheEntrySerializer {
@Override

View File

@ -26,13 +26,14 @@
*/
package org.apache.http.impl.client.cache;
import org.apache.http.annotation.ThreadSafe;
import org.apache.http.util.Args;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.util.Args;
/**
* An implementation that backs off exponentially based on the number of
* consecutive failed attempts stored in the
@ -56,7 +57,7 @@ import java.util.concurrent.TimeUnit;
*
* @since 4.3
*/
@ThreadSafe
@Contract(threading = ThreadingBehavior.SAFE)
public class ExponentialBackOffSchedulingStrategy implements SchedulingStrategy {
public static final long DEFAULT_BACK_OFF_RATE = 10;

View File

@ -26,14 +26,15 @@
*/
package org.apache.http.impl.client.cache;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
/**
* The error count with a creation timestamp and its associated key.
*
* @since 4.3
*/
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
public class FailureCacheValue {
private final long creationTimeInNanos;

View File

@ -31,7 +31,8 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import org.apache.http.annotation.ThreadSafe;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.client.cache.Resource;
/**
@ -39,7 +40,7 @@ import org.apache.http.client.cache.Resource;
*
* @since 4.1
*/
@ThreadSafe
@Contract(threading = ThreadingBehavior.SAFE)
public class FileResource implements Resource {
private static final long serialVersionUID = 4132244415919043397L;

View File

@ -31,7 +31,8 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.client.cache.InputLimit;
import org.apache.http.client.cache.Resource;
import org.apache.http.client.cache.ResourceFactory;
@ -41,7 +42,7 @@ import org.apache.http.client.cache.ResourceFactory;
*
* @since 4.1
*/
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
public class FileResourceFactory implements ResourceFactory {
private final File cacheDir;

View File

@ -29,7 +29,8 @@ package org.apache.http.impl.client.cache;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.client.cache.Resource;
/**
@ -37,7 +38,7 @@ import org.apache.http.client.cache.Resource;
*
* @since 4.1
*/
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
public class HeapResource implements Resource {
private static final long serialVersionUID = -2078599905620463394L;

View File

@ -30,7 +30,8 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.client.cache.InputLimit;
import org.apache.http.client.cache.Resource;
import org.apache.http.client.cache.ResourceFactory;
@ -40,7 +41,7 @@ import org.apache.http.client.cache.ResourceFactory;
*
* @since 4.1
*/
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
public class HeapResourceFactory implements ResourceFactory {
@Override

View File

@ -35,9 +35,7 @@ import java.io.RandomAccessFile;
import java.nio.channels.FileChannel;
import org.apache.http.HttpEntity;
import org.apache.http.annotation.Immutable;
@Immutable
class IOUtils {
static void consume(final HttpEntity entity) throws IOException {

View File

@ -26,21 +26,22 @@
*/
package org.apache.http.impl.client.cache;
import org.apache.http.annotation.ThreadSafe;
import org.apache.http.util.Args;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.util.Args;
/**
* Immediately schedules any incoming validation request. Relies on
* {@link CacheConfig} to configure the used {@link java.util.concurrent.ThreadPoolExecutor}.
*
* @since 4.3
*/
@ThreadSafe
@Contract(threading = ThreadingBehavior.SAFE)
public class ImmediateSchedulingStrategy implements SchedulingStrategy {
private final ExecutorService executor;

View File

@ -33,7 +33,8 @@ import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.http.annotation.ThreadSafe;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.client.cache.HttpCacheEntry;
import org.apache.http.client.cache.HttpCacheStorage;
import org.apache.http.client.cache.HttpCacheUpdateCallback;
@ -70,7 +71,7 @@ import org.apache.http.util.Args;
*
* @since 4.1
*/
@ThreadSafe
@Contract(threading = ThreadingBehavior.SAFE)
public class ManagedHttpCacheStorage implements HttpCacheStorage, Closeable {
private final CacheMap entries;

View File

@ -36,7 +36,8 @@ import org.apache.http.HttpStatus;
import org.apache.http.HttpVersion;
import org.apache.http.ProtocolVersion;
import org.apache.http.StatusLine;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.message.AbstractHttpMessage;
import org.apache.http.message.BasicStatusLine;
import org.apache.http.params.BasicHttpParams;
@ -46,7 +47,7 @@ import org.apache.http.params.HttpParams;
* @since 4.1
*/
@SuppressWarnings("deprecation")
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
final class OptionsHttp11Response extends AbstractHttpMessage implements HttpResponse {
private final StatusLine statusLine = new BasicStatusLine(HttpVersion.HTTP_1_1,

View File

@ -29,7 +29,6 @@ package org.apache.http.impl.client.cache;
import java.lang.reflect.Proxy;
import org.apache.http.HttpResponse;
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.util.Args;
@ -38,7 +37,6 @@ import org.apache.http.util.Args;
*
* @since 4.3
*/
@NotThreadSafe
class Proxies {
public static CloseableHttpResponse enhanceResponse(final HttpResponse original) {

View File

@ -38,7 +38,8 @@ import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.HttpVersion;
import org.apache.http.ProtocolVersion;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.cache.HeaderConstants;
import org.apache.http.client.methods.HttpRequestWrapper;
@ -52,7 +53,7 @@ import org.apache.http.protocol.HTTP;
/**
* @since 4.1
*/
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
class RequestProtocolCompliance {
private final boolean weakETagOnPutDeleteAllowed;

View File

@ -29,12 +29,13 @@ package org.apache.http.impl.client.cache;
import java.lang.ref.PhantomReference;
import java.lang.ref.ReferenceQueue;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.client.cache.HttpCacheEntry;
import org.apache.http.client.cache.Resource;
import org.apache.http.util.Args;
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
class ResourceReference extends PhantomReference<HttpCacheEntry> {
private final Resource resource;

View File

@ -40,7 +40,8 @@ import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.HttpVersion;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.client.cache.HeaderConstants;
import org.apache.http.client.utils.DateUtils;
import org.apache.http.protocol.HTTP;
@ -50,7 +51,7 @@ import org.apache.http.protocol.HTTP;
*
* @since 4.1
*/
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
class ResponseCachingPolicy {
private static final String[] AUTH_CACHEABLE_PARAMS = {

View File

@ -39,7 +39,8 @@ import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.HttpVersion;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.cache.HeaderConstants;
import org.apache.http.client.methods.HttpRequestWrapper;
@ -50,7 +51,7 @@ import org.apache.http.protocol.HTTP;
/**
* @since 4.1
*/
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
class ResponseProtocolCompliance {
private static final String UNEXPECTED_100_CONTINUE = "The incoming request did not contain a "

View File

@ -34,7 +34,6 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.apache.http.HttpResponse;
import org.apache.http.annotation.NotThreadSafe;
/**
* A proxy class that can enhance an arbitrary {@link HttpResponse} with
@ -42,7 +41,6 @@ import org.apache.http.annotation.NotThreadSafe;
*
* @since 4.3
*/
@NotThreadSafe
class ResponseProxyHandler implements InvocationHandler {
private static final Method CLOSE_METHOD;

View File

@ -33,7 +33,6 @@ import java.lang.reflect.Proxy;
import org.apache.http.HttpEntity;
import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.client.cache.InputLimit;
import org.apache.http.client.cache.Resource;
import org.apache.http.client.cache.ResourceFactory;
@ -43,7 +42,6 @@ import org.apache.http.message.BasicHttpResponse;
/**
* @since 4.1
*/
@NotThreadSafe
class SizeLimitedResponseReader {
private final ResourceFactory resourceFactory;

View File

@ -30,7 +30,8 @@ package org.apache.http.impl.auth.win;
import java.io.Serializable;
import java.security.Principal;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.auth.Credentials;
import com.sun.jna.platform.win32.Secur32.EXTENDED_NAME_FORMAT;
@ -44,7 +45,7 @@ import com.sun.jna.platform.win32.Secur32Util;
*
* @since 4.4
*/
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
public final class CurrentWindowsCredentials implements Credentials, Serializable, Principal {
private static final long serialVersionUID = 4361166468529298169L;

View File

@ -26,7 +26,8 @@
*/
package org.apache.http.impl.auth.win;
import org.apache.http.annotation.ThreadSafe;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.Credentials;
import org.apache.http.client.CredentialsProvider;
@ -43,7 +44,7 @@ import org.apache.http.util.Args;
*
* @since 4.4
*/
@ThreadSafe
@Contract(threading = ThreadingBehavior.SAFE)
public class WindowsCredentialsProvider implements CredentialsProvider {
private final CredentialsProvider provider;

View File

@ -27,7 +27,8 @@
package org.apache.http.impl.auth.win;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.auth.AuthScheme;
import org.apache.http.auth.AuthSchemeProvider;
import org.apache.http.client.config.AuthSchemes;
@ -42,7 +43,7 @@ import org.apache.http.protocol.HttpContext;
*
* @since 4.4
*/
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
public class WindowsNTLMSchemeFactory implements AuthSchemeProvider {
private final String servicePrincipalName;

View File

@ -32,7 +32,6 @@ import org.apache.commons.logging.LogFactory;
import org.apache.http.Header;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.auth.AUTH;
import org.apache.http.auth.AuthenticationException;
import org.apache.http.auth.Credentials;
@ -67,7 +66,6 @@ import com.sun.jna.ptr.IntByReference;
*
* @since 4.4
*/
@NotThreadSafe
public class WindowsNegotiateScheme extends AuthSchemeBase {
private final Log log = LogFactory.getLog(getClass());

View File

@ -27,7 +27,8 @@
package org.apache.http.impl.auth.win;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.auth.AuthScheme;
import org.apache.http.auth.AuthSchemeProvider;
import org.apache.http.client.config.AuthSchemes;
@ -42,7 +43,7 @@ import org.apache.http.protocol.HttpContext;
*
* @since 4.4
*/
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
public class WindowsNegotiateSchemeFactory implements AuthSchemeProvider {
private final String servicePrincipalName;

View File

@ -27,7 +27,8 @@
package org.apache.http.auth.params;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.params.HttpParams;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.Args;
@ -42,7 +43,7 @@ import org.apache.http.util.Args;
* and constructor parameters of
* {@link org.apache.http.auth.AuthSchemeProvider}s.
*/
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
@Deprecated
public final class AuthParams {

View File

@ -27,8 +27,6 @@
package org.apache.http.client.params;
import org.apache.http.annotation.Immutable;
/**
* Standard authentication schemes supported by HttpClient.
*
@ -37,7 +35,6 @@ import org.apache.http.annotation.Immutable;
* @deprecated (4.3) use {@link org.apache.http.client.config.AuthSchemes}.
*/
@Deprecated
@Immutable
public final class AuthPolicy {
private AuthPolicy() {

View File

@ -31,7 +31,6 @@ import java.util.Collection;
import org.apache.http.Header;
import org.apache.http.HttpHost;
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.params.HttpAbstractParamBean;
import org.apache.http.params.HttpParams;
@ -45,7 +44,6 @@ import org.apache.http.params.HttpParams;
* @deprecated (4.3) use {@link org.apache.http.client.config.RequestConfig}.
*/
@Deprecated
@NotThreadSafe
public class ClientParamBean extends HttpAbstractParamBean {
public ClientParamBean (final HttpParams params) {

View File

@ -27,8 +27,6 @@
package org.apache.http.client.params;
import org.apache.http.annotation.Immutable;
/**
* Standard cookie specifications supported by HttpClient.
*
@ -37,7 +35,6 @@ import org.apache.http.annotation.Immutable;
* @deprecated (4.3) use {@link org.apache.http.client.config.CookieSpecs}.
*/
@Deprecated
@Immutable
public final class CookiePolicy {
/**

View File

@ -26,7 +26,6 @@
*/
package org.apache.http.client.params;
import org.apache.http.annotation.Immutable;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
import org.apache.http.util.Args;
@ -39,7 +38,6 @@ import org.apache.http.util.Args;
* @deprecated (4.3) use {@link org.apache.http.client.config.RequestConfig}
*/
@Deprecated
@Immutable
public class HttpClientParams {
private HttpClientParams() {

View File

@ -27,7 +27,6 @@
package org.apache.http.client.protocol;
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.auth.AuthSchemeRegistry;
import org.apache.http.client.CookieStore;
import org.apache.http.client.CredentialsProvider;
@ -42,7 +41,6 @@ import org.apache.http.util.Args;
*
* @deprecated (4.3) use {@link HttpClientContext}
*/
@NotThreadSafe
@Deprecated
public class ClientContextConfigurer implements ClientContext {

View File

@ -31,7 +31,8 @@ import java.io.IOException;
import org.apache.http.HttpException;
import org.apache.http.HttpRequest;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.auth.AUTH;
import org.apache.http.auth.AuthState;
import org.apache.http.conn.HttpRoutedConnection;
@ -49,7 +50,7 @@ import org.apache.http.util.Args;
* @deprecated (4.3) use {@link org.apache.http.impl.auth.HttpAuthenticator}.
*/
@Deprecated
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
public class RequestProxyAuthentication extends RequestAuthenticationBase {
public RequestProxyAuthentication() {

View File

@ -31,7 +31,8 @@ import java.io.IOException;
import org.apache.http.HttpException;
import org.apache.http.HttpRequest;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.auth.AUTH;
import org.apache.http.auth.AuthState;
import org.apache.http.protocol.HttpContext;
@ -46,7 +47,7 @@ import org.apache.http.util.Args;
* @deprecated (4.3) use {@link org.apache.http.impl.auth.HttpAuthenticator}.
*/
@Deprecated
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
public class RequestTargetAuthentication extends RequestAuthenticationBase {
public RequestTargetAuthentication() {

View File

@ -35,7 +35,8 @@ import org.apache.http.HttpException;
import org.apache.http.HttpHost;
import org.apache.http.HttpResponse;
import org.apache.http.HttpResponseInterceptor;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.auth.AuthScheme;
import org.apache.http.auth.AuthState;
import org.apache.http.client.AuthCache;
@ -57,7 +58,7 @@ import org.apache.http.util.Args;
*
* @deprecated (4.2) use {@link org.apache.http.client.AuthenticationStrategy}
*/
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
@Deprecated
public class ResponseAuthCache implements HttpResponseInterceptor {

View File

@ -29,7 +29,8 @@ package org.apache.http.client.utils;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
/**
* Uses the java.net.IDN class through reflection.
@ -38,7 +39,7 @@ import org.apache.http.annotation.Immutable;
*
* @since 4.0
*/
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
@Deprecated
public class JdkIdn implements Idn {
private final Method toUnicode;

View File

@ -26,7 +26,8 @@
*/
package org.apache.http.client.utils;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
/**
* Facade that provides conversion between Unicode and Punycode domain names.
@ -36,7 +37,7 @@ import org.apache.http.annotation.Immutable;
*
* @since 4.0
*/
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
@Deprecated
public class Punycode {
private static final Idn impl;

View File

@ -28,7 +28,8 @@ package org.apache.http.client.utils;
import java.util.StringTokenizer;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
/**
* Implementation from pseudo code in RFC 3492.
@ -37,7 +38,7 @@ import org.apache.http.annotation.Immutable;
*
* @since 4.0
*/
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
@Deprecated
public class Rfc3492Idn implements Idn {
private static final int base = 36;

View File

@ -29,7 +29,6 @@ package org.apache.http.conn;
import java.io.IOException;
import java.io.InputStream;
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.util.Args;
/**
@ -41,7 +40,6 @@ import org.apache.http.util.Args;
* @deprecated (4.3) do not use.
*/
@Deprecated
@NotThreadSafe
public class BasicEofSensorWatcher implements EofSensorWatcher {
/** The connection to auto-release. */

View File

@ -32,7 +32,6 @@ import java.io.OutputStream;
import java.net.SocketException;
import org.apache.http.HttpEntity;
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.entity.HttpEntityWrapper;
import org.apache.http.util.Args;
import org.apache.http.util.EntityUtils;
@ -48,7 +47,6 @@ import org.apache.http.util.EntityUtils;
* @deprecated (4.3) do not use.
*/
@Deprecated
@NotThreadSafe
public class BasicManagedEntity extends HttpEntityWrapper
implements ConnectionReleaseTrigger, EofSensorWatcher {

View File

@ -37,7 +37,8 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.conn.scheme.SocketFactory;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
@ -57,7 +58,7 @@ import org.apache.http.util.Asserts;
* {@link org.apache.http.conn.scheme.SchemeSocketFactory} interface.
*/
@Deprecated
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
public final class MultihomePlainSocketFactory implements SocketFactory {
/**

View File

@ -27,7 +27,6 @@
package org.apache.http.conn.params;
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.params.HttpAbstractParamBean;
import org.apache.http.params.HttpParams;
@ -40,7 +39,6 @@ import org.apache.http.params.HttpParams;
*
* @deprecated (4.1) use configuration methods of the specific connection manager implementation.
*/
@NotThreadSafe
@Deprecated
public class ConnManagerParamBean extends HttpAbstractParamBean {

View File

@ -26,7 +26,8 @@
*/
package org.apache.http.conn.params;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.conn.routing.HttpRoute;
import org.apache.http.params.HttpParams;
import org.apache.http.util.Args;
@ -42,7 +43,7 @@ import org.apache.http.util.Args;
* @deprecated (4.1) use configuration methods of the specific connection manager implementation.
*/
@Deprecated
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
public final class ConnManagerParams implements ConnManagerPNames {
/** The default maximum number of connections allowed overall */

View File

@ -29,7 +29,8 @@ package org.apache.http.conn.params;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.http.annotation.ThreadSafe;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.conn.routing.HttpRoute;
import org.apache.http.util.Args;
@ -44,7 +45,7 @@ import org.apache.http.util.Args;
* @deprecated (4.2) use {@link org.apache.http.pool.ConnPoolControl}
*/
@Deprecated
@ThreadSafe
@Contract(threading = ThreadingBehavior.SAFE)
public final class ConnPerRouteBean implements ConnPerRoute {
/** The default maximum number of connections allowed per host */

View File

@ -30,7 +30,6 @@ package org.apache.http.conn.params;
import java.net.InetAddress;
import org.apache.http.HttpHost;
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.conn.routing.HttpRoute;
import org.apache.http.params.HttpAbstractParamBean;
import org.apache.http.params.HttpParams;
@ -45,7 +44,6 @@ import org.apache.http.params.HttpParams;
* @deprecated (4.3) use {@link org.apache.http.client.config.RequestConfig}.
*/
@Deprecated
@NotThreadSafe
public class ConnRouteParamBean extends HttpAbstractParamBean {
public ConnRouteParamBean (final HttpParams params) {

View File

@ -29,7 +29,8 @@ package org.apache.http.conn.params;
import java.net.InetAddress;
import org.apache.http.HttpHost;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.conn.routing.HttpRoute;
import org.apache.http.params.HttpParams;
import org.apache.http.util.Args;
@ -43,7 +44,7 @@ import org.apache.http.util.Args;
* @deprecated (4.3) use {@link org.apache.http.client.config.RequestConfig}.
*/
@Deprecated
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
public class ConnRouteParams implements ConnRoutePNames {
/**

View File

@ -34,7 +34,8 @@ import java.net.Socket;
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.conn.ConnectTimeoutException;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
@ -47,7 +48,7 @@ import org.apache.http.util.Args;
*
* @deprecated (4.3) use {@link org.apache.http.conn.socket.PlainConnectionSocketFactory}
*/
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
@Deprecated
public class PlainSocketFactory implements SocketFactory, SchemeSocketFactory {

View File

@ -51,8 +51,6 @@ import javax.net.ssl.TrustManagerFactory;
import javax.net.ssl.X509KeyManager;
import javax.net.ssl.X509TrustManager;
import org.apache.http.annotation.NotThreadSafe;
/**
* Builder for {@link SSLContext} instances.
*
@ -60,7 +58,6 @@ import org.apache.http.annotation.NotThreadSafe;
*
* @deprecated (4.4) use {@link org.apache.http.ssl.SSLContextBuilder}.
*/
@NotThreadSafe
@Deprecated
public class SSLContextBuilder {

View File

@ -32,7 +32,8 @@ import java.security.NoSuchAlgorithmException;
import javax.net.ssl.SSLContext;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
/**
* {@link SSLContext} factory methods.
@ -41,7 +42,7 @@ import org.apache.http.annotation.Immutable;
*
* @deprecated (4.4) use {@link org.apache.http.ssl.SSLContexts}.
*/
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
@Deprecated
public class SSLContexts {

View File

@ -44,7 +44,8 @@ import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocket;
import org.apache.http.HttpHost;
import org.apache.http.annotation.ThreadSafe;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.conn.ConnectTimeoutException;
import org.apache.http.conn.HttpInetSocketAddress;
import org.apache.http.conn.scheme.HostNameResolver;
@ -140,7 +141,7 @@ import org.apache.http.util.TextUtils;
*
* @deprecated (4.3) use {@link SSLConnectionSocketFactory}.
*/
@ThreadSafe
@Contract(threading = ThreadingBehavior.SAFE_CONDITIONAL)
@Deprecated
public class SSLSocketFactory implements LayeredConnectionSocketFactory, SchemeLayeredSocketFactory,
LayeredSchemeSocketFactory, LayeredSocketFactory {

View File

@ -29,7 +29,6 @@ package org.apache.http.cookie.params;
import java.util.Collection;
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.params.HttpAbstractParamBean;
import org.apache.http.params.HttpParams;
@ -44,7 +43,6 @@ import org.apache.http.params.HttpParams;
* org.apache.http.cookie.CookieSpecProvider}s.
*/
@Deprecated
@NotThreadSafe
public class CookieSpecParamBean extends HttpAbstractParamBean {
public CookieSpecParamBean (final HttpParams params) {

View File

@ -40,7 +40,8 @@ import org.apache.commons.logging.LogFactory;
import org.apache.http.FormattedHeader;
import org.apache.http.Header;
import org.apache.http.HttpResponse;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.auth.AuthScheme;
import org.apache.http.auth.AuthSchemeRegistry;
import org.apache.http.auth.AuthenticationException;
@ -61,7 +62,7 @@ import org.apache.http.util.CharArrayBuffer;
* @deprecated (4.2) use {@link org.apache.http.client.AuthenticationStrategy}
*/
@Deprecated
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
public abstract class AbstractAuthenticationHandler implements AuthenticationHandler {
private final Log log = LogFactory.getLog(getClass());

View File

@ -38,8 +38,8 @@ import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
import org.apache.http.HttpRequestInterceptor;
import org.apache.http.HttpResponseInterceptor;
import org.apache.http.annotation.GuardedBy;
import org.apache.http.annotation.ThreadSafe;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.auth.AuthSchemeRegistry;
import org.apache.http.client.AuthenticationHandler;
import org.apache.http.client.AuthenticationStrategy;
@ -194,85 +194,30 @@ import org.apache.http.util.Args;
*
* @deprecated (4.3) use {@link HttpClientBuilder}.
*/
@ThreadSafe
@Contract(threading = ThreadingBehavior.SAFE_CONDITIONAL)
@Deprecated
public abstract class AbstractHttpClient extends CloseableHttpClient {
private final Log log = LogFactory.getLog(getClass());
/** The parameters. */
@GuardedBy("this")
private HttpParams defaultParams;
/** The request executor. */
@GuardedBy("this")
private HttpRequestExecutor requestExec;
/** The connection manager. */
@GuardedBy("this")
private ClientConnectionManager connManager;
/** The connection re-use strategy. */
@GuardedBy("this")
private ConnectionReuseStrategy reuseStrategy;
/** The connection keep-alive strategy. */
@GuardedBy("this")
private ConnectionKeepAliveStrategy keepAliveStrategy;
/** The cookie spec registry. */
@GuardedBy("this")
private CookieSpecRegistry supportedCookieSpecs;
/** The authentication scheme registry. */
@GuardedBy("this")
private AuthSchemeRegistry supportedAuthSchemes;
/** The HTTP protocol processor and its immutable copy. */
@GuardedBy("this")
private BasicHttpProcessor mutableProcessor;
@GuardedBy("this")
private ImmutableHttpProcessor protocolProcessor;
/** The request retry handler. */
@GuardedBy("this")
private HttpRequestRetryHandler retryHandler;
/** The redirect handler. */
@GuardedBy("this")
private RedirectStrategy redirectStrategy;
/** The target authentication handler. */
@GuardedBy("this")
private AuthenticationStrategy targetAuthStrategy;
/** The proxy authentication handler. */
@GuardedBy("this")
private AuthenticationStrategy proxyAuthStrategy;
/** The cookie store. */
@GuardedBy("this")
private CookieStore cookieStore;
/** The credentials provider. */
@GuardedBy("this")
private CredentialsProvider credsProvider;
/** The route planner. */
@GuardedBy("this")
private HttpRoutePlanner routePlanner;
/** The user token handler. */
@GuardedBy("this")
private UserTokenHandler userTokenHandler;
/** The connection backoff strategy. */
@GuardedBy("this")
private ConnectionBackoffStrategy connectionBackoffStrategy;
/** The backoff manager. */
@GuardedBy("this")
private BackoffManager backoffManager;
/**

View File

@ -37,7 +37,8 @@ import org.apache.commons.logging.LogFactory;
import org.apache.http.Header;
import org.apache.http.HttpHost;
import org.apache.http.HttpResponse;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.auth.AuthOption;
import org.apache.http.auth.AuthScheme;
import org.apache.http.auth.AuthScope;
@ -56,7 +57,7 @@ import org.apache.http.util.Args;
/**
* @deprecated (4.2) do not use
*/
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
@Deprecated
class AuthenticationStrategyAdaptor implements AuthenticationStrategy {

View File

@ -36,7 +36,8 @@ import org.apache.commons.logging.LogFactory;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
import org.apache.http.annotation.ThreadSafe;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.client.HttpClient;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.ServiceUnavailableRetryStrategy;
@ -56,7 +57,7 @@ import org.apache.http.util.EntityUtils;
* @deprecated (4.3) use {@link HttpClientBuilder}.
*/
@Deprecated
@ThreadSafe
@Contract(threading = ThreadingBehavior.SAFE_CONDITIONAL)
public class AutoRetryHttpClient implements HttpClient {
private final HttpClient backend;

View File

@ -27,7 +27,6 @@
package org.apache.http.impl.client;
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.params.AbstractHttpParams;
import org.apache.http.params.HttpParams;
import org.apache.http.util.Args;
@ -69,7 +68,6 @@ import org.apache.http.util.Args;
* @deprecated (4.3) use configuration classes provided 'org.apache.http.config'
* and 'org.apache.http.client.config'
*/
@NotThreadSafe
@Deprecated
public class ClientParamsStack extends AbstractHttpParams {

View File

@ -36,7 +36,6 @@ import java.lang.reflect.Proxy;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.util.EntityUtils;
@ -44,7 +43,6 @@ import org.apache.http.util.EntityUtils;
* @since 4.3
*/
@Deprecated
@NotThreadSafe
class CloseableHttpResponseProxy implements InvocationHandler {
private final static Constructor<?> CONSTRUCTOR;

View File

@ -26,7 +26,8 @@
*/
package org.apache.http.impl.client;
import org.apache.http.annotation.ThreadSafe;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.client.protocol.RequestAcceptEncoding;
import org.apache.http.client.protocol.ResponseContentEncoding;
import org.apache.http.conn.ClientConnectionManager;
@ -50,7 +51,7 @@ import org.apache.http.protocol.BasicHttpProcessor;
* @deprecated (4.2) use {@link HttpClientBuilder}
*/
@Deprecated
@ThreadSafe // since DefaultHttpClient is
@Contract(threading = ThreadingBehavior.SAFE_CONDITIONAL) // since DefaultHttpClient is
public class ContentEncodingHttpClient extends DefaultHttpClient {
/**

View File

@ -28,7 +28,8 @@
package org.apache.http.impl.client;
import org.apache.http.HttpVersion;
import org.apache.http.annotation.ThreadSafe;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.client.protocol.RequestAddCookies;
import org.apache.http.client.protocol.RequestAuthCache;
import org.apache.http.client.protocol.RequestClientConnControl;
@ -112,7 +113,7 @@ import org.apache.http.util.VersionInfo;
*
* @deprecated (4.3) use {@link HttpClientBuilder} see also {@link CloseableHttpClient}.
*/
@ThreadSafe
@Contract(threading = ThreadingBehavior.SAFE_CONDITIONAL)
@Deprecated
public class DefaultHttpClient extends AbstractHttpClient {

View File

@ -33,7 +33,8 @@ import java.util.Map;
import org.apache.http.Header;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.auth.AUTH;
import org.apache.http.auth.MalformedChallengeException;
import org.apache.http.auth.params.AuthPNames;
@ -49,7 +50,7 @@ import org.apache.http.util.Args;
* @deprecated (4.2) use {@link ProxyAuthenticationStrategy}
*/
@Deprecated
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
public class DefaultProxyAuthenticationHandler extends AbstractAuthenticationHandler {
public DefaultProxyAuthenticationHandler() {

View File

@ -38,7 +38,8 @@ import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.ProtocolException;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.client.CircularRedirectException;
import org.apache.http.client.RedirectHandler;
import org.apache.http.client.methods.HttpGet;
@ -58,7 +59,7 @@ import org.apache.http.util.Asserts;
*
* @deprecated (4.1) use {@link DefaultRedirectStrategy}.
*/
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
@Deprecated
public class DefaultRedirectHandler implements RedirectHandler {

View File

@ -32,7 +32,8 @@ import java.net.URI;
import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
import org.apache.http.ProtocolException;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.client.RedirectHandler;
import org.apache.http.client.RedirectStrategy;
import org.apache.http.client.methods.HttpGet;
@ -43,7 +44,7 @@ import org.apache.http.protocol.HttpContext;
/**
* @deprecated (4.1) do not use
*/
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
@Deprecated
class DefaultRedirectStrategyAdaptor implements RedirectStrategy {

View File

@ -45,7 +45,6 @@ import org.apache.http.HttpResponse;
import org.apache.http.NoHttpResponseException;
import org.apache.http.ProtocolException;
import org.apache.http.ProtocolVersion;
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.auth.AuthProtocolState;
import org.apache.http.auth.AuthScheme;
import org.apache.http.auth.AuthState;
@ -132,7 +131,6 @@ import org.apache.http.util.EntityUtils;
* @deprecated (4.3)
*/
@Deprecated
@NotThreadSafe // e.g. managedConn
public class DefaultRequestDirector implements RequestDirector {
private final Log log;

View File

@ -33,7 +33,8 @@ import java.util.Map;
import org.apache.http.Header;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.auth.AUTH;
import org.apache.http.auth.MalformedChallengeException;
import org.apache.http.auth.params.AuthPNames;
@ -49,7 +50,7 @@ import org.apache.http.util.Args;
* @deprecated (4.2) use {@link TargetAuthenticationStrategy}
*/
@Deprecated
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
public class DefaultTargetAuthenticationHandler extends AbstractAuthenticationHandler {
public DefaultTargetAuthenticationHandler() {

View File

@ -27,7 +27,6 @@
package org.apache.http.impl.client;
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.conn.routing.HttpRoute;
/**
@ -38,11 +37,10 @@ import org.apache.http.conn.routing.HttpRoute;
* @deprecated (4.3) do not use.
*/
@Deprecated
@NotThreadSafe // RequestWrapper is @NotThreadSafe
public class RoutedRequest {
protected final RequestWrapper request; // @NotThreadSafe
protected final HttpRoute route; // @Immutable
protected final HttpRoute route; // @Contract(threading = ThreadingBehavior.IMMUTABLE)
/**
* Creates a new routed request.

View File

@ -30,7 +30,8 @@ package org.apache.http.impl.client;
import java.net.ProxySelector;
import org.apache.http.ConnectionReuseStrategy;
import org.apache.http.annotation.ThreadSafe;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.routing.HttpRoutePlanner;
import org.apache.http.impl.DefaultConnectionReuseStrategy;
@ -104,7 +105,7 @@ import org.apache.http.params.HttpParams;
*
* @deprecated (4.3) use {@link HttpClientBuilder}
*/
@ThreadSafe
@Contract(threading = ThreadingBehavior.SAFE_CONDITIONAL)
@Deprecated
public class SystemDefaultHttpClient extends DefaultHttpClient {

View File

@ -29,7 +29,6 @@ package org.apache.http.impl.client;
import org.apache.http.HttpException;
import org.apache.http.HttpResponse;
import org.apache.http.annotation.Immutable;
/**
* Signals that the tunnel request was rejected by the proxy host.
@ -39,7 +38,6 @@ import org.apache.http.annotation.Immutable;
* @deprecated (4.3) reserved for internal use.
*/
@Deprecated
@Immutable
public class TunnelRefusedException extends HttpException {
private static final long serialVersionUID = -8646722842745617323L;

View File

@ -40,7 +40,6 @@ import org.apache.http.HttpEntityEnclosingRequest;
import org.apache.http.HttpException;
import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.ManagedClientConnection;
import org.apache.http.conn.OperatedClientConnection;
@ -70,7 +69,6 @@ import org.apache.http.protocol.HttpContext;
* @deprecated (4.2) do not use
*/
@Deprecated
@NotThreadSafe
public abstract class AbstractClientConnAdapter implements ManagedClientConnection, HttpContext {
/**

View File

@ -34,8 +34,8 @@ import java.util.concurrent.atomic.AtomicLong;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.http.HttpClientConnection;
import org.apache.http.annotation.GuardedBy;
import org.apache.http.annotation.ThreadSafe;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.ClientConnectionOperator;
import org.apache.http.conn.ClientConnectionRequest;
@ -66,7 +66,7 @@ import org.apache.http.util.Asserts;
*
* @deprecated (4.3) use {@link BasicHttpClientConnectionManager}.
*/
@ThreadSafe
@Contract(threading = ThreadingBehavior.SAFE)
@Deprecated
public class BasicClientConnectionManager implements ClientConnectionManager {
@ -86,15 +86,12 @@ public class BasicClientConnectionManager implements ClientConnectionManager {
private final ClientConnectionOperator connOperator;
/** The one and only entry in this pool. */
@GuardedBy("this")
private HttpPoolEntry poolEntry;
/** The currently issued managed connection, if any. */
@GuardedBy("this")
private ManagedClientConnectionImpl conn;
/** Indicates whether this connection manager is shut down. */
@GuardedBy("this")
private volatile boolean shutdown;
/**

View File

@ -44,9 +44,8 @@ import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
import org.apache.http.HttpResponseFactory;
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.conn.OperatedClientConnection;
import org.apache.http.conn.ManagedHttpClientConnection;
import org.apache.http.conn.OperatedClientConnection;
import org.apache.http.impl.SocketHttpClientConnection;
import org.apache.http.io.HttpMessageParser;
import org.apache.http.io.SessionInputBuffer;
@ -64,7 +63,6 @@ import org.apache.http.util.Args;
*
* @deprecated (4.3) use {@link ManagedHttpClientConnectionFactory}.
*/
@NotThreadSafe // connSecure, targetHost
@Deprecated
public class DefaultClientConnection extends SocketHttpClientConnection
implements OperatedClientConnection, ManagedHttpClientConnection, HttpContext {

View File

@ -37,7 +37,8 @@ import java.net.UnknownHostException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.http.HttpHost;
import org.apache.http.annotation.ThreadSafe;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.client.protocol.ClientContext;
import org.apache.http.conn.ClientConnectionOperator;
import org.apache.http.conn.ConnectTimeoutException;
@ -86,13 +87,13 @@ import org.apache.http.util.Asserts;
* @deprecated (4.3) use {@link PoolingHttpClientConnectionManager}.
*/
@Deprecated
@ThreadSafe
@Contract(threading = ThreadingBehavior.SAFE_CONDITIONAL)
public class DefaultClientConnectionOperator implements ClientConnectionOperator {
private final Log log = LogFactory.getLog(getClass());
/** The scheme registry for looking up socket factories. */
protected final SchemeRegistry schemeRegistry; // @ThreadSafe
protected final SchemeRegistry schemeRegistry; // @Contract(threading = ThreadingBehavior.SAFE)
/** the custom-configured DNS lookup mechanism. */
protected final DnsResolver dnsResolver;

View File

@ -33,7 +33,8 @@ import java.net.InetAddress;
import org.apache.http.HttpException;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
import org.apache.http.annotation.ThreadSafe;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.conn.params.ConnRouteParams;
import org.apache.http.conn.routing.HttpRoute;
import org.apache.http.conn.routing.HttpRoutePlanner;
@ -61,12 +62,12 @@ import org.apache.http.util.Asserts;
*
* @deprecated (4.3) use {@link DefaultRoutePlanner}
*/
@ThreadSafe
@Contract(threading = ThreadingBehavior.SAFE)
@Deprecated
public class DefaultHttpRoutePlanner implements HttpRoutePlanner {
/** The scheme registry. */
protected final SchemeRegistry schemeRegistry; // class is @ThreadSafe
protected final SchemeRegistry schemeRegistry; // class is @Contract(threading = ThreadingBehavior.SAFE)
/**
* Creates a new default route planner.

View File

@ -37,7 +37,8 @@ import org.apache.http.HttpResponseFactory;
import org.apache.http.NoHttpResponseException;
import org.apache.http.ProtocolException;
import org.apache.http.StatusLine;
import org.apache.http.annotation.ThreadSafe;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.impl.io.AbstractMessageParser;
import org.apache.http.io.SessionInputBuffer;
import org.apache.http.message.LineParser;
@ -62,7 +63,7 @@ import org.apache.http.util.CharArrayBuffer;
* @deprecated (4.2) use {@link DefaultHttpResponseParser}
*/
@Deprecated
@ThreadSafe // no public methods
@Contract(threading = ThreadingBehavior.SAFE_CONDITIONAL)
public class DefaultResponseParser extends AbstractMessageParser<HttpMessage> {
private final Log log = LogFactory.getLog(getClass());

View File

@ -29,7 +29,8 @@ package org.apache.http.impl.conn;
import java.io.IOException;
import org.apache.http.Consts;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.io.EofSensor;
import org.apache.http.io.HttpTransportMetrics;
import org.apache.http.io.SessionInputBuffer;
@ -42,7 +43,7 @@ import org.apache.http.util.CharArrayBuffer;
*
* @deprecated (4.3) no longer used.
*/
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
@Deprecated
public class LoggingSessionInputBuffer implements SessionInputBuffer, EofSensor {

View File

@ -29,7 +29,8 @@ package org.apache.http.impl.conn;
import java.io.IOException;
import org.apache.http.Consts;
import org.apache.http.annotation.Immutable;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.io.HttpTransportMetrics;
import org.apache.http.io.SessionOutputBuffer;
import org.apache.http.util.CharArrayBuffer;
@ -39,7 +40,7 @@ import org.apache.http.util.CharArrayBuffer;
* @since 4.0
* @deprecated (4.3) no longer used.
*/
@Immutable
@Contract(threading = ThreadingBehavior.IMMUTABLE)
@Deprecated
public class LoggingSessionOutputBuffer implements SessionOutputBuffer {

View File

@ -41,7 +41,6 @@ import org.apache.http.HttpException;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.ClientConnectionOperator;
import org.apache.http.conn.ManagedClientConnection;
@ -59,7 +58,6 @@ import org.apache.http.util.Asserts;
* @deprecated (4.3) use {@link ManagedHttpClientConnectionFactory}.
*/
@Deprecated
@NotThreadSafe
class ManagedClientConnectionImpl implements ManagedClientConnection {
private final ClientConnectionManager manager;

View File

@ -34,7 +34,8 @@ import java.util.concurrent.TimeoutException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.http.annotation.ThreadSafe;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.ClientConnectionOperator;
import org.apache.http.conn.ClientConnectionRequest;
@ -69,7 +70,7 @@ import org.apache.http.util.Asserts;
* @deprecated (4.3) use {@link PoolingHttpClientConnectionManager}.
*/
@Deprecated
@ThreadSafe
@Contract(threading = ThreadingBehavior.SAFE_CONDITIONAL)
public class PoolingClientConnectionManager implements ClientConnectionManager, ConnPoolControl<HttpRoute> {
private final Log log = LogFactory.getLog(getClass());

View File

@ -39,7 +39,6 @@ import java.util.List;
import org.apache.http.HttpException;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.conn.params.ConnRouteParams;
import org.apache.http.conn.routing.HttpRoute;
import org.apache.http.conn.routing.HttpRoutePlanner;
@ -71,12 +70,11 @@ import org.apache.http.util.Asserts;
*
* @deprecated (4.3) use {@link SystemDefaultRoutePlanner}
*/
@NotThreadSafe // e.g [gs]etProxySelector()
@Deprecated
public class ProxySelectorRoutePlanner implements HttpRoutePlanner {
/** The scheme registry. */
protected final SchemeRegistry schemeRegistry; // @ThreadSafe
protected final SchemeRegistry schemeRegistry; // @Contract(threading = ThreadingBehavior.SAFE)
/** The proxy selector to use, or {@code null} for system default. */
protected ProxySelector proxySelector;

View File

@ -26,7 +26,8 @@
*/
package org.apache.http.impl.conn;
import org.apache.http.annotation.ThreadSafe;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.conn.scheme.PlainSocketFactory;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
@ -37,7 +38,7 @@ import org.apache.http.conn.ssl.SSLSocketFactory;
*
* @deprecated (4.3) use {@link org.apache.http.impl.client.HttpClientBuilder}.
*/
@ThreadSafe
@Contract(threading = ThreadingBehavior.SAFE)
@Deprecated
public final class SchemeRegistryFactory {

View File

@ -32,8 +32,8 @@ import java.util.concurrent.TimeUnit;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.http.annotation.GuardedBy;
import org.apache.http.annotation.ThreadSafe;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.ClientConnectionOperator;
import org.apache.http.conn.ClientConnectionRequest;
@ -61,7 +61,7 @@ import org.apache.http.util.Asserts;
*
* @deprecated (4.2) use {@link BasicClientConnectionManager}
*/
@ThreadSafe
@Contract(threading = ThreadingBehavior.SAFE)
@Deprecated
public class SingleClientConnManager implements ClientConnectionManager {
@ -82,19 +82,15 @@ public class SingleClientConnManager implements ClientConnectionManager {
protected final boolean alwaysShutDown;
/** The one and only entry in this pool. */
@GuardedBy("this")
protected volatile PoolEntry uniquePoolEntry;
/** The currently issued managed connection, if any. */
@GuardedBy("this")
protected volatile ConnAdapter managedConn;
/** The time of the last connection release, or -1. */
@GuardedBy("this")
protected volatile long lastReleaseTime;
/** The time the last released connection expires and shouldn't be reused. */
@GuardedBy("this")
protected volatile long connectionExpiresTime;
/** Indicates whether this connection manager is shut down. */

View File

@ -38,7 +38,6 @@ import java.util.concurrent.locks.ReentrantLock;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.http.annotation.GuardedBy;
import org.apache.http.conn.ConnectionPoolTimeoutException;
import org.apache.http.conn.OperatedClientConnection;
import org.apache.http.conn.routing.HttpRoute;
@ -66,12 +65,8 @@ public abstract class AbstractConnPool {
*/
protected final Lock poolLock;
/** References to issued connections */
@GuardedBy("poolLock")
protected Set<BasicPoolEntry> leasedConnections;
/** The current total number of connections. */
@GuardedBy("poolLock")
protected int numConnections;
/** Indicates whether this pool is shut down. */

Some files were not shown because too many files have changed in this diff Show More