12.07.2015 Views

VisiBroker Edition

VisiBroker Edition

VisiBroker Edition

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

集 群 标 准Cluster create_cluster(in string algo);Cluster find_cluster(in CosNaming::NamingContext ctx, in CosNaming::Namen)raises(ClusterNotFound, CosNaming::NamingContext::CannotProceed,CosNaming::NamingContext::InvalidName);Cluster find_cluster_str(in CosNaming::NamingContext ctx, in string n)raises(ClusterNotFound, CosNaming::NamingContext::CannotProceed,CosNaming::NamingContext::InvalidName);ClusterList clusters();};};创 建 集 群要 创 建 一 个 集 群 , 您 可 以 使 用 集 群 管 理 器 接 口 。 启 动 命 名 服 务 时 , 会 自 动 创 建 单 一的 ClusterManager 对 象 。 每 个 命 名 服 务 中 仅 有 一 个 ClusterManager。ClusterManager 功 能 是 创 建 、 检 索 和 追 踪 命 名 服 务 中 的 集 群 。1 限 制 到 您 要 用 以 创 建 集 群 对 象 的 命 名 服 务 器 。2 调 用 工 厂 引 用 上 的 get_cluster_manager 方 法 , 以 取 得 集 群 管 理 器 的 引 用 。3 使 用 指 定 的 集 群 标 准 来 创 建 集 群 。4 将 对 象 限 制 到 使 用 集 群 的 名 称 上 。5 将 Cluster 对 象 本 身 限 制 到 一 个 名 称 。6 通 过 指 定 的 集 群 标 准 的 集 群 引 用 来 解 析 。C++: . . .ExtendedNamingContextFactory_var myFactory =ExtendedNamingContextFactory::_bind(orb, "NamingService");ClusterManager_var clusterMgr = myFactory->get_cluster_manager();Cluster_var clusterObj = clusterMgr->create_cluster("RoundRobin");clusterObj->bind(new NameComponent("member1", "aCluster"), obj1);clusterObj->bind(new NameComponent("member2", "aCluster"), obj2);clusterObj->bind(new NameComponent("member3", "aCluster"), obj3);NameComponent_var myClusterName = new NameComponent("ClusterName", "");root->bind(myClusterName, clusterObj);root->resolve(myClusterName); // 返 回 集 群 的 一 个 成 员root->resolve(myClusterName); // 返 回 集 群 的 下 一 个 成 员root->resolve(myClusterName); // 返 回 集 群 的 最 后 一 个 成 员. . .Java: . . .ExtendedNamingContextFactory myFactory =ExtendedNamingContextFactoryHelper.bind(orb, "NamingService");ClusterManager clusterMgr = myFactory.get_cluster_manager();Cluster clusterObj = clusterMgr.create_cluster("RoundRobin");clusterObj.bind(new NameComponent("member1", "aCluster"), obj1);clusterObj.bind(new NameComponent("member2", "aCluster"), obj2);clusterObj.bind(new NameComponent("member3", "aCluster"), obj3);NameComponent myClusterName = new NameComponent("ClusterName", "");root.bind(myClusterName, clusterObj);14-20 <strong>VisiBroker</strong> 开 发 者 指 南

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!