These are chat archives for Mashape/unirest-java

23rd
Jun 2016
shashi ranjan
@shashiranjan84
Jun 23 2016 05:15
@hasSoumya use some profiler and check where memory leaking.
@hasSoumya what version Unrest are you suing?
shashi ranjan
@shashiranjan84
Jun 23 2016 05:37
@hasSoumya there could be many reasons, may be you opening too many tasks which put load on JVM memory. Also you can set timeout on Future.get calls.
Soumya Sanyal
@hasSoumya
Jun 23 2016 05:53
@shashiranjan84 I'm on the latest version i.e. 1.4.9
My wrapper future call looks like this
shashi ranjan
@shashiranjan84
Jun 23 2016 05:58
@hasSoumya use 1.4.8 for now.
1.4.9 needs some fix
Soumya Sanyal
@hasSoumya
Jun 23 2016 05:59
    public static Future<HttpResponse<InputStream>> retriableBinaryAsyncGet(int retries, HttpRequest h) throws Exception {
        Future<HttpResponse<InputStream>> in = null;
        for (int i=0; i < retries; ++i) {
            try {
                in = h.asBinaryAsync();
                break;
            } catch (Exception e) {
                if (! (e instanceof IllegalThreadStateException)) {
                    log.fatal("Couldn't get a response from Cthulhu. Will retry.", e);
                }
                if (i == retries - 1) {
                    //Exhausted retries, bail
                    throw e;
                }
            }
            // Sleep for a lil bit
            Thread.sleep(20);
        }

        return in;
    }
Ah thanks
I will check that out
*Cthulhu is my POST endpoint
shashi ranjan
@shashiranjan84
Jun 23 2016 06:05
only thing i can say that it may be keep on creating Future object