Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chunking support - OkHttpClient does not close #359

Closed
kboshold opened this issue Aug 1, 2017 · 2 comments
Closed

Chunking support - OkHttpClient does not close #359

kboshold opened this issue Aug 1, 2017 · 2 comments
Labels

Comments

@kboshold
Copy link

kboshold commented Aug 1, 2017

Type: BUG
Priority: MEDIUM - HIGH

I am using the chunking support and i detected that the OkHttpClient does not close propper. I noticed this because my program did not exit until the OkHttpClient was closed automaticlly (After an timeout).

To fix this issue the created client client.addInterceptor(loggingInterceptor).addInterceptor(gzipRequestInterceptor).build() has to be set to an field variable to close it later in the close method.

public InfluxDBImpl(...) {
    /* ... */
   this.client = client.addInterceptor(loggingInterceptor).addInterceptor(gzipRequestInterceptor).build();
   this.retrofit = new Retrofit.Builder()
                .baseUrl(url)
                .client(this.client)
                .addConverterFactory(MoshiConverterFactory.create())
                .build();
}

public void close() {
    /* ... */
   this.client.dispatcher().executorService().shutdown();
   this.client.connectionPool().evictAll();
   }
@majst01
Copy link
Collaborator

majst01 commented Aug 1, 2017

Do you mind express this in a pull request including a test, i will review and check if it is ok to merge.

@majst01 majst01 added this to the 2.8 milestone Aug 1, 2017
@kboshold
Copy link
Author

kboshold commented Aug 2, 2017

Hello @majst01,
i will create an pull request for that in the following days. This will also solve the ticket #286.

@majst01 majst01 modified the milestones: 2.8, 2.9 Dec 7, 2017
@lxhoan lxhoan removed this from the 2.9 milestone Jul 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants