More ThreadSafe and Immutable classes

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@756296 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2009-03-20 01:52:13 +00:00
parent e895b182a5
commit 4753d7e3ac
7 changed files with 24 additions and 2 deletions

View File

@ -35,6 +35,8 @@ import java.io.IOException;
import java.net.URI;
import java.lang.reflect.UndeclaredThrowableException;
import net.jcip.annotations.ThreadSafe;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.http.ConnectionReuseStrategy;
@ -77,6 +79,7 @@ import org.apache.http.protocol.HttpRequestExecutor;
*
* @since 4.0
*/
@ThreadSafe
public abstract class AbstractHttpClient implements HttpClient {
private final Log log = LogFactory.getLog(getClass());

View File

@ -31,6 +31,8 @@
package org.apache.http.impl.client;
import net.jcip.annotations.ThreadSafe;
import org.apache.http.ConnectionReuseStrategy;
import org.apache.http.HttpVersion;
import org.apache.http.auth.AuthSchemeRegistry;
@ -96,6 +98,7 @@ import org.apache.http.util.VersionInfo;
*
* @since 4.0
*/
@ThreadSafe
public class DefaultHttpClient extends AbstractHttpClient {

View File

@ -34,6 +34,8 @@ package org.apache.http.impl.conn;
import java.net.InetAddress;
import net.jcip.annotations.ThreadSafe;
import org.apache.http.HttpException;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
@ -56,10 +58,11 @@ import org.apache.http.conn.params.ConnRouteParams;
*
* @since 4.0
*/
@ThreadSafe
public class DefaultHttpRoutePlanner implements HttpRoutePlanner {
/** The scheme registry. */
protected SchemeRegistry schemeRegistry;
protected final SchemeRegistry schemeRegistry; // class is @ThreadSafe
/**

View File

@ -33,6 +33,8 @@ package org.apache.http.impl.conn;
import java.io.IOException;
import net.jcip.annotations.ThreadSafe;
import org.apache.http.HttpException;
import org.apache.http.HttpMessage;
import org.apache.http.HttpResponseFactory;
@ -51,6 +53,7 @@ import org.apache.http.util.CharArrayBuffer;
*
* @since 4.0
*/
@ThreadSafe // no public methods
public class DefaultResponseParser extends AbstractMessageParser {
private final HttpResponseFactory responseFactory;

View File

@ -32,6 +32,8 @@ package org.apache.http.impl.conn;
import java.io.IOException;
import net.jcip.annotations.Immutable;
import org.apache.http.io.HttpTransportMetrics;
import org.apache.http.io.SessionInputBuffer;
import org.apache.http.util.CharArrayBuffer;
@ -42,6 +44,7 @@ import org.apache.http.util.CharArrayBuffer;
*
* @since 4.0
*/
@Immutable
public class LoggingSessionInputBuffer implements SessionInputBuffer {
/** Original session input buffer. */

View File

@ -32,6 +32,8 @@ package org.apache.http.impl.conn;
import java.io.IOException;
import net.jcip.annotations.Immutable;
import org.apache.http.io.HttpTransportMetrics;
import org.apache.http.io.SessionOutputBuffer;
import org.apache.http.util.CharArrayBuffer;
@ -42,6 +44,7 @@ import org.apache.http.util.CharArrayBuffer;
*
* @since 4.0
*/
@Immutable
public class LoggingSessionOutputBuffer implements SessionOutputBuffer {
/** Original data transmitter. */

View File

@ -40,6 +40,9 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import net.jcip.annotations.NotThreadSafe;
import net.jcip.annotations.ThreadSafe;
import org.apache.http.HttpException;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
@ -65,10 +68,11 @@ import org.apache.http.conn.params.ConnRouteParams;
*
* @since 4.0
*/
@NotThreadSafe // e.g [gs]etProxySelector()
public class ProxySelectorRoutePlanner implements HttpRoutePlanner {
/** The scheme registry. */
protected SchemeRegistry schemeRegistry;
protected final SchemeRegistry schemeRegistry; // @ThreadSafe
/** The proxy selector to use, or <code>null</code> for system default. */
protected ProxySelector proxySelector;