Package org.apache.helix

Examples of org.apache.helix.HelixProperty


      PropertyType type = key.getType();
      String path = key.getPath();
      paths.add(path);
      options = constructOptions(type);

      HelixProperty value = children.get(i);

      switch (type)
      {
      case EXTERNALVIEW:
        if (value.getBucketSize() == 0)
        {
          records.add(value.getRecord());
        }
        else
        {
          _baseDataAccessor.remove(path, options);

          ZNRecord metaRecord = new ZNRecord(value.getId());
          metaRecord.setSimpleFields(value.getRecord().getSimpleFields());
          records.add(metaRecord);

          ZNRecordBucketizer bucketizer = new ZNRecordBucketizer(value.getBucketSize());

          Map<String, ZNRecord> map = bucketizer.bucketize(value.getRecord());
          List<String> childBucketizedPaths = new ArrayList<String>();
          List<ZNRecord> childBucketizedRecords = new ArrayList<ZNRecord>();
          for (String bucketName : map.keySet())
          {
            childBucketizedPaths.add(path + "/" + bucketName);
            childBucketizedRecords.add(map.get(bucketName));
          }
          bucketizedPaths.set(i, childBucketizedPaths);
          bucketizedRecords.set(i, childBucketizedRecords);
        }
        break;
      default:
        records.add(value.getRecord());
        break;
      }
    }

    // set non-bucketized nodes or parent nodes of bucketized nodes
View Full Code Here


            // check if bucketized
          BaseDataAccessor<ZNRecord> baseAccessor = new ZkBaseDataAccessor<ZNRecord>(_zkClient);
          List<ZNRecord> records = baseAccessor.getChildren(path, null, 0);
          for (ZNRecord record : records)
          {
                HelixProperty property = new HelixProperty(record);
              String childPath = path + "/" + record.getId();

                int bucketSize = property.getBucketSize();
                if (bucketSize > 0)
                {
                  // subscribe both data-change and child-change on bucketized parent node
                  // data-change gives a delete-callback which is used to remove watch
                  subscribeChildChange(childPath, context);
View Full Code Here

      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

TOP

Related Classes of org.apache.helix.HelixProperty

Copyright © 2018 www.massapicom. 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.