本文整理汇总了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;
}
示例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;
}