Currently there are only blocking variants of loginDesktop() and logout() at KeycloakInstalled.
It means that if the methods are called they open an URL in browser and wait until they get callback from the Keycloak server.
It makes not advisable to call them from the UI thread because they block it.
But even if the methods are called from a worker thread so that the application is not blocked, they always open a server socket and start threads and there is no way to close the socket and to kill the associated callback threads from the application code.
I would like to have non blocking versions which could return CompletableFuture<Void>. If the user cancels the returned CompletableFuture, also the opened server socket should be closed.