Package com.linkedin.helix

Examples of com.linkedin.helix.HelixException


    for (String op : ops)
    {
      logger.debug("op: " + op);
      if (!operatorMap.containsKey(op.toUpperCase()))
      {
        throw new HelixException("<" + op + "> is not a valid operator type");
      }
      Operator currOpType = operatorMap.get(op.toUpperCase());
      if (currNumTuples < currOpType.minInputTupleLists
          || currNumTuples > currOpType.maxInputTupleLists)
      {
        throw new HelixException("<" + op + "> cannot process " + currNumTuples
            + " input tuples");
      }
      // reset num tuples to this op's output size
      if (!currOpType.inputOutputTupleListsCountsEqual)
      { // if equal, this number does not change
        currNumTuples = currOpType.numOutputTupleLists;
      }
    }
    if (currNumTuples != 1)
    {
      throw new HelixException(expression
          + " does not terminate in a single tuple set");
    }
    return ops;
  }
View Full Code Here


  public static Operator getOperator(String opName) throws HelixException
  {
    if (!operatorMap.containsKey(opName))
    {
      throw new HelixException(opName + " is unknown op type");
    }
    return operatorMap.get(opName);
  }
View Full Code Here

    int lastPos = colonFormat.lastIndexOf(":");
    if (lastPos <= 0)
    {
      String error = "Invalid storage Instance info format: " + colonFormat;
      LOG.warn(error);
      throw new HelixException(error);
    }
    String host = colonFormat.substring(0, lastPos);
    String portStr = colonFormat.substring(lastPos + 1);
    return host + "_" + portStr;
  }
View Full Code Here

                                        parameterMap.get(key));
        }
      }
      else
      {
        throw new HelixException("Unsupported command: " + command
            + ". Should be one of [" + ClusterSetup.addIdealState + ", "
            + ClusterSetup.rebalance + ", " + ClusterSetup.expandResource + ", "
            + ClusterSetup.addResourceProperty + "]");
      }
View Full Code Here

      _statusUpdateUtil.logError(message,
                                 HelixStateTransitionHandler.class,
                                 errorMessage,
                                 manager.getHelixDataAccessor());
      logger.error(errorMessage);
      throw new HelixException(errorMessage);
    }
    // DataAccessor accessor = manager.getDataAccessor();
    HelixDataAccessor accessor = manager.getHelixDataAccessor();

    String partitionName = message.getPartitionName();
View Full Code Here

        accessor.setProperty(accessor.keyBuilder().stateModelDef(newStateModel.getId()),
                             new StateModelDefinition(newStateModel));
      }
      else
      {
        throw new HelixException("Unsupported command: " + command
            + ". Should be one of [" + ClusterSetup.addStateModelDef + "]");
      }
      getResponse().setEntity(getStateModelRepresentation(clusterName, modelName));
      getResponse().setStatus(Status.SUCCESS_OK);
    }
View Full Code Here

      JsonParameters jsonParameters = new JsonParameters(entity);
      String command = jsonParameters.getCommand();

      if (command == null)
      {
        throw new HelixException("Could NOT find 'command' in parameterMap: " + jsonParameters._parameterMap);
      }
      else if (command.equalsIgnoreCase(ClusterSetup.activateCluster)
          || JsonParameters.CLUSTERSETUP_COMMAND_ALIASES.get(ClusterSetup.activateCluster)
                                                        .contains(command))
      {
        jsonParameters.verifyCommand(ClusterSetup.activateCluster);

        boolean enabled = true;
        if (jsonParameters.getParameter(JsonParameters.ENABLED) != null)
        {
          enabled =
              Boolean.parseBoolean(jsonParameters.getParameter(JsonParameters.ENABLED));
        }

        String grandCluster = jsonParameters.getParameter(JsonParameters.GRAND_CLUSTER);

        setupTool.activateCluster(clusterName, grandCluster, enabled);
      }
      else if (command.equalsIgnoreCase(ClusterSetup.expandCluster))
      {
        setupTool.expandCluster(clusterName);
      }
      else
      {
        throw new HelixException("Unsupported command: " + command
            + ". Should be one of [" + ClusterSetup.activateCluster + ", "
            + ClusterSetup.expandCluster + "]");
      }
      getResponse().setEntity(getClusterRepresentation(clusterName));
      getResponse().setStatus(Status.SUCCESS_OK);
View Full Code Here

    }
    if (lastPos <= 0)
    {
      String error = "Invalid storage Instance info format: " + InstanceAddress;
      _logger.warn(error);
      throw new HelixException(error);
    }
    String host = InstanceAddress.substring(0, lastPos);
    String portStr = InstanceAddress.substring(lastPos + 1);
    int port = Integer.parseInt(portStr);
    addInstanceToCluster(clusterName, host, port);
View Full Code Here

    }
    if (lastPos <= 0)
    {
      String error = "Invalid storage Instance info format: " + InstanceAddress;
      _logger.warn(error);
      throw new HelixException(error);
    }
    String host = InstanceAddress.substring(0, lastPos);
    String portStr = InstanceAddress.substring(lastPos + 1);
    int port = Integer.parseInt(portStr);
    dropInstanceFromCluster(clusterName, host, port);
View Full Code Here

                                          jsonParameters.getParameter(JsonParameters.INSTANCE_NAMES)
                                                        .split(";"));
        }
        else
        {
          throw new HelixException("Missing Json paramaters: '"
              + JsonParameters.INSTANCE_NAME + "' or '" + JsonParameters.INSTANCE_NAMES
              + "' ");
        }
      }
      else if (command.equalsIgnoreCase(ClusterSetup.swapInstance))
      {
        if (jsonParameters.getParameter(JsonParameters.NEW_INSTANCE) == null
            || jsonParameters.getParameter(JsonParameters.OLD_INSTANCE) == null)
        {
          throw new HelixException("Missing Json paramaters: '"
              + JsonParameters.NEW_INSTANCE + "' or '" + JsonParameters.OLD_INSTANCE
              + "' ");
        }
        setupTool.swapInstance(clusterName,
                               jsonParameters.getParameter(JsonParameters.OLD_INSTANCE),
                               jsonParameters.getParameter(JsonParameters.NEW_INSTANCE));
      }
      else
      {
        throw new HelixException("Unsupported command: " + command
            + ". Should be one of [" + ClusterSetup.addInstance + ", "
            + ClusterSetup.swapInstance + "]");
      }

      getResponse().setEntity(getInstancesRepresentation(clusterName));
View Full Code Here

TOP

Related Classes of com.linkedin.helix.HelixException

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.