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


Java DistributedMember.getName方法代码示例

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


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

示例1: listStandAloneLocatorMembers

import org.apache.geode.distributed.DistributedMember; //导入方法依赖的package包/类
private String[] listStandAloneLocatorMembers() {
  String[] locatorMembers = ManagementConstants.NO_DATA_STRING;

  Set<DistributedMember> members = new HashSet<DistributedMember>();
  members.add(system.getDistributedMember());
  members.addAll(system.getAllOtherMembers());

  if (!members.isEmpty()) {
    Set<String> locatorMemberSet = new TreeSet<String>();
    for (DistributedMember member : members) {
      if (DistributionManager.LOCATOR_DM_TYPE == ((InternalDistributedMember) member)
          .getVmKind()) {
        String name = member.getName();
        name = name != null && !name.trim().isEmpty() ? name : member.getId();
        locatorMemberSet.add(name);
      }
    }
    locatorMembers = locatorMemberSet.toArray(locatorMembers);
    members.clear();
    locatorMemberSet.clear();
  }

  return locatorMembers;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:25,代码来源:DistributedSystemBridge.java

示例2: getMemberNameOrId

import org.apache.geode.distributed.DistributedMember; //导入方法依赖的package包/类
public static String getMemberNameOrId(DistributedMember distributedMember) {
  String nameOrId = null;
  if (distributedMember != null) {
    nameOrId = distributedMember.getName();
    nameOrId = nameOrId != null && !nameOrId.isEmpty() ? nameOrId : distributedMember.getId();
  }
  return nameOrId;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:9,代码来源:CliUtil.java

示例3: execute

import org.apache.geode.distributed.DistributedMember; //导入方法依赖的package包/类
@Override
public void execute(FunctionContext context) {
  InternalLocator locator = InternalLocator.getLocator();
  GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
  DistributedMember member = cache.getDistributedSystem().getDistributedMember();
  SharedConfigurationStatus status = locator.getSharedConfigurationStatus().getStatus();

  String memberId = member.getName();
  if (StringUtils.isBlank(memberId)) {
    memberId = member.getId();
  }

  CliFunctionResult result = new CliFunctionResult(memberId, new String[] {status.name()});
  context.getResultSender().lastResult(result);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:16,代码来源:FetchSharedConfigurationStatusFunction.java

示例4: execute

import org.apache.geode.distributed.DistributedMember; //导入方法依赖的package包/类
@Override
public void execute(FunctionContext context) {
  // Declared here so that it's available when returning a Throwable
  String memberId = "";
  try {
    final Object[] args = (Object[]) context.getArguments();
    final String diskStoreName = (String) args[0];
    final DiskStoreAttributes diskStoreAttrs = (DiskStoreAttributes) args[01];

    GemFireCacheImpl cache = (GemFireCacheImpl) CacheFactory.getAnyInstance();

    DistributedMember member = cache.getDistributedSystem().getDistributedMember();

    memberId = member.getId();
    // If they set a name use it instead
    if (!member.getName().equals("")) {
      memberId = member.getName();
    }

    DiskStoreFactory diskStoreFactory = cache.createDiskStoreFactory(diskStoreAttrs);
    diskStoreFactory.create(diskStoreName);

    XmlEntity xmlEntity = new XmlEntity(CacheXml.DISK_STORE, "name", diskStoreName);
    context.getResultSender().lastResult(new CliFunctionResult(memberId, xmlEntity, "Success"));

  } catch (CacheClosedException cce) {
    context.getResultSender().lastResult(new CliFunctionResult(memberId, false, null));

  } catch (VirtualMachineError e) {
    SystemFailure.initiateFailure(e);
    throw e;

  } catch (Throwable th) {
    SystemFailure.checkFailure();
    logger.error("Could not create disk store: {}", th.getMessage(), th);
    context.getResultSender().lastResult(new CliFunctionResult(memberId, th, null));
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:39,代码来源:CreateDiskStoreFunction.java

示例5: execute

import org.apache.geode.distributed.DistributedMember; //导入方法依赖的package包/类
public void execute(final FunctionContext context) {
  Cache cache = getCache();

  try {
    if (cache instanceof InternalCache) {
      InternalCache gemfireCache = (InternalCache) cache;

      DistributedMember member = gemfireCache.getMyId();

      String diskStoreName = (String) context.getArguments();
      String memberId = member.getId();
      String memberName = member.getName();

      DiskStore diskStore = gemfireCache.findDiskStore(diskStoreName);

      if (diskStore != null) {
        DiskStoreDetails diskStoreDetails = new DiskStoreDetails(diskStore.getDiskStoreUUID(),
            diskStore.getName(), memberId, memberName);

        diskStoreDetails.setAllowForceCompaction(diskStore.getAllowForceCompaction());
        diskStoreDetails.setAutoCompact(diskStore.getAutoCompact());
        diskStoreDetails.setCompactionThreshold(diskStore.getCompactionThreshold());
        diskStoreDetails.setMaxOplogSize(diskStore.getMaxOplogSize());
        diskStoreDetails.setQueueSize(diskStore.getQueueSize());
        diskStoreDetails.setTimeInterval(diskStore.getTimeInterval());
        diskStoreDetails.setWriteBufferSize(diskStore.getWriteBufferSize());
        diskStoreDetails.setDiskUsageWarningPercentage(diskStore.getDiskUsageWarningPercentage());
        diskStoreDetails
            .setDiskUsageCriticalPercentage(diskStore.getDiskUsageCriticalPercentage());

        setDiskDirDetails(diskStore, diskStoreDetails);
        setRegionDetails(gemfireCache, diskStore, diskStoreDetails);
        setCacheServerDetails(gemfireCache, diskStore, diskStoreDetails);
        setGatewayDetails(gemfireCache, diskStore, diskStoreDetails);
        setPdxSerializationDetails(gemfireCache, diskStore, diskStoreDetails);
        setAsyncEventQueueDetails(gemfireCache, diskStore, diskStoreDetails);

        context.getResultSender().lastResult(diskStoreDetails);
      } else {
        context.getResultSender()
            .sendException(new DiskStoreNotFoundException(
                String.format("A disk store with name (%1$s) was not found on member (%2$s).",
                    diskStoreName, memberName)));
      }
    }
  } catch (Exception e) {
    logger.error("Error occurred while executing 'describe disk-store': {}!", e.getMessage(), e);
    context.getResultSender().sendException(e);
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:51,代码来源:DescribeDiskStoreFunction.java

示例6: getMemberNameOrId

import org.apache.geode.distributed.DistributedMember; //导入方法依赖的package包/类
/**
 * This method returns the name that will be used for a DistributedMember when it is registered as
 * a JMX bean.
 * 
 * @param member Member to find the name for
 * @return The name used to register this member as a JMX bean.
 */
public static String getMemberNameOrId(DistributedMember member) {
  if (member.getName() != null && !member.getName().equals("")) {
    return makeCompliantName(member.getName());
  }
  return makeCompliantName(member.getId());
}
 
开发者ID:ampool,项目名称:monarch,代码行数:14,代码来源:MBeanJMXAdapter.java


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