<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      android defaluthttpclient timeout 整理

      android defaulthttpclient 超時無效的相關解放方式記錄:

      With the marked solution I am still getting a UnknownHostException after 30+ seconds. In this case the device is connected to a wifi router but there is no internet access.

      1. The approach taken was to kick off an AsyncTask that will just attempt to resolve the hostname. The blocking call checks every 250 ms to see if it succeeded, and after 4 seconds it will cancel the task and return.

        This is what I did to solve it:

        private boolean dnsOkay = false; private static final int DNS_SLEEP_WAIT = 250; private synchronized boolean resolveDns(){ RemoteDnsCheck check = new RemoteDnsCheck();     check.execute(); try { int timeSlept = 0; while(!dnsOkay && timeSlept<4000){ //Log.d("RemoteDnsCheck", "sleeping"); Thread.sleep(DNS_SLEEP_WAIT);             timeSlept+=DNS_SLEEP_WAIT; //Log.d("RemoteDnsCheck", "slept"); } } catch (InterruptedException e) { } if(!dnsOkay){ Log.d("resolveDns", "cancelling");         check.cancel(true); Log.d("resolveDns", "cancelled"); } return dnsOkay; }  private class RemoteDnsCheck extends AsyncTask<Void, Void, Void>{ @Override protected Void doInBackground(Void... params) { try { Log.d("RemoteDnsCheck", "starting");             dnsOkay = false; InetAddress addr = InetAddress.getByName(baseServiceURL); if(addr!=null){ Log.d("RemoteDnsCheck", "got addr");                 dnsOkay = true; } } catch (UnknownHostException e) { Log.d("RemoteDnsCheck", "UnknownHostException"); } return null; }  }

        Then, any time I want to do a web call, this is called at the beginning of the function:

        if(!resolveDns()){ return null; } 
      2.  This method works for me :
        AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport( endpoint, 3000) ; 
      3. 3.
        Thread t=new Thread()
        {
          public void run()
          {
            try 
            {
              Thread.sleep(absolutetimeout);
              httpclient.getConnectionManager().closeExpiredConnections();
              httpclient.getConnectionManager().closeIdleConnections(absolutetimeout,TimeUnit.MILLISECONDS);
              httpclient.getConnectionManager().shutdown();
              log.debug("We shutdown the connection manager!");
            }
            catch(InterruptedException e)
            {}
          }
        };
        
        t.start();
        HttpResponse res= httpclient.execute(httpget);
        t.interrupt();

        Is that along the lines of what you all are suggesting?

        I'm not exactly sure how to cancel the execute once it has started, but this seemed to work for me. I'm not sure which of the three lines in the thread did the magic, or if it was some combination of all of them.

      4. The problem might be in the Apache HTTP Client. See HTTPCLIENT-1098. Fixed in 4.1.2.


        The timeout exception tries to reverse DNS the IP, for logging purposes. This takes an additional time until the exception is actually fired.

      5. How are you making the HTTP Connection? This looks like a threading issue. If you are using a background thread, then the thread may be killed along with any timeout registered. The fact that it works the next time tells me that your code will work, if you make the call in a android component and manage the WAKE_LOCK on it yourself. Anyways please post more information about the calling mechanism?

      posted @ 2014-01-08 10:23  縱橫之間  閱讀(419)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 日本www一道久久久免费| 少妇人妻综合久久中文字幕| 在线播放亚洲成人av| 林周县| 国产成人片无码视频在线观看 | 又大又紧又粉嫩18p少妇| 秋霞电影网| 久久精产国品一二三产品| 国产av一区二区三区| 国产亚洲精品在av| 国产一区二区不卡精品视频 | 亚洲国产aⅴ成人精品无吗| 国产亚洲真人做受在线观看| 日韩av综合中文字幕| 无码精品人妻一区二区三区湄公河| 精品嫩模福利一区二区蜜臀| 国产99青青成人A在线| 深夜在线观看免费av| 男女爽爽无遮挡午夜视频| 免费无码又爽又刺激网站| 亚洲欧美高清在线精品一区二区| 国产精品伦理一区二区三| www亚洲精品| 国产片一区二区三区视频| 一本av高清一区二区三区| 奇米四色7777中文字幕| 99久久99久久久精品久久| 亚洲乱熟女一区二区三区| 国产不卡精品视频男人的天堂| 亚洲gv天堂无码男同在线观看 | 亚洲精品国产第一区二区| 少妇办公室好紧好爽再浪一点| 又湿又紧又大又爽a视频| 无码一区中文字幕| 久青草视频在线观看免费| 激情无码人妻又粗又大| 国产在线国偷精品免费看| 中文字幕波多野不卡一区| 久久久精品94久久精品| 黄色亚洲一区二区三区四区| 国产亚洲精品久久久久婷婷瑜伽|