当前位置: 首页>>代码示例>>Java>>正文


Java Cache.getMembers方法代码示例

本文整理汇总了Java中com.gemstone.gemfire.cache.Cache.getMembers方法的典型用法代码示例。如果您正苦于以下问题:Java Cache.getMembers方法的具体用法?Java Cache.getMembers怎么用?Java Cache.getMembers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.gemstone.gemfire.cache.Cache的用法示例。


在下文中一共展示了Cache.getMembers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getRegionAssociatedMembers

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
public static Set<DistributedMember> getRegionAssociatedMembers(
    String region, final Cache cache, boolean returnAll) {

  DistributedMember member = null;

  if (region == null || region.isEmpty())
    return null;

  DistributedRegionMXBean bean = ManagementService
      .getManagementService(cache).getDistributedRegionMXBean(region);

  if (bean == null)// try with slash ahead
    bean = ManagementService.getManagementService(cache)
        .getDistributedRegionMXBean(Region.SEPARATOR + region);

  if (bean == null) {
    return null;
  }

  String[] membersName = bean.getMembers();
  Set<DistributedMember> dsMembers = cache.getMembers();
  Set<DistributedMember> dsMembersWithThisMember = new HashSet<DistributedMember>();
  dsMembersWithThisMember.addAll(dsMembers);
  dsMembersWithThisMember.add(cache.getDistributedSystem()
      .getDistributedMember());
  Iterator it = dsMembersWithThisMember.iterator();
  Set<DistributedMember> matchedMembers = new HashSet<DistributedMember>();

  if (membersName.length > 0) {
    while (it.hasNext()) {
      DistributedMember dsmember = (DistributedMember) it.next();
      for (String memberName : membersName) {
        String name = MBeanJMXAdapter.getMemberNameOrId(dsmember);
        if (name.equals(memberName)) {
          member = dsmember;
          matchedMembers.add(member);
          if (!returnAll) {
            return matchedMembers;
          }
        }
      }
    }
  }
  return matchedMembers;
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:47,代码来源:DataCommands.java

示例2: getMembers

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
/**
 * Gets all members in the GemFire distributed system/cache.
 * </p>
 * @param cache the GemFire cache.
 * @return all members in the GemFire distributed system/cache.
 * @see com.gemstone.gemfire.management.internal.cli.CliUtil#getAllMembers(com.gemstone.gemfire.cache.Cache)
 * @deprecated use CliUtil.getAllMembers(com.gemstone.gemfire.cache.Cache) instead
 */
@Deprecated
protected Set<DistributedMember> getMembers(final Cache cache) {
  final Set<DistributedMember> members = new HashSet<DistributedMember>(cache.getMembers());
  members.add(cache.getDistributedSystem().getDistributedMember());
  return members;
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:15,代码来源:AbstractCommandsSupport.java


注:本文中的com.gemstone.gemfire.cache.Cache.getMembers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。