Package org.apache.helix.model

Examples of org.apache.helix.model.Resource


        String resourceName = idealState.getResourceName();

        for (String partition : partitionSet)
        {
          addPartition(partition, resourceName, resourceMap);
          Resource resource = resourceMap.get(resourceName);
          resource.setStateModelDefRef(idealState.getStateModelDefRef());
          resource.setStateModelFactoryName(idealState.getStateModelFactoryName());
          resource.setBucketSize(idealState.getBucketSize());
          resource.setBatchMessageMode(idealState.getBatchMessageMode());
        }
      }
    }

    // It's important to get partitions from CurrentState as well since the
    // idealState might be removed.
    Map<String, LiveInstance> availableInstances = cache.getLiveInstances();

    if (availableInstances != null && availableInstances.size() > 0)
    {
      for (LiveInstance instance : availableInstances.values())
      {
        String instanceName = instance.getInstanceName();
        String clientSessionId = instance.getSessionId();

        Map<String, CurrentState> currentStateMap = cache.getCurrentState(instanceName,
            clientSessionId);
        if (currentStateMap == null || currentStateMap.size() == 0)
        {
          continue;
        }
        for (CurrentState currentState : currentStateMap.values())
        {

          String resourceName = currentState.getResourceName();
          Map<String, String> resourceStateMap = currentState.getPartitionStateMap();

          // don't overwrite ideal state settings
          if (!resourceMap.containsKey(resourceName))
          {
            addResource(resourceName, resourceMap);
            Resource resource = resourceMap.get(resourceName);
            resource.setStateModelDefRef(currentState.getStateModelDefRef());
            resource.setStateModelFactoryName(currentState.getStateModelFactoryName());
            resource.setBucketSize(currentState.getBucketSize());
            resource.setBatchMessageMode(currentState.getBatchMessageMode());
          }
         
          if (currentState.getStateModelDefRef() == null)
          {
            LOG.error("state model def is null." + "resource:" + currentState.getResourceName()
View Full Code Here


    {
      return;
    }
    if (!resourceMap.containsKey(resource))
    {
      resourceMap.put(resource, new Resource(resource));
    }
  }
View Full Code Here

    {
      return;
    }
    if (!resourceMap.containsKey(resourceName))
    {
      resourceMap.put(resourceName, new Resource(resourceName));
    }
    Resource resource = resourceMap.get(resourceName);
    resource.addPartition(partition);

  }
View Full Code Here

TOP

Related Classes of org.apache.helix.model.Resource

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.