zoukankan      html  css  js  c++  java
  • http超时机制



    HttpRequestRetryHandler myRetryHandler = new HttpRequestRetryHandler() {

                    @Override
                    public boolean retryRequest(IOException exception, int arg1, HttpContext arg2) {
                        if (arg1 >= 3) {
                            return false;
                        }
                        if (exception instanceof InterruptedIOException) {
                            // Timeout
                            return true;
                        }
                        if (exception instanceof UnknownHostException) {
                            // Unknown host
                            return true;
                        }
                        if (exception instanceof ConnectTimeoutException) {
                            // Connection refused
                            return true;
                        }
                        if (exception instanceof SocketTimeoutException) {
                            // Connection refused
                            return true;
                        }
                        if (exception instanceof SSLException) {
                            // SSL handshake exception
                            return false;
                        }
                        return false;
                    }
                };

                CloseableHttpClient httpclient = HttpClients.custom().setRetryHandler(myRetryHandler)
                        .setDefaultRequestConfig(globalConfig).setMaxConnTotal(100).build();

  • 相关阅读:
    UNITY 多个子MESH与贴图的对应关系
    UNITY 优化之带Animator的Go.SetActive耗时问题,在手机上,这个问题似乎并不存在,因为优化了后手机上运行帧率并未明显提升
    发现一个好办法-有问题可以到UNITY论坛搜索
    静态函数造成GC的原因
    关于GC.Collect在不同机器上表现不一致问题
    VULKAN学习资料收集
    Array.Resize(ref arry, size);
    玩游戏消耗精力
    浮点数与定点数问题
    P8 Visible Lattice Points
  • 原文地址:https://www.cnblogs.com/gkbgy/p/7574553.html
Copyright © 2011-2022 走看看