X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fcds-access-client%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Faccess%2Fclient%2FBackendInfoResolver.java;h=fc633adaa6af4dc6e915f5528c43e28747d25ab9;hb=refs%2Fchanges%2F10%2F78310%2F5;hp=4ece691d898c45169a4783491d19e5fd2877bdaf;hpb=bc2b83e97bc73930badd4a3063c65b849f82c664;p=controller.git diff --git a/opendaylight/md-sal/cds-access-client/src/main/java/org/opendaylight/controller/cluster/access/client/BackendInfoResolver.java b/opendaylight/md-sal/cds-access-client/src/main/java/org/opendaylight/controller/cluster/access/client/BackendInfoResolver.java index 4ece691d89..fc633adaa6 100644 --- a/opendaylight/md-sal/cds-access-client/src/main/java/org/opendaylight/controller/cluster/access/client/BackendInfoResolver.java +++ b/opendaylight/md-sal/cds-access-client/src/main/java/org/opendaylight/controller/cluster/access/client/BackendInfoResolver.java @@ -9,7 +9,9 @@ package org.opendaylight.controller.cluster.access.client; import akka.actor.ActorRef; import java.util.concurrent.CompletionStage; +import java.util.function.Consumer; import javax.annotation.Nonnull; +import org.opendaylight.yangtools.concepts.Registration; /** * Caching resolver which resolves a cookie to a leader {@link ActorRef}. This class needs to be specialized by the @@ -26,7 +28,7 @@ import javax.annotation.Nonnull; * * @author Robert Varga */ -public abstract class BackendInfoResolver { +public abstract class BackendInfoResolver implements AutoCloseable { /** * Request resolution of a particular backend identified by a cookie. This request can be satisfied from the cache. * @@ -46,4 +48,21 @@ public abstract class BackendInfoResolver { */ @Nonnull public abstract CompletionStage refreshBackendInfo(@Nonnull Long cookie, @Nonnull T staleInfo); + + /** + * Registers a callback to be notified when BackendInfo that may have been previously obtained is now stale and + * should be refreshed. + * + * @param callback the callback that takes the backend cookie whose BackendInfo is now stale. + * @return a Registration + */ + @Nonnull + public abstract Registration notifyWhenBackendInfoIsStale(Consumer callback); + + @Nonnull + public abstract String resolveCookieName(Long cookie); + + @Override + public void close() { + } }