Examples of HelixProperty


Examples of org.apache.helix.HelixProperty

    }
    boolean succeed =
        accessor.setProperty(keyBuilder.idealStates("TestDB_1"),
                                                              idealState);
    Assert.assertFalse(succeed);
    HelixProperty property =
        accessor.getProperty(keyBuilder.idealStates("TestDB_1"));
    Assert.assertNull(property);

    // legal sized data gets written to zk
    idealState.getRecord().getSimpleFields().clear();
View Full Code Here

Examples of org.apache.helix.HelixProperty

      String date = dateFormat.format(new Date());

      HelixDataAccessor accessor = manager.getHelixDataAccessor();
      Builder keyBuilder = accessor.keyBuilder();

      HelixProperty property = accessor.getProperty(keyBuilder.alertHistory());
      ZNRecord alertFiredHistory;
      if(property == null)
      {
        alertFiredHistory = new ZNRecord(PropertyType.ALERT_HISTORY.toString());
      }
      else
      {
        alertFiredHistory = property.getRecord();
      }
      while(alertFiredHistory.getMapFields().size() >= ALERT_HISTORY_SIZE)
      {
        // ZNRecord uses TreeMap which is sorted ascending internally
        String firstKey = (String)(alertFiredHistory.getMapFields().keySet().toArray()[0]);
View Full Code Here

Examples of org.apache.helix.HelixProperty

        List<T> result = new ArrayList<T>();
        PropertyType type = key.getType();
        Class<? extends HelixProperty> clazz = key.getTypeClass();
        if (type == PropertyType.EXTERNALVIEW)
        {
          HelixProperty typedInstance = HelixProperty.convertToTypedInstance(clazz, _externalView);
          result.add((T) typedInstance);
          return result;
        }
        else if (type == PropertyType.LIVEINSTANCES)
        {
View Full Code Here

Examples of org.apache.helix.HelixProperty

    _setupTool.getClusterManagementTool().addAlert(CLUSTER_NAME, _alertStr2);

    int historySize = 0;
    HelixDataAccessor helixDataAccessor = manager.getHelixDataAccessor();
    Builder keyBuilder = helixDataAccessor.keyBuilder();
    HelixProperty property = helixDataAccessor.getProperty(keyBuilder.alertHistory());
    ZNRecord history = null;
    if(property != null)
    {
      history = property.getRecord();
      historySize = property.getRecord().getMapFields().size();
    }
   
    HealthStatsAggregationTask task = new HealthStatsAggregationTask(_startCMResultMap.get(controllerName)._manager);
    task.run();
    Thread.sleep(100);
View Full Code Here

Examples of org.apache.helix.HelixProperty

        PropertyType type = key.getType();
        List<T> result = new ArrayList<T>();
        Class<? extends HelixProperty> clazz = key.getTypeClass();
        if(type == PropertyType.EXTERNALVIEW || type == PropertyType.IDEALSTATES)
        {
          HelixProperty typedInstance = HelixProperty.convertToTypedInstance(clazz, _externalView);
          result.add((T) typedInstance);
          return result;
        }
        else if(type == PropertyType.LIVEINSTANCES)
        {
View Full Code Here

Examples of org.apache.helix.HelixProperty

      public <T extends HelixProperty> List<T> getChildValues(PropertyKey key) {
        PropertyType type = key.getType();
        List<T> result = new ArrayList<T>();
        Class<? extends HelixProperty> clazz = key.getTypeClass();
        if (type == PropertyType.EXTERNALVIEW || type == PropertyType.IDEALSTATES) {
          HelixProperty typedInstance = HelixProperty.convertToTypedInstance(clazz, _externalView);
          result.add((T) typedInstance);
          return result;
        } else if (type == PropertyType.LIVEINSTANCES) {
          return (List<T>) HelixProperty.convertToTypedList(clazz, _liveInstances);
        }
View Full Code Here

Examples of org.apache.helix.HelixProperty

      Map<String, ZNRecord> currentStates = new HashMap<String, ZNRecord>();
      List<ZNRecord> instanceCurrentStateList = new ArrayList<ZNRecord>();
      for (ZNRecord idealState : idealStateList) {
        String resourceName = idealState.getId();

        HelixProperty property =
            accessor.getProperty(keyBuilder.currentState(host, sessionId, resourceName));
        ZNRecord currentState = null;
        if (property == null) {
          _logger.warn("Resource " + resourceName + " has null currentState");
          currentState = new ZNRecord(resourceName);
        } else {
          currentState = property.getRecord();
        }
        currentStates.put(resourceName, currentState);
        instanceCurrentStateList.add(currentState);
      }
      currentStatesMap.put(host, currentStates);
View Full Code Here

Examples of org.apache.helix.HelixProperty

  }

  private void createISSpec(HelixDataAccessor accessor, String specId, String stateModelDefRef,
      RebalanceMode rebalanceMode) {
    PropertyKey propertyKey = accessor.keyBuilder().clusterConfig();
    HelixProperty property = accessor.getProperty(propertyKey);
    if (property == null) {
      property = new HelixProperty("sampleClusterConfig");
    }
    String key = "IdealStateRule!" + specId;
    String value =
        IdealStateProperty.REBALANCE_MODE.toString() + "=" + rebalanceMode.toString() + ","
            + IdealStateProperty.STATE_MODEL_DEF_REF.toString() + "=" + stateModelDefRef;
    property.getRecord().setSimpleField(key, value);
    accessor.setProperty(propertyKey, property);
  }
View Full Code Here

Examples of org.apache.helix.HelixProperty

    for (int i = 0; i < 1024; i++) {
      idealState.getRecord().setSimpleField(i + "", bufStr);
    }
    boolean succeed = accessor.setProperty(keyBuilder.idealStates("TestDB0"), idealState);
    Assert.assertFalse(succeed);
    HelixProperty property =
        accessor.getProperty(keyBuilder.stateTransitionStatus("localhost_12918", "session_1",
            "partition_1"));
    Assert.assertNull(property);

    // legal sized data gets written to zk
View Full Code Here

Examples of org.apache.helix.HelixProperty

    for (int i = 0; i < 1024; i++) {
      idealState.getRecord().setSimpleField(i + "", bufStr);
    }
    boolean succeed = accessor.setProperty(keyBuilder.idealStates("TestDB_1"), idealState);
    Assert.assertFalse(succeed);
    HelixProperty property = accessor.getProperty(keyBuilder.idealStates("TestDB_1"));
    Assert.assertNull(property);

    // legal sized data gets written to zk
    idealState.getRecord().getSimpleFields().clear();
    idealState.setStateModelDefRef("MasterSlave");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.