gpt4 book ai didi

org.apache.helix.manager.zk.ZKHelixDataAccessor.getProperty()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-14 06:25:31 25 4
gpt4 key购买 nike

本文整理了Java中org.apache.helix.manager.zk.ZKHelixDataAccessor.getProperty()方法的一些代码示例,展示了ZKHelixDataAccessor.getProperty()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKHelixDataAccessor.getProperty()方法的具体详情如下:
包路径:org.apache.helix.manager.zk.ZKHelixDataAccessor
类名称:ZKHelixDataAccessor
方法名:getProperty

ZKHelixDataAccessor.getProperty介绍

暂无

代码示例

代码示例来源:origin: apache/incubator-pinot

LiveInstance controllerLeaderLiveInstance = zkHelixDataAccessor.getProperty(controllerLeaderKey);
ControllerInfo controllerInfo = new ControllerInfo();
controllerInfo.leaderName = controllerLeaderLiveInstance.getId();

代码示例来源:origin: apache/helix

@Deprecated
@Override
public <T extends HelixProperty> List<T> getProperty(List<PropertyKey> keys) {
 return getProperty(keys, false);
}

代码示例来源:origin: org.apache.helix/helix-core

@Deprecated
@Override
public <T extends HelixProperty> List<T> getProperty(List<PropertyKey> keys) {
 return getProperty(keys, false);
}

代码示例来源:origin: org.apache.helix/helix-core

private ParticipantHistory getHistory() {
 PropertyKey propertyKey = _keyBuilder.participantHistory(_instanceName);
 ParticipantHistory history = _dataAccessor.getProperty(propertyKey);
 if (history == null) {
  history = new ParticipantHistory(_instanceName);
 }
 return history;
}

代码示例来源:origin: apache/helix

private ParticipantHistory getHistory() {
 PropertyKey propertyKey = _keyBuilder.participantHistory(_instanceName);
 ParticipantHistory history = _dataAccessor.getProperty(propertyKey);
 if (history == null) {
  history = new ParticipantHistory(_instanceName);
 }
 return history;
}

代码示例来源:origin: apache/helix

@Override
public <T extends HelixProperty> List<T> getProperty(List<PropertyKey> keys) {
 for (PropertyKey key : keys) {
  addCount(key);
 }
 return super.getProperty(keys);
}

代码示例来源:origin: apache/helix

@Override
public <T extends HelixProperty> T getProperty(PropertyKey key) {
 addCount(key);
 return super.getProperty(key);
}

代码示例来源:origin: apache/helix

@Override
public <T extends HelixProperty> List<T> getProperty(List<PropertyKey> keys, boolean throwException) {
 for (PropertyKey key : keys) {
  addCount(key);
 }
 return super.getProperty(keys, throwException);
}

代码示例来源:origin: apache/helix

public static String getInstancePropertyAsString(ZkClient zkClient, String clusterName,
  PropertyKey propertyKey, MediaType mediaType) throws JsonGenerationException,
  JsonMappingException, IOException {
 ZKHelixDataAccessor accessor =
   new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(zkClient));
 ZNRecord records = accessor.getProperty(propertyKey).getRecord();
 return ZNRecordToJson(records);
}

代码示例来源:origin: apache/helix

public static String getPropertyAsString(ZkClient zkClient, String clusterName,
  PropertyKey propertyKey, MediaType mediaType) throws JsonGenerationException,
  JsonMappingException, IOException {
 ZKHelixDataAccessor accessor =
   new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(zkClient));
 ZNRecord record = EMPTY_ZNRECORD;
 HelixProperty property = accessor.getProperty(propertyKey);
 if (property != null) {
  record = property.getRecord();
 }
 return ObjectToJson(record);
}

代码示例来源:origin: apache/helix

@Override
 public boolean verify() {
  LiveInstance liveInstance = accessor.getProperty(keyBuilder.controllerLeader());
  if (liveInstance != null) {
   // disconnect the current leader manager
   managerList.remove(liveInstance.getInstanceName()).disconnect();
   return true;
  } else {
   return false;
  }
 }
}, 1000));

代码示例来源:origin: apache/helix

public static String getClusterPropertyAsString(ZkClient zkClient, String clusterName,
  MediaType mediaType, PropertyKey propertyKey) throws JsonGenerationException,
  JsonMappingException, IOException {
 ZKHelixDataAccessor accessor =
   new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(zkClient));
 HelixProperty property = accessor.getProperty(propertyKey);
 ZNRecord record = property == null ? null : property.getRecord();
 return ZNRecordToJson(record);
}

代码示例来源:origin: apache/helix

@Override
 public boolean verify() {
  LiveInstance liveInstance = accessor.getProperty(keyBuilder.controllerLeader());
  return liveInstance != null && controllerName.equals(liveInstance.getInstanceName())
    && manager.getSessionId().equals(liveInstance.getSessionId());
 }
}, 1000));

代码示例来源:origin: apache/helix

public static String getInstanceSessionId(ZkClient zkClient, String clusterName,
  String instanceName) {
 ZKHelixDataAccessor accessor =
   new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(zkClient));
 Builder keyBuilder = accessor.keyBuilder();
 ZNRecord liveInstance = accessor.getProperty(keyBuilder.liveInstance(instanceName)).getRecord();
 return liveInstance.getSimpleField(LiveInstanceProperty.SESSION_ID.toString());
}

代码示例来源:origin: apache/helix

@Override
 public boolean verify() {
  // Newly created node should have a new creating time but with old session.
  LiveInstance invalidLeaderNode = accessor.getProperty(keyBuilder.controllerLeader());
  // node exist
  if (invalidLeaderNode == null)
   return false;
  // node is newly created
  if (invalidLeaderNode.getStat().getCreationTime() == originalCreationTime)
   return false;
  // node has the same session as the old one, so it's invalid
  if (!invalidLeaderNode.getSessionId().equals(originalSessionId))
   return false;
  return true;
 }
}, 2000));

代码示例来源:origin: org.apache.helix/helix-core

@Override
public void removeInstanceTag(String clusterName, String instanceName, String tag) {
 logger.info("Remove instance tag {} for instance {} in cluster {}.", tag, instanceName,
   clusterName);
 if (!ZKUtil.isClusterSetup(clusterName, _zkClient)) {
  throw new HelixException("cluster " + clusterName + " is not setup yet");
 }
 if (!ZKUtil.isInstanceSetup(_zkClient, clusterName, instanceName, InstanceType.PARTICIPANT)) {
  throw new HelixException(
    "cluster " + clusterName + " instance " + instanceName + " is not setup yet");
 }
 ZKHelixDataAccessor accessor =
   new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_zkClient));
 Builder keyBuilder = accessor.keyBuilder();
 InstanceConfig config = accessor.getProperty(keyBuilder.instanceConfig(instanceName));
 config.removeTag(tag);
 accessor.setProperty(keyBuilder.instanceConfig(instanceName), config);
}

代码示例来源:origin: apache/helix

protected String getCurrentLeader(HelixZkClient zkClient, String clusterName) {
 ZKHelixDataAccessor accessor =
   new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(zkClient));
 Builder keyBuilder = accessor.keyBuilder();
 LiveInstance leader = accessor.getProperty(keyBuilder.controllerLeader());
 if (leader == null) {
  return null;
 }
 return leader.getInstanceName();
}

代码示例来源:origin: apache/helix

public void verifyReplication(HelixZkClient zkClient, String clusterName, String resource, int repl) {
 ZKHelixDataAccessor accessor =
   new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(zkClient));
 Builder keyBuilder = accessor.keyBuilder();
 IdealState idealState = accessor.getProperty(keyBuilder.idealStates(resource));
 for (String partitionName : idealState.getPartitionSet()) {
  if (idealState.getRebalanceMode() == IdealState.RebalanceMode.SEMI_AUTO) {
   AssertJUnit.assertEquals(repl, idealState.getPreferenceList(partitionName).size());
  } else if (idealState.getRebalanceMode() == IdealState.RebalanceMode.CUSTOMIZED) {
   AssertJUnit.assertEquals(repl, idealState.getInstanceStateMap(partitionName).size());
  }
 }
}

代码示例来源:origin: apache/helix

public void verifyEnabled(HelixZkClient zkClient, String clusterName, String instance,
  boolean wantEnabled) {
 ZKHelixDataAccessor accessor =
   new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(zkClient));
 Builder keyBuilder = accessor.keyBuilder();
 InstanceConfig config = accessor.getProperty(keyBuilder.instanceConfig(instance));
 AssertJUnit.assertEquals(wantEnabled, config.getInstanceEnabled());
}

代码示例来源:origin: apache/helix

private void clearStatusUpdate(String clusterName, String instance, String resource,
  String partition) {
 // clear status update for error partition so verify() will not fail on old
 // errors
 ZKHelixDataAccessor accessor =
   new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_gZkClient));
 Builder keyBuilder = accessor.keyBuilder();
 LiveInstance liveInstance = accessor.getProperty(keyBuilder.liveInstance(instance));
 accessor.removeProperty(keyBuilder.stateTransitionStatus(instance, liveInstance.getSessionId(),
   resource, partition));
}
// TODO: throw exception in reset()

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com