當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。