-
Notifications
You must be signed in to change notification settings - Fork 241
KVCache dose not closes properly #133
Comments
I can confirm this (on the latest, 0.12.4, from mvnrepository.com): |
+1 confirm it on versions |
been looking into this some - it's not actually a problem with KVCache, but with the okHttp services. For example, the following code triggers the same behavior, no kvCache needed. public static void main(String[] args) throws NamingException, InterruptedException {
final AtomicReference<BigInteger> latestIndex = new AtomicReference<BigInteger>(null);
final CountDownLatch latch = new CountDownLatch(1);
final Consul consul = Consul.builder().build();
KeyValueClient kvClient = consul.keyValueClient();
kvClient.putValue("/key", "value");
kvClient.getValues("/key", QueryOptions.BLANK, new ConsulResponseCallback<List<Value>>() {
@Override
public void onComplete(ConsulResponse<List<Value>> consulResponse) {
latestIndex.set(consulResponse.getIndex());
latch.countDown();
}
@Override
public void onFailure(Throwable throwable) {
latch.countDown();
}
});
System.out.println("sent request");
latch.await();
System.out.println("request completed");
} There is an executorService created by the dispatcher library here: https://github.com/square/okhttp/blob/master/okhttp/src/main/java/okhttp3/Dispatcher.java#L64-L65 that is not a daemon, and as such block the jvm from shutting down. There's a few options
I'll go ahead and push up a PR for 1 above for immediate relief. |
Hi,
Running small code that starts KVCache then stops it and then exits that main. The JVM is still running
and not closes properly.
Only if I put System.exit in the end the JVM shuts down.
The text was updated successfully, but these errors were encountered: