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


Java DistributedMember.getId方法代码示例

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


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

import org.apache.geode.distributed.DistributedMember; //导入方法依赖的package包/类
public IndexDetails(final DistributedMember member, final Index index) {
  this(member.getId(), index.getRegion().getFullPath(), index.getName());

  setFromClause(index.getFromClause());
  setIndexedExpression(index.getIndexedExpression());
  setIndexType(index.getType());
  setMemberName(member.getName());
  setProjectionAttributes(index.getProjectionAttributes());
  setRegionName(index.getRegion().getName());

  if (index.getStatistics() != null) {
    setIndexStatisticsDetails(createIndexStatisticsDetails(index.getStatistics()));
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:15,代码来源:IndexDetails.java

示例6: 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

示例7: testShowMetricsMember

import org.apache.geode.distributed.DistributedMember; //导入方法依赖的package包/类
@Category(FlakyTest.class) // GEODE-1764
@Test
public void testShowMetricsMember()
    throws ClassNotFoundException, IOException, InterruptedException {
  systemSetUp();
  Cache cache = getCache();
  final DistributedMember distributedMember = cache.getDistributedSystem().getDistributedMember();
  final String exportFileName = "memberMetricReport.csv";

  int ports[] = AvailablePortHelper.getRandomAvailableTCPPorts(1);
  CacheServer cs = getCache().addCacheServer();
  cs.setPort(ports[0]);
  cs.start();
  final int cacheServerPort = cs.getPort();

  SerializableCallable showMetricCmd = new SerializableCallable() {
    @Override
    public Object call() throws Exception {

      WaitCriterion wc = createMBeanWaitCriterion(3, "", distributedMember, 0);
      waitForCriterion(wc, 5000, 500, true);
      wc = createMBeanWaitCriterion(5, "", distributedMember, cacheServerPort);
      waitForCriterion(wc, 10000, 500, true);

      final String command = CliStrings.SHOW_METRICS + " --" + CliStrings.SHOW_METRICS__MEMBER
          + "=" + distributedMember.getId() + " --" + CliStrings.SHOW_METRICS__CACHESERVER__PORT
          + "=" + cacheServerPort + " --" + CliStrings.SHOW_METRICS__FILE + "=" + exportFileName;

      CommandProcessor commandProcessor = new CommandProcessor();
      Result result =
          commandProcessor.createCommandStatement(command, Collections.EMPTY_MAP).process();
      String resultAsString = commandResultToString((CommandResult) result);
      assertEquals(resultAsString, true, result.getStatus().equals(Status.OK));
      assertTrue(result.hasIncomingFiles());
      result.saveIncomingFiles(null);
      File file = new File(exportFileName);
      file.deleteOnExit();
      assertTrue(file.exists());
      file.delete();
      return resultAsString;

    }
  };

  // Invoke the command in the Manager VM
  final VM managerVm = Host.getHost(0).getVM(0);
  Object managerResultObj = managerVm.invoke(showMetricCmd);

  String managerResult = (String) managerResultObj;

  getLogWriter().info("#SB Manager");
  getLogWriter().info(managerResult);
  cs.stop();
}
 
开发者ID:ampool,项目名称:monarch,代码行数:55,代码来源:ShowMetricsDUnitTest.java


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