On Fri, Sep 3, 2021 at 11:51 AM Michael Marshall <mikemars...@gmail.com> wrote: > The new interface would be called AsyncAuthenticationProvider, and it would > extend the existing AuthenticationProvider interface. It would have one > additional method "authenticateAsync" and it would be up to the > implementation to make sure that there is no blocking on the netty thread > pool.
I was not exactly suggesting to have AsyncAuthenticationProvider extend the current interface :) The callers should be always using the async interface, so we don't need to have the sync methods in the new interface. Instead we'd have 2 interface and bridging class that would look like: class AsyncAuthBridge implements AsyncAuthenticationProvider { AuthenticationProvider delegate; Executor e; CompletableFuture<Boolean> canPublishAsync(String topic, AuthenticationDataSource s) { CompletableFuture<Boolean> f = new CompletableFuture<>(); e.execute(() -> { f.complete(delegate.canPublish(topic, s)); } return f; } }