Add thread-safety annotations

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@797270 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2009-07-24 00:03:52 +00:00
parent eee617209b
commit 66dc2da9ff
12 changed files with 32 additions and 5 deletions

View File

@ -27,6 +27,8 @@
package org.apache.http.client.methods; package org.apache.http.client.methods;
import net.jcip.annotations.NotThreadSafe;
import org.apache.http.Header; import org.apache.http.Header;
import org.apache.http.HttpEntity; import org.apache.http.HttpEntity;
import org.apache.http.HttpEntityEnclosingRequest; import org.apache.http.HttpEntityEnclosingRequest;
@ -39,6 +41,7 @@ import org.apache.http.protocol.HTTP;
* *
* @since 4.0 * @since 4.0
*/ */
@NotThreadSafe // HttpRequestBase is @NotThreadSafe
public abstract class HttpEntityEnclosingRequestBase public abstract class HttpEntityEnclosingRequestBase
extends HttpRequestBase implements HttpEntityEnclosingRequest { extends HttpRequestBase implements HttpEntityEnclosingRequest {

View File

@ -29,6 +29,8 @@ package org.apache.http.client.protocol;
import java.io.IOException; import java.io.IOException;
import net.jcip.annotations.Immutable;
import org.apache.http.HttpException; import org.apache.http.HttpException;
import org.apache.http.HttpRequest; import org.apache.http.HttpRequest;
import org.apache.http.HttpRequestInterceptor; import org.apache.http.HttpRequestInterceptor;
@ -45,6 +47,7 @@ import org.apache.http.protocol.HttpContext;
* *
* @since 4.0 * @since 4.0
*/ */
@Immutable
public class RequestClientConnControl implements HttpRequestInterceptor { public class RequestClientConnControl implements HttpRequestInterceptor {
private static final String PROXY_CONN_DIRECTIVE = "Proxy-Connection"; private static final String PROXY_CONN_DIRECTIVE = "Proxy-Connection";

View File

@ -144,7 +144,7 @@ import java.security.UnrecoverableKeyException;
* *
* @since 4.0 * @since 4.0
*/ */
@NotThreadSafe @NotThreadSafe // [gs]etHostNameVerifier
public class SSLSocketFactory implements LayeredSocketFactory { public class SSLSocketFactory implements LayeredSocketFactory {
public static final String TLS = "TLS"; public static final String TLS = "TLS";

View File

@ -26,6 +26,8 @@
package org.apache.http.impl.auth; package org.apache.http.impl.auth;
import net.jcip.annotations.NotThreadSafe;
import org.apache.http.FormattedHeader; import org.apache.http.FormattedHeader;
import org.apache.http.Header; import org.apache.http.Header;
import org.apache.http.auth.AUTH; import org.apache.http.auth.AUTH;
@ -44,6 +46,7 @@ import org.apache.http.util.CharArrayBuffer;
* *
* @since 4.0 * @since 4.0
*/ */
@NotThreadSafe // proxy
public abstract class AuthSchemeBase implements AuthScheme { public abstract class AuthSchemeBase implements AuthScheme {
/** /**

View File

@ -30,6 +30,8 @@ import java.util.HashMap;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import net.jcip.annotations.NotThreadSafe;
import org.apache.http.HeaderElement; import org.apache.http.HeaderElement;
import org.apache.http.auth.MalformedChallengeException; import org.apache.http.auth.MalformedChallengeException;
import org.apache.http.message.BasicHeaderValueParser; import org.apache.http.message.BasicHeaderValueParser;
@ -44,6 +46,7 @@ import org.apache.http.util.CharArrayBuffer;
* *
* @since 4.0 * @since 4.0
*/ */
@NotThreadSafe // AuthSchemeBase, params
public abstract class RFC2617Scheme extends AuthSchemeBase { public abstract class RFC2617Scheme extends AuthSchemeBase {
/** /**

View File

@ -30,6 +30,8 @@ package org.apache.http.impl.conn;
import java.io.IOException; import java.io.IOException;
import java.net.Socket; import java.net.Socket;
import net.jcip.annotations.NotThreadSafe;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.apache.http.Header; import org.apache.http.Header;
@ -61,6 +63,7 @@ import org.apache.http.conn.OperatedClientConnection;
* *
* @since 4.0 * @since 4.0
*/ */
@NotThreadSafe // connSecure, targetHost
public class DefaultClientConnection extends SocketHttpClientConnection public class DefaultClientConnection extends SocketHttpClientConnection
implements OperatedClientConnection { implements OperatedClientConnection {

View File

@ -31,6 +31,8 @@ import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import net.jcip.annotations.NotThreadSafe;
import org.apache.http.cookie.CookieAttributeHandler; import org.apache.http.cookie.CookieAttributeHandler;
import org.apache.http.cookie.CookieSpec; import org.apache.http.cookie.CookieSpec;
@ -42,6 +44,7 @@ import org.apache.http.cookie.CookieSpec;
* *
* @since 4.0 * @since 4.0
*/ */
@NotThreadSafe // HashMap is not thread-safe
public abstract class AbstractCookieSpec implements CookieSpec { public abstract class AbstractCookieSpec implements CookieSpec {
/** /**

View File

@ -31,6 +31,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import net.jcip.annotations.NotThreadSafe;
import org.apache.http.FormattedHeader; import org.apache.http.FormattedHeader;
import org.apache.http.Header; import org.apache.http.Header;
import org.apache.http.HeaderElement; import org.apache.http.HeaderElement;
@ -51,6 +53,7 @@ import org.apache.http.util.CharArrayBuffer;
* *
* @since 4.0 * @since 4.0
*/ */
@NotThreadSafe // superclass is @NotThreadSafe
public class BrowserCompatSpec extends CookieSpecBase { public class BrowserCompatSpec extends CookieSpecBase {
@Deprecated @Deprecated

View File

@ -31,6 +31,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import net.jcip.annotations.NotThreadSafe;
import org.apache.http.HeaderElement; import org.apache.http.HeaderElement;
import org.apache.http.NameValuePair; import org.apache.http.NameValuePair;
import org.apache.http.cookie.Cookie; import org.apache.http.cookie.Cookie;
@ -44,6 +46,7 @@ import org.apache.http.cookie.MalformedCookieException;
* *
* @since 4.0 * @since 4.0
*/ */
@NotThreadSafe // AbstractCookieSpec is not thread-safe
public abstract class CookieSpecBase extends AbstractCookieSpec { public abstract class CookieSpecBase extends AbstractCookieSpec {
protected static String getDefaultPath(final CookieOrigin origin) { protected static String getDefaultPath(final CookieOrigin origin) {

View File

@ -30,7 +30,7 @@ package org.apache.http.impl.cookie;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.jcip.annotations.Immutable; import net.jcip.annotations.NotThreadSafe;
import org.apache.http.FormattedHeader; import org.apache.http.FormattedHeader;
import org.apache.http.Header; import org.apache.http.Header;
@ -52,7 +52,7 @@ import org.apache.http.util.CharArrayBuffer;
* *
* @since 4.0 * @since 4.0
*/ */
@Immutable @NotThreadSafe // superclass is @NotThreadSafe
public class NetscapeDraftSpec extends CookieSpecBase { public class NetscapeDraftSpec extends CookieSpecBase {
protected static final String EXPIRES_PATTERN = "EEE, dd-MMM-yyyy HH:mm:ss z"; protected static final String EXPIRES_PATTERN = "EEE, dd-MMM-yyyy HH:mm:ss z";

View File

@ -31,7 +31,7 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import net.jcip.annotations.Immutable; import net.jcip.annotations.NotThreadSafe;
import org.apache.http.Header; import org.apache.http.Header;
import org.apache.http.HeaderElement; import org.apache.http.HeaderElement;
@ -54,7 +54,7 @@ import org.apache.http.util.CharArrayBuffer;
* *
* @since 4.0 * @since 4.0
*/ */
@Immutable @NotThreadSafe // superclass is @NotThreadSafe
public class RFC2109Spec extends CookieSpecBase { public class RFC2109Spec extends CookieSpecBase {
private final static CookiePathComparator PATH_COMPARATOR = new CookiePathComparator(); private final static CookiePathComparator PATH_COMPARATOR = new CookiePathComparator();

View File

@ -32,6 +32,8 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import net.jcip.annotations.NotThreadSafe;
import org.apache.http.Header; import org.apache.http.Header;
import org.apache.http.HeaderElement; import org.apache.http.HeaderElement;
import org.apache.http.NameValuePair; import org.apache.http.NameValuePair;
@ -50,6 +52,7 @@ import org.apache.http.util.CharArrayBuffer;
* *
* @since 4.0 * @since 4.0
*/ */
@NotThreadSafe // superclass is @NotThreadSafe
public class RFC2965Spec extends RFC2109Spec { public class RFC2965Spec extends RFC2109Spec {
/** /**