/** * Method to remove ownership of all owned bundles * * @param bundles * <code>NamespaceBundles</code> to remove from ownership cache */ public CompletableFuture<Void> removeOwnership(NamespaceBundles bundles) { List<CompletableFuture<Void>> allFutures = Lists.newArrayList(); for (NamespaceBundle bundle : bundles.getBundles()) { if (getOwnedBundle(bundle) == null) { // continue continue; } allFutures.add(this.removeOwnership(bundle)); } return FutureUtil.waitForAll(allFutures); }
NamespaceBundles bundles = pulsar().getNamespaceService().getNamespaceBundleFactory().getBundles(nsName); Exception exception = null; for (NamespaceBundle nsBundle : bundles.getBundles()) { try {
NamespaceBundles bundles = pulsar().getNamespaceService().getNamespaceBundleFactory().getBundles(nsName); Exception exception = null; for (NamespaceBundle nsBundle : bundles.getBundles()) { try {
if (splitPartition != -1) { NamespaceBundles splittedNsBundles = new NamespaceBundles(nsname, partitions, this); List<NamespaceBundle> splittedBundles = splittedNsBundles.getBundles().subList(splitPartition, (splitPartition + numBundles)); return new ImmutablePair<NamespaceBundles, List<NamespaceBundle>>(splittedNsBundles, splittedBundles);
NamespaceBundles bundles = pulsar().getNamespaceService().getNamespaceBundleFactory().getBundles(nsName); Exception exception = null; for (NamespaceBundle nsBundle : bundles.getBundles()) { try {
/** * Checks whether the broker is the owner of all the namespace bundles. Otherwise, if authoritative is false, it * will throw an exception to redirect to assigned owner or leader; if authoritative is true then it will try to * acquire all the namespace bundles. * * @param fqnn * @param authoritative * @param readOnly * @param bundleData */ protected void validateNamespaceOwnershipWithBundles(String property, String cluster, String namespace, boolean authoritative, boolean readOnly, BundlesData bundleData) { NamespaceName fqnn = new NamespaceName(property, cluster, namespace); try { NamespaceBundles bundles = pulsar().getNamespaceService().getNamespaceBundleFactory().getBundles(fqnn, bundleData); for (NamespaceBundle bundle : bundles.getBundles()) { validateBundleOwnership(bundle, authoritative, readOnly); } } catch (WebApplicationException wae) { // propagate already wrapped-up WebApplicationExceptions throw wae; } catch (Exception oe) { log.debug(String.format("Failed to find owner for namespace %s", fqnn), oe); throw new RestException(oe); } }
for (NamespaceBundle bundle : bundles.getBundles()) {