Package org.apache.zookeeper

Examples of org.apache.zookeeper.KeeperException$InvalidACLException


                            return;
                        } else if (rc == Code.OK.intValue()) {
                            callback.operationFinished(ctx, new ZkVersion(stat.getVersion()));
                            return;
                        } else {
                            KeeperException ke = ZkUtils.logErrorAndCreateZKException(
                                    "Could not write ledgers node for topic: " + topic.toStringUtf8(), path, rc);
                            callback.operationFailed(ctx, new PubSubException.ServiceDownException(ke));
                            return;
                        }
                    }
View Full Code Here


                        callback.operationFailed(ctx, PubSubException.create(StatusCode.BAD_VERSION,
                                                      "Bad version provided to delete persistence info of topic " + topic.toStringUtf8()));
                        return;
                    }

                    KeeperException e = ZkUtils.logErrorAndCreateZKException("Topic: " + topic.toStringUtf8()
                                        + " failed to delete persistence info @version " + version + " : ", path, rc);
                    callback.operationFailed(ctx, new PubSubException.ServiceDownException(e));
                }
            }, ctx);
        }
View Full Code Here

                    cb.operationFinished(ctx, null);
                    return;
                }

                if (rc != Code.OK.intValue()) {
                    KeeperException e = ZkUtils.logErrorAndCreateZKException(
                                            "Failed to delete self-ownership node for topic: " + topic.toStringUtf8(), path, rc);
                    cb.operationFailed(ctx, new PubSubException.ServiceDownException(e));
                    return;
                }

                String hubInfoStr = new String(data);
                try {
                    HubInfo ownerHubInfo = HubInfo.parse(hubInfoStr);
                    HedwigSocketAddress owner = ownerHubInfo.getAddress();
                    if (!owner.equals(addr)) {
                        logger.warn("Wanted to delete self-node for topic: " + topic.toStringUtf8() + " but node for "
                                    + owner + " found, leaving untouched");
                        // Not our node, someone else's, leave it alone
                        cb.operationFinished(ctx, null);
                        return;
                    }
                } catch (HubInfo.InvalidHubInfoException ihie) {
                    logger.info("Invalid hub info " + hubInfoStr + " found when release topic "
                              + topic.toStringUtf8() + ". Leaving untouched until next acquire action.");
                    cb.operationFinished(ctx, null);
                    return;
                }

                zk.delete(path, stat.getVersion(), new SafeAsyncZKCallback.VoidCallback() {
                    @Override
                    public void safeProcessResult(int rc, String path, Object ctx) {
                        if (rc != Code.OK.intValue() && rc != Code.NONODE.intValue()) {
                            KeeperException e = ZkUtils
                                                .logErrorAndCreateZKException("Failed to delete self-ownership node for topic: "
                                                        + topic.toStringUtf8(), path, rc);
                            cb.operationFailed(ctx, new PubSubException.ServiceDownException(e));
                            return;
                        }
View Full Code Here

                        claimOrChoose();
                        return;
                    }

                    if (rc != Code.OK.intValue()) {
                        KeeperException e = ZkUtils.logErrorAndCreateZKException("Could not read ownership for topic: "
                                            + topic.toStringUtf8(), path, rc);
                        cb.operationFailed(ctx, new PubSubException.ServiceDownException(e));
                        return;
                    }

                    // successfully did a read
                    try {
                        HubInfo ownerHubInfo = HubInfo.parse(new String(data));
                        HedwigSocketAddress owner = ownerHubInfo.getAddress();
                        if (!owner.equals(addr)) {
                            if (logger.isDebugEnabled()) {
                                logger.debug("topic: " + topic.toStringUtf8() + " belongs to someone else: " + owner);
                            }
                            cb.operationFinished(ctx, owner);
                            return;
                        }
                        logger.info("Discovered stale self-node for topic: " + topic.toStringUtf8() + ", will delete it");
                    } catch (HubInfo.InvalidHubInfoException ihie) {
                        logger.info("Discovered invalid hub info for topic: " + topic.toStringUtf8() + ", will delete it : ", ihie);
                    }

                    // we must have previously failed and left a
                    // residual ephemeral node here, so we must
                    // delete it (clean it up) and then
                    // re-create/re-acquire the topic.
                    zk.delete(hubPath, stat.getVersion(), new VoidCallback() {
                        @Override
                        public void processResult(int rc, String path, Object ctx) {
                            if (Code.OK.intValue() == rc || Code.NONODE.intValue() == rc) {
                                claimOrChoose();
                            } else {
                                KeeperException e = ZkUtils.logErrorAndCreateZKException(
                                                        "Could not delete self node for topic: " + topic.toStringUtf8(), path, rc);
                                cb.operationFailed(ctx, new PubSubException.ServiceDownException(e));
                            }
                        }
                    }, ctx);
View Full Code Here

                        notifyListenersAndAddToOwnedTopics(topic, cb, ctx);
                        hubManager.uploadSelfLoadData(myHubLoad.setNumTopics(topics.size()));
                    } else if (rc == Code.NODEEXISTS.intValue()) {
                        read();
                    } else {
                        KeeperException e = ZkUtils.logErrorAndCreateZKException(
                                                "Failed to create ephemeral node to claim ownership of topic: "
                                                + topic.toStringUtf8(), path, rc);
                        cb.operationFailed(ctx, new PubSubException.ServiceDownException(e));
                    }
                }
View Full Code Here

                                         + " subscriberId: " + subscriberId.toStringUtf8() + " data: "
                                         + SubscriptionStateUtils.toString(data));
                        }
                        callback.operationFinished(ctx, new ZkVersion(0));
                    } else {
                        KeeperException ke = ZkUtils.logErrorAndCreateZKException(
                                                 "Could not record new subscription for topic: " + topic.toStringUtf8()
                                                 + " subscriberId: " + subscriberId.toStringUtf8(), path, rc);
                        callback.operationFailed(ctx, new PubSubException.ServiceDownException(ke));
                    }
                }
View Full Code Here

                        callback.operationFailed(ctx, PubSubException.create(StatusCode.BAD_VERSION,
                                                      "Bad version provided to replace subscription data of topic "
                                                      + topic.toStringUtf8() + " subscriberId " + subscriberId));
                        return;
                    } else if (rc != Code.OK.intValue()) {
                        KeeperException e = ZkUtils.logErrorAndCreateZKException("Topic: " + topic.toStringUtf8()
                                            + " subscriberId: " + subscriberId.toStringUtf8()
                                            + " could not set subscription data: " + SubscriptionStateUtils.toString(data),
                                            path, rc);
                        callback.operationFailed(ctx, new PubSubException.ServiceDownException(e));
                    } else {
View Full Code Here

                        callback.operationFinished(ctx, null);
                        return;
                    }

                    KeeperException e = ZkUtils.logErrorAndCreateZKException("Topic: " + topic.toStringUtf8()
                                        + " subscriberId: " + subscriberId.toStringUtf8() + " failed to delete subscription", path, rc);
                    callback.operationFailed(ctx, new PubSubException.ServiceDownException(e));
                }
            }, ctx);
        }
View Full Code Here

                    if (rc == Code.NONODE.intValue()) {
                        callback.operationFinished(ctx, null);
                        return;
                    }
                    if (rc != Code.OK.intValue()) {
                        KeeperException e = ZkUtils.logErrorAndCreateZKException(
                                                "Could not read subscription data for topic: " + topic.toStringUtf8()
                                                + ", subscriberId: " + subscriberId.toStringUtf8(), path, rc);
                        callback.operationFailed(ctx, new PubSubException.ServiceDownException(e));
                        return;
                    }
View Full Code Here

            zk.getChildren(topicSubscribersPath, false, new SafeAsyncZKCallback.ChildrenCallback() {
                @Override
                public void safeProcessResult(int rc, String path, final Object ctx, final List<String> children) {

                    if (rc != Code.OK.intValue() && rc != Code.NONODE.intValue()) {
                        KeeperException e = ZkUtils.logErrorAndCreateZKException("Could not read subscribers for topic "
                                            + topic.toStringUtf8(), path, rc);
                        cb.operationFailed(ctx, new PubSubException.ServiceDownException(e));
                        return;
                    }

                    final Map<ByteString, Versioned<SubscriptionData>> topicSubs =
                            new ConcurrentHashMap<ByteString, Versioned<SubscriptionData>>();

                    if (rc == Code.NONODE.intValue() || children.size() == 0) {
                        if (logger.isDebugEnabled()) {
                            logger.debug("No subscriptions found while acquiring topic: " + topic.toStringUtf8());
                        }
                        cb.operationFinished(ctx, topicSubs);
                        return;
                    }

                    final AtomicBoolean failed = new AtomicBoolean();
                    final AtomicInteger count = new AtomicInteger();

                    for (final String child : children) {

                        final ByteString subscriberId = ByteString.copyFromUtf8(child);
                        final String childPath = path + "/" + child;

                        zk.getData(childPath, false, new SafeAsyncZKCallback.DataCallback() {
                            @Override
                            public void safeProcessResult(int rc, String path, Object ctx, byte[] data, Stat stat) {

                                if (rc != Code.OK.intValue()) {
                                    KeeperException e = ZkUtils.logErrorAndCreateZKException(
                                                            "Could not read subscription data for topic: " + topic.toStringUtf8()
                                                            + ", subscriberId: " + subscriberId.toStringUtf8(), path, rc);
                                    reportFailure(new PubSubException.ServiceDownException(e));
                                    return;
                                }
View Full Code Here

TOP

Related Classes of org.apache.zookeeper.KeeperException$InvalidACLException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.