Hi, Am using the kiteconnect jar version 3.5.0 from maven. The java application does not terminate, probably due to the open okhttp threads. I did not see any method to close the connection. While logging out is not what i want, even calling logout() does not end the program.
That user was running on Java 11 and in Okhttp library there is something called keep connection alive which is by default set to true. Maybe that is what is resulting in this behavior. You may try forking the library and change whatever required or downgrade Java version and check the existing behavior.
I defined a new method close() in KiteConnect, and also in KiteRequestHandler.
The KiteConnect.close() calls the KiteRequestHandler.close(), where we do :
public void close() throws IOException { client.dispatcher().executorService().shutdown(); client.connectionPool().evictAll(); if( client.cache() != null) { client.cache().close(); } } When our app is done using KiteConnect, we call its close(), and the app should terminate. I still need to dig deeper to see if any currently executing requests need to be handled.
https://github.com/square/okhttp/issues/3372
I defined a new method close() in KiteConnect, and also in KiteRequestHandler.
The KiteConnect.close() calls the KiteRequestHandler.close(), where we do :
public void close() throws IOException {
client.dispatcher().executorService().shutdown();
client.connectionPool().evictAll();
if( client.cache() != null) {
client.cache().close();
}
}
When our app is done using KiteConnect, we call its close(), and the app should terminate.
I still need to dig deeper to see if any currently executing requests need to be handled.