.class public Lorg/apache/http/impl/execchain/ServiceUnavailableRetryExec; .super Ljava/lang/Object; .source "ServiceUnavailableRetryExec.java" # interfaces .implements Lorg/apache/http/impl/execchain/ClientExecChain; # instance fields .field private final log:Lorg/apache/commons/logging/Log; .field private final requestExecutor:Lorg/apache/http/impl/execchain/ClientExecChain; .field private final retryStrategy:Lorg/apache/http/client/ServiceUnavailableRetryStrategy; # direct methods .method public constructor (Lorg/apache/http/impl/execchain/ClientExecChain;Lorg/apache/http/client/ServiceUnavailableRetryStrategy;)V .registers 4 .line 70 invoke-direct {p0}, Ljava/lang/Object;->()V .line 62 invoke-virtual {p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class; move-result-object v0 invoke-static {v0}, Lorg/apache/commons/logging/LogFactory;->getLog(Ljava/lang/Class;)Lorg/apache/commons/logging/Log; move-result-object v0 iput-object v0, p0, Lorg/apache/http/impl/execchain/ServiceUnavailableRetryExec;->log:Lorg/apache/commons/logging/Log; .line 71 const-string v0, "HTTP request executor" invoke-static {p1, v0}, Lorg/apache/http/util/Args;->notNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object; .line 72 const-string v0, "Retry strategy" invoke-static {p2, v0}, Lorg/apache/http/util/Args;->notNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object; .line 73 iput-object p1, p0, Lorg/apache/http/impl/execchain/ServiceUnavailableRetryExec;->requestExecutor:Lorg/apache/http/impl/execchain/ClientExecChain; .line 74 iput-object p2, p0, Lorg/apache/http/impl/execchain/ServiceUnavailableRetryExec;->retryStrategy:Lorg/apache/http/client/ServiceUnavailableRetryStrategy; return-void .end method # virtual methods .method public execute(Lorg/apache/http/conn/routing/HttpRoute;Lorg/apache/http/client/methods/HttpRequestWrapper;Lorg/apache/http/client/protocol/HttpClientContext;Lorg/apache/http/client/methods/HttpExecutionAware;)Lorg/apache/http/client/methods/CloseableHttpResponse; .registers 13 .annotation system Ldalvik/annotation/Throws; value = { Ljava/io/IOException;, Lorg/apache/http/HttpException; } .end annotation .line 83 invoke-virtual {p2}, Lorg/apache/http/client/methods/HttpRequestWrapper;->getAllHeaders()[Lorg/apache/http/Header; move-result-object v0 const/4 v1, 0x1 .line 85 :goto_5 iget-object v2, p0, Lorg/apache/http/impl/execchain/ServiceUnavailableRetryExec;->requestExecutor:Lorg/apache/http/impl/execchain/ClientExecChain; invoke-interface {v2, p1, p2, p3, p4}, Lorg/apache/http/impl/execchain/ClientExecChain;->execute(Lorg/apache/http/conn/routing/HttpRoute;Lorg/apache/http/client/methods/HttpRequestWrapper;Lorg/apache/http/client/protocol/HttpClientContext;Lorg/apache/http/client/methods/HttpExecutionAware;)Lorg/apache/http/client/methods/CloseableHttpResponse; move-result-object v2 .line 88 :try_start_b iget-object v3, p0, Lorg/apache/http/impl/execchain/ServiceUnavailableRetryExec;->retryStrategy:Lorg/apache/http/client/ServiceUnavailableRetryStrategy; invoke-interface {v3, v2, v1, p3}, Lorg/apache/http/client/ServiceUnavailableRetryStrategy;->retryRequest(Lorg/apache/http/HttpResponse;ILorg/apache/http/protocol/HttpContext;)Z move-result v3 if-eqz v3, :cond_57 invoke-static {p2}, Lorg/apache/http/impl/execchain/RequestEntityProxy;->isRepeatable(Lorg/apache/http/HttpRequest;)Z move-result v3 if-eqz v3, :cond_57 .line 90 invoke-interface {v2}, Lorg/apache/http/client/methods/CloseableHttpResponse;->close()V .line 91 iget-object v3, p0, Lorg/apache/http/impl/execchain/ServiceUnavailableRetryExec;->retryStrategy:Lorg/apache/http/client/ServiceUnavailableRetryStrategy; invoke-interface {v3}, Lorg/apache/http/client/ServiceUnavailableRetryStrategy;->getRetryInterval()J move-result-wide v3 :try_end_22 .catch Ljava/lang/RuntimeException; {:try_start_b .. :try_end_22} :catch_58 const-wide/16 v5, 0x0 cmp-long v5, v3, v5 if-lez v5, :cond_51 .line 94 :try_start_28 iget-object v5, p0, Lorg/apache/http/impl/execchain/ServiceUnavailableRetryExec;->log:Lorg/apache/commons/logging/Log; new-instance v6, Ljava/lang/StringBuilder; invoke-direct {v6}, Ljava/lang/StringBuilder;->()V const-string v7, "Wait for " invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v6 invoke-virtual {v6, v3, v4}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder; move-result-object v6 invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v6 invoke-interface {v5, v6}, Lorg/apache/commons/logging/Log;->trace(Ljava/lang/Object;)V .line 95 invoke-static {v3, v4}, Ljava/lang/Thread;->sleep(J)V :try_end_43 .catch Ljava/lang/InterruptedException; {:try_start_28 .. :try_end_43} :catch_44 .catch Ljava/lang/RuntimeException; {:try_start_28 .. :try_end_43} :catch_58 goto :goto_51 .line 97 :catch_44 :try_start_44 invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread; move-result-object p1 invoke-virtual {p1}, Ljava/lang/Thread;->interrupt()V .line 98 new-instance p1, Ljava/io/InterruptedIOException; invoke-direct {p1}, Ljava/io/InterruptedIOException;->()V throw p1 .line 101 :cond_51 :goto_51 invoke-virtual {p2, v0}, Lorg/apache/http/client/methods/HttpRequestWrapper;->setHeaders([Lorg/apache/http/Header;)V :try_end_54 .catch Ljava/lang/RuntimeException; {:try_start_44 .. :try_end_54} :catch_58 add-int/lit8 v1, v1, 0x1 goto :goto_5 :cond_57 return-object v2 :catch_58 move-exception p1 .line 106 invoke-interface {v2}, Lorg/apache/http/client/methods/CloseableHttpResponse;->close()V .line 107 throw p1 .end method