@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);
  }
Esempio n. 2
0
 /**
  * Returns the locator if it exists in this JVM. Otherwise returns null.
  *
  * @return the locator that exists in this JVM; null if no locator.
  * @since 7.0
  */
 public static Locator getLocator() {
   return InternalLocator.getLocator();
 }