Examples of ZkVersion


Examples of org.apache.bookkeeper.meta.ZkVersion

         */
        private void parseAndReturnTopicLedgerRanges(ByteString topic, byte[] data, int version,
                                                     Callback<Versioned<LedgerRanges>> callback, Object ctx) {
            try {
                Versioned<LedgerRanges> ranges = new Versioned<LedgerRanges>(LedgerRanges.parseFrom(data),
                                                                             new ZkVersion(version));
                callback.operationFinished(ctx, ranges);
                return;
            } catch (InvalidProtocolBufferException e) {
                String msg = "Ledger ranges for topic:" + topic.toStringUtf8() + " could not be deserialized";
                logger.error(msg, e);
View Full Code Here

Examples of org.apache.bookkeeper.meta.ZkVersion

                                             path, rc);
                        callback.operationFailed(ctx, new PubSubException.ServiceDownException(ke));
                        return;
                    }
                    // initial version is version 0
                    callback.operationFinished(ctx, new ZkVersion(0));
                }
            }, ctx);
            return;
        }
View Full Code Here

Examples of org.apache.bookkeeper.meta.ZkVersion

                            // bad version
                            callback.operationFailed(ctx, PubSubException.create(StatusCode.BAD_VERSION,
                                                          "Bad version provided to update persistence info of topic " + topic.toStringUtf8()));
                            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));
View Full Code Here

Examples of org.apache.bookkeeper.meta.ZkVersion

                        if (logger.isDebugEnabled()) {
                            logger.debug("Successfully recorded subscription for topic: " + topic.toStringUtf8()
                                         + " 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

Examples of org.apache.bookkeeper.meta.ZkVersion

                            logger.debug("Successfully updated subscription for topic: " + topic.toStringUtf8()
                                         + " subscriberId: " + subscriberId.toStringUtf8() + " data: "
                                         + SubscriptionStateUtils.toString(data));
                        }

                        callback.operationFinished(ctx, new ZkVersion(stat.getVersion()));
                    }
                }
            }, ctx);
        }
View Full Code Here

Examples of org.apache.bookkeeper.meta.ZkVersion

                   
                    Versioned<SubscriptionData> subData;
                    try {
                        subData = new Versioned<SubscriptionData>(
                                        SubscriptionStateUtils.parseSubscriptionData(data),
                                        new ZkVersion(stat.getVersion()));
                    } catch (InvalidProtocolBufferException ex) {
                        String msg = "Failed to deserialize subscription data for topic: " + topic.toStringUtf8()
                                     + " subscriberId: " + subscriberId.toStringUtf8();
                        logger.error(msg, ex);
                        callback.operationFailed(ctx, new PubSubException.UnexpectedConditionException(msg));
View Full Code Here

Examples of org.apache.bookkeeper.meta.ZkVersion

                                Versioned<SubscriptionData> subData;
                                try {
                                    subData = new Versioned<SubscriptionData>(
                                            SubscriptionStateUtils.parseSubscriptionData(data),
                                            new ZkVersion(stat.getVersion()));
                                } catch (InvalidProtocolBufferException ex) {
                                    String msg = "Failed to deserialize subscription data for topic: " + topic.toStringUtf8()
                                                 + " subscriberId: " + subscriberId.toStringUtf8();
                                    logger.error(msg, ex);
                                    reportFailure(new PubSubException.UnexpectedConditionException(msg));
View Full Code Here

Examples of org.apache.bookkeeper.meta.ZkVersion

                        owner = HubInfo.parse(new String(data));
                    } catch (HubInfo.InvalidHubInfoException ihie) {
                        logger.warn("Failed to parse hub info for topic " + topic.toStringUtf8() + " : ", ihie);
                    }
                    int version = stat.getVersion();
                    callback.operationFinished(ctx, new Versioned<HubInfo>(owner, new ZkVersion(version)));
                    return;
                }
            }, ctx);
        }
View Full Code Here

Examples of org.apache.bookkeeper.meta.ZkVersion

                        // bad version
                        callback.operationFailed(ctx, PubSubException.create(StatusCode.BAD_VERSION,
                                                      "Bad version provided to update owner info of topic " + topic.toStringUtf8()));
                        return;
                    } else if (Code.OK.intValue() == rc) {
                        callback.operationFinished(ctx, new ZkVersion(stat.getVersion()));
                        return;
                    } else {
                        KeeperException e = ZkUtils.logErrorAndCreateZKException(
                            "Failed to update ownership of topic " + topic.toStringUtf8() +
                            " to " + owner, path, rc);
View Full Code Here

Examples of org.apache.bookkeeper.meta.ZkVersion

                                             CreateMode.PERSISTENT, new SafeAsyncZKCallback.StringCallback() {
                @Override
                public void safeProcessResult(int rc, String path, Object ctx, String name) {
                    if (Code.OK.intValue() == rc) {
                        // assume the initial version is 0
                        callback.operationFinished(ctx, new ZkVersion(0));
                        return;
                    } else if (Code.NODEEXISTS.intValue() == rc) {
                        // node existed
                        callback.operationFailed(ctx, PubSubException.create(StatusCode.TOPIC_OWNER_INFO_EXISTS,
                                                      "Owner info of topic " + topic.toStringUtf8() + " existed."));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.