public class OwnershipCache extends Object
| Constructor and Description |
|---|
OwnershipCache(PulsarService pulsar,
NamespaceBundleFactory bundleFactory,
NamespaceService namespaceService)
Constructor of
OwnershipCache |
| Modifier and Type | Method and Description |
|---|---|
CompletableFuture<Boolean> |
checkOwnership(NamespaceBundle bundle)
Check whether this broker owns given namespace bundle.
|
CompletableFuture<Void> |
disableOwnership(NamespaceBundle bundle)
Disable bundle in local cache and on zk
|
OwnedBundle |
getOwnedBundle(NamespaceBundle bundle)
Return the
OwnedBundle instance from the local cache. |
Map<String,OwnedBundle> |
getOwnedBundles()
Method to access the map of all
ServiceUnit objects owned by the local broker |
CompletableFuture<Optional<NamespaceEphemeralData>> |
getOwnerAsync(NamespaceBundle suName)
Method to get the current owner of the
ServiceUnit |
NamespaceEphemeralData |
getSelfOwnerInfo() |
void |
invalidateLocalOwnerCache() |
boolean |
isNamespaceBundleOwned(NamespaceBundle bundle)
Checked whether a particular bundle is currently owned by this broker
|
boolean |
refreshSelfOwnerInfo() |
CompletableFuture<Void> |
removeOwnership(NamespaceBundle bundle)
Method to remove the ownership of local broker on the
NamespaceBundle, if owned |
CompletableFuture<Void> |
removeOwnership(NamespaceBundles bundles)
Method to remove ownership of all owned bundles
|
CompletableFuture<NamespaceEphemeralData> |
tryAcquiringOwnership(NamespaceBundle bundle)
Method to get the current owner of the
ServiceUnit or set the local broker as the owner if absent |
CompletableFuture<Void> |
updateBundleState(NamespaceBundle bundle,
boolean isActive)
Update bundle state in a local cache
|
public OwnershipCache(PulsarService pulsar, NamespaceBundleFactory bundleFactory, NamespaceService namespaceService)
OwnershipCacheownerUrl - the local broker URL that will be set as owner for the ServiceUnitpublic CompletableFuture<Boolean> checkOwnership(NamespaceBundle bundle)
bundle - namespace bundlepublic CompletableFuture<Optional<NamespaceEphemeralData>> getOwnerAsync(NamespaceBundle suName)
ServiceUnitsuName - name of the ServiceUnitZooKeeperException - throws exception if no ownership info is foundpublic CompletableFuture<NamespaceEphemeralData> tryAcquiringOwnership(NamespaceBundle bundle) throws Exception
ServiceUnit or set the local broker as the owner if absentbundle - the NamespaceBundleZooKeeperExceptionpublic CompletableFuture<Void> removeOwnership(NamespaceBundle bundle)
NamespaceBundle, if ownedpublic CompletableFuture<Void> removeOwnership(NamespaceBundles bundles)
bundles - NamespaceBundles to remove from ownership cachepublic Map<String,OwnedBundle> getOwnedBundles()
ServiceUnit objects owned by the local brokerServiceUnit objectspublic boolean isNamespaceBundleOwned(NamespaceBundle bundle)
bundle - public OwnedBundle getOwnedBundle(NamespaceBundle bundle)
OwnedBundle instance from the local cache. Does not block.bundle - public CompletableFuture<Void> disableOwnership(NamespaceBundle bundle)
bundle - Exceptionpublic CompletableFuture<Void> updateBundleState(NamespaceBundle bundle, boolean isActive)
bundle - Exceptionpublic void invalidateLocalOwnerCache()
public NamespaceEphemeralData getSelfOwnerInfo()
public boolean refreshSelfOwnerInfo()
Copyright © 2017–2021 Apache Software Foundation. All rights reserved.