Prerequisite
I have a simple Spring Boot app that does a single call to https://google.com via RestTemplate.
RestTemplate is just customized a bit, it consumes OkHttp3ClientHttpRequestFactory as a request factory.
Problem
HTTP call is being executed correctly but after finishing the main method application still keeps running and does not stop.
What is the reason for that and how to avoid this behavior?
Reproducer
Reproducible source code: https://github.com/alexey-anufriev/okhttpclient-shutdown-problem
Important Note
The problem occurs only on Java 11, but not on Java 8. On Java 8 it terminates immediately.
Prerequisite
I have a simple Spring Boot app that does a single call to
https://google.comviaRestTemplate.RestTemplateis just customized a bit, it consumesOkHttp3ClientHttpRequestFactoryas a request factory.Problem
HTTP call is being executed correctly but after finishing the
mainmethod application still keeps running and does not stop.What is the reason for that and how to avoid this behavior?
Reproducer
Reproducible source code: https://github.com/alexey-anufriev/okhttpclient-shutdown-problem
Important Note
The problem occurs only on Java 11, but not on Java 8. On Java 8 it terminates immediately.