Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: How do I configure the socket read timeout in spring social

  1. #11

    Default

    Rob,

    Did you ever manage to solve it? I'm facing similar issues which I suspect are timeouts on my qa machines..,
    though I can't reproduce it on dev/production, my QA keeps on complaining about it...

    Cheers,
    Yoni

  2. #12
    Join Date
    Feb 2012
    Posts
    29

    Default

    Hey Yoni,
    I did get some timeout stuff working, but never figured out what the root cause was. Mucked with all sorts of things to figure it out.

    My code for setting the timeouts:
    Code:
    FacebookTemplate facebook = new FacebookTemplate(accessToken);
     SimpleClientHttpRequestFactory rf = new SimpleClientHttpRequestFactory();
    // zero means indefinite, negative means use use the default, positive is in milliseconds.
    // default is 60s, I think.
    if (httpReadTimeout >= 0) {
      rf.setReadTimeout(httpReadTimeout);
    }
    if (httpConnectTimeout >= 0) {
        rf.setConnectTimeout(httpConnectTimeout);
    }
               
    facebook.setRequestFactory(rf);
    Last edited by Rob Blair; Jan 22nd, 2013 at 12:27 PM. Reason: formatting

  3. #13

    Default

    Thanks!

    I'll give it a try.

    habuma,
    Any chance of adding it to the config options?

  4. #14
    Join Date
    Aug 2004
    Posts
    1,067

    Default

    I'm not likely to expose it, but I'm not taking it off the table, either.

    The reason I'm not inclined to expose it is that those parameters are settings for the HTTP client implementation chosen (and there are a handful of choices, each with a different set of settings). Those are abstracted by Spring's request factories, which are used by RestTemplate, which is then in turn used by Spring Social's API bindings and OAuth templates.

    Given that each HTTP client implementation is different (Which settings would I expose? What about settings that are only available on one of the HTTP client implementations?) *AND* that they're all buried under several layers (request factories, RestTemplate, Spring Social classes), it doesn't make much sense design-wise to expose those at the Spring Social level.

    But yes, I agree that it would be easier and more convenient, which is why I'm not taking the possibility off of the table. I just would want to think it through completely before I made that move.
    Craig Walls
    Spring Social Project Lead

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •