Removed remaining JCL usage in the caching module. Cleaned up POM.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1793690 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2017-05-03 18:31:30 +00:00
parent d5039137ca
commit e8efaea53f
17 changed files with 42 additions and 70 deletions

View File

@ -47,7 +47,6 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
@ -63,8 +62,8 @@
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jcl</artifactId>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>

View File

@ -28,8 +28,6 @@ package org.apache.hc.client5.http.impl.cache;
import java.io.IOException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hc.client5.http.cache.HeaderConstants;
import org.apache.hc.client5.http.cache.HttpCacheEntry;
import org.apache.hc.client5.http.sync.ExecChain;
@ -39,6 +37,8 @@ import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpResponse;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/**
* Class used to represent an asynchronous revalidation event, such as with
@ -55,7 +55,7 @@ public class AsynchronousValidationRequest implements Runnable {
private final String identifier;
private final int consecutiveFailedAttempts;
private final Log log = LogFactory.getLog(getClass());
private final Logger log = LogManager.getLogger(getClass());
/**
* Used internally by {@link AsynchronousValidator} to schedule a

View File

@ -33,12 +33,12 @@ import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.RejectedExecutionException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hc.client5.http.cache.HttpCacheEntry;
import org.apache.hc.client5.http.sync.ExecChain;
import org.apache.hc.core5.http.ClassicHttpRequest;
import org.apache.hc.core5.http.HttpHost;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/**
* Class used for asynchronous revalidations to be used when the "stale-
@ -50,7 +50,7 @@ class AsynchronousValidator implements Closeable {
private final CacheKeyGenerator cacheKeyGenerator;
private final FailureCache failureCache;
private final Log log = LogFactory.getLog(getClass());
private final Logger log = LogManager.getLogger(getClass());
/**
* Create AsynchronousValidator which will make revalidation requests

View File

@ -34,8 +34,6 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hc.client5.http.cache.HeaderConstants;
import org.apache.hc.client5.http.cache.HttpCacheEntry;
import org.apache.hc.client5.http.cache.HttpCacheInvalidator;
@ -53,6 +51,8 @@ import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.HttpStatus;
import org.apache.hc.core5.http.io.entity.ByteArrayEntity;
import org.apache.hc.core5.http.message.BasicClassicHttpResponse;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
class BasicHttpCache implements HttpCache {
private static final Set<String> safeRequestMethods = new HashSet<>(
@ -68,7 +68,7 @@ class BasicHttpCache implements HttpCache {
private final HttpCacheInvalidator cacheInvalidator;
private final HttpCacheStorage storage;
private final Log log = LogFactory.getLog(getClass());
private final Logger log = LogManager.getLogger(getClass());
public BasicHttpCache(
final ResourceFactory resourceFactory,

View File

@ -31,8 +31,6 @@ import java.net.MalformedURLException;
import java.net.URL;
import java.util.Date;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hc.client5.http.cache.HeaderConstants;
import org.apache.hc.client5.http.cache.HttpCacheEntry;
import org.apache.hc.client5.http.cache.HttpCacheInvalidator;
@ -45,6 +43,8 @@ import org.apache.hc.core5.http.HttpHeaders;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.HttpResponse;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/**
* Given a particular HttpRequest, flush any cache entries that this request
@ -58,7 +58,7 @@ class CacheInvalidator implements HttpCacheInvalidator {
private final HttpCacheStorage storage;
private final CacheKeyGenerator cacheKeyGenerator;
private final Log log = LogFactory.getLog(getClass());
private final Logger log = LogManager.getLogger(getClass());
/**
* Create a new {@link CacheInvalidator} for a given {@link HttpCache} and

View File

@ -28,9 +28,6 @@ package org.apache.hc.client5.http.impl.cache;
import java.util.Iterator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hc.core5.http.message.MessageSupport;
import org.apache.hc.client5.http.cache.HeaderConstants;
import org.apache.hc.core5.annotation.Contract;
import org.apache.hc.core5.annotation.ThreadingBehavior;
@ -38,6 +35,9 @@ import org.apache.hc.core5.http.HeaderElement;
import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.HttpVersion;
import org.apache.hc.core5.http.ProtocolVersion;
import org.apache.hc.core5.http.message.MessageSupport;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/**
* Determines if an HttpRequest is allowed to be served from the cache.
@ -47,7 +47,7 @@ import org.apache.hc.core5.http.ProtocolVersion;
@Contract(threading = ThreadingBehavior.IMMUTABLE)
class CacheableRequestPolicy {
private final Log log = LogFactory.getLog(getClass());
private final Logger log = LogManager.getLogger(getClass());
/**
* Determines if an HttpRequest can be served from the cache.

View File

@ -29,12 +29,9 @@ package org.apache.hc.client5.http.impl.cache;
import java.util.Date;
import java.util.Iterator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hc.client5.http.cache.HeaderConstants;
import org.apache.hc.client5.http.cache.HttpCacheEntry;
import org.apache.hc.client5.http.utils.DateUtils;
import org.apache.hc.core5.http.message.MessageSupport;
import org.apache.hc.core5.annotation.Contract;
import org.apache.hc.core5.annotation.ThreadingBehavior;
import org.apache.hc.core5.http.Header;
@ -42,6 +39,9 @@ import org.apache.hc.core5.http.HeaderElement;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.HttpStatus;
import org.apache.hc.core5.http.message.MessageSupport;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/**
* Determines whether a given {@link HttpCacheEntry} is suitable to be
@ -52,7 +52,7 @@ import org.apache.hc.core5.http.HttpStatus;
@Contract(threading = ThreadingBehavior.IMMUTABLE)
class CachedResponseSuitabilityChecker {
private final Log log = LogFactory.getLog(getClass());
private final Logger log = LogManager.getLogger(getClass());
private final boolean sharedCache;
private final boolean useHeuristicCaching;

View File

@ -34,8 +34,6 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hc.client5.http.HttpRoute;
import org.apache.hc.client5.http.cache.CacheResponseStatus;
import org.apache.hc.client5.http.cache.HeaderConstants;
@ -69,6 +67,8 @@ import org.apache.hc.core5.http.protocol.HttpCoreContext;
import org.apache.hc.core5.net.URIAuthority;
import org.apache.hc.core5.util.Args;
import org.apache.hc.core5.util.VersionInfo;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/**
* <p>
@ -122,7 +122,7 @@ public class CachingExec implements ExecChainHandler {
private final AsynchronousValidator asynchRevalidator;
private final Log log = LogFactory.getLog(getClass());
private final Logger log = LogManager.getLogger(getClass());
public CachingExec(
final HttpCache cache,

View File

@ -32,8 +32,6 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hc.client5.http.cache.HeaderConstants;
import org.apache.hc.client5.http.utils.DateUtils;
import org.apache.hc.core5.annotation.Contract;
@ -48,6 +46,8 @@ import org.apache.hc.core5.http.HttpStatus;
import org.apache.hc.core5.http.HttpVersion;
import org.apache.hc.core5.http.ProtocolVersion;
import org.apache.hc.core5.http.message.MessageSupport;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/**
* Determines if an HttpResponse can be cached.
@ -63,7 +63,7 @@ class ResponseCachingPolicy {
private final long maxObjectSizeBytes;
private final boolean sharedCache;
private final boolean neverCache1_0ResponsesWithQueryString;
private final Log log = LogFactory.getLog(getClass());
private final Logger log = LogManager.getLogger(getClass());
private static final Set<Integer> cacheableStatuses =
new HashSet<>(Arrays.asList(HttpStatus.SC_OK,
HttpStatus.SC_NON_AUTHORITATIVE_INFORMATION,

View File

@ -29,13 +29,13 @@ package org.apache.hc.client5.http.impl.cache.memcached;
import java.io.IOException;
import java.net.InetSocketAddress;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hc.client5.http.cache.HttpCacheEntry;
import org.apache.hc.client5.http.cache.HttpCacheStorage;
import org.apache.hc.client5.http.cache.HttpCacheUpdateCallback;
import org.apache.hc.client5.http.cache.HttpCacheUpdateException;
import org.apache.hc.client5.http.impl.cache.CacheConfig;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.spy.memcached.CASResponse;
import net.spy.memcached.CASValue;
@ -92,7 +92,7 @@ import net.spy.memcached.OperationTimeoutException;
*/
public class MemcachedHttpCacheStorage implements HttpCacheStorage {
private static final Log log = LogFactory.getLog(MemcachedHttpCacheStorage.class);
private final Logger log = LogManager.getLogger(getClass());
private final MemcachedClientIF client;
private final KeyHashingScheme keyHashingScheme;

View File

@ -30,8 +30,8 @@ import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import org.apache.commons.codec.binary.Hex;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/**
* This is a {@link KeyHashingScheme} based on the
@ -42,7 +42,7 @@ import org.apache.commons.logging.LogFactory;
*/
public class SHA256KeyHashingScheme implements KeyHashingScheme {
private static final Log log = LogFactory.getLog(SHA256KeyHashingScheme.class);
private final Logger log = LogManager.getLogger(getClass());
@Override
public String hash(final String key) {

View File

@ -1,26 +0,0 @@
# ====================================================================
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ====================================================================
#
# This software consists of voluntary contributions made by many
# individuals on behalf of the Apache Software Foundation. For more
# information on the Apache Software Foundation, please see
# <http://www.apache.org/>.
# Disable logging for unit tests
org.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog

View File

@ -22,7 +22,7 @@
</Console>
</Appenders>
<Loggers>
<Root level="WARN">
<Root level="fatal">
<AppenderRef ref="STDOUT" />
</Root>
</Loggers>

View File

@ -55,7 +55,6 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>

View File

@ -50,7 +50,6 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j.version}</version>
<scope>compile</scope>
</dependency>
<dependency>

View File

@ -22,7 +22,7 @@
</Console>
</Appenders>
<Loggers>
<Root level="WARN">
<Root level="FATAL">
<AppenderRef ref="STDOUT" />
</Root>
</Loggers>

11
pom.xml
View File

@ -109,6 +109,12 @@
<version>${log4j.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>${log4j.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
@ -119,11 +125,6 @@
<artifactId>ehcache-core</artifactId>
<version>${ehcache.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jcl</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>net.spy</groupId>
<artifactId>spymemcached</artifactId>