You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2013/12/28 17:09:02 UTC
svn commit: r1553861 [2/2] - in
/httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http:
client/protocol/ conn/ssl/ impl/auth/ impl/client/ impl/conn/ impl/execchain/
Modified: httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/RetryExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/RetryExec.java?rev=1553861&r1=1553860&r2=1553861&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/RetryExec.java (original)
+++ httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/RetryExec.java Sat Dec 28 16:09:01 2013
@@ -29,8 +29,8 @@ package org.apache.http.impl.execchain;
import java.io.IOException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import android.util.Log;
+
import org.apache.http.Header;
import org.apache.http.HttpException;
import org.apache.http.annotation.Immutable;
@@ -57,7 +57,7 @@ import org.apache.http.util.Args;
@Immutable
public class RetryExec implements ClientExecChain {
- private final Log log = LogFactory.getLog(getClass());
+ private final String tag = getClass().getName();
private final ClientExecChain requestExecutor;
private final HttpRequestRetryHandler retryHandler;
@@ -85,27 +85,27 @@ public class RetryExec implements Client
return this.requestExecutor.execute(route, request, context, execAware);
} catch (final IOException ex) {
if (execAware != null && execAware.isAborted()) {
- this.log.debug("Request has been aborted");
+ Log.d(tag, "Request has been aborted");
throw ex;
}
if (retryHandler.retryRequest(ex, execCount, context)) {
- if (this.log.isInfoEnabled()) {
- this.log.info("I/O exception ("+ ex.getClass().getName() +
+ if (Log.isLoggable(tag, Log.INFO)) {
+ Log.i(tag, "I/O exception ("+ ex.getClass().getName() +
") caught when processing request: "
+ ex.getMessage());
}
- if (this.log.isDebugEnabled()) {
- this.log.debug(ex.getMessage(), ex);
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, ex.getMessage(), ex);
}
if (!Proxies.isRepeatable(request)) {
- this.log.debug("Cannot retry non-repeatable request");
+ Log.d(tag, "Cannot retry non-repeatable request");
final NonRepeatableRequestException nreex = new NonRepeatableRequestException(
"Cannot retry request with a non-repeatable request entity");
nreex.initCause(ex);
throw nreex;
}
request.setHeaders(origheaders);
- this.log.info("Retrying request");
+ Log.i(tag, "Retrying request");
} else {
throw ex;
}
Modified: httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java?rev=1553861&r1=1553860&r2=1553861&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java (original)
+++ httpcomponents/httpclient-android/branches/test-branch/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java Sat Dec 28 16:09:01 2013
@@ -30,8 +30,8 @@ package org.apache.http.impl.execchain;
import java.io.IOException;
import java.io.InterruptedIOException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import android.util.Log;
+
import org.apache.http.HttpException;
import org.apache.http.annotation.Immutable;
import org.apache.http.client.ServiceUnavailableRetryStrategy;
@@ -56,7 +56,7 @@ import org.apache.http.util.Args;
@Immutable
public class ServiceUnavailableRetryExec implements ClientExecChain {
- private final Log log = LogFactory.getLog(getClass());
+ private final String tag = getClass().getName();
private final ClientExecChain requestExecutor;
private final ServiceUnavailableRetryStrategy retryStrategy;
@@ -85,7 +85,9 @@ public class ServiceUnavailableRetryExec
final long nextInterval = this.retryStrategy.getRetryInterval();
if (nextInterval > 0) {
try {
- this.log.trace("Wait for " + nextInterval);
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, "Wait for " + nextInterval);
+ }
Thread.sleep(nextInterval);
} catch (final InterruptedException e) {
Thread.currentThread().interrupt();