Package com.linkedin.helix

Examples of com.linkedin.helix.HelixException


    @Override
    public MessageHandler createHandler(Message message,
        NotificationContext context)
    {
      throw new HelixException("Exception");
    }
View Full Code Here


 
  public static AlertComparator getComparator(String compName)
  {
    compName = compName.replaceAll("\\s+", ""); //remove white space
    if (!comparatorMap.containsKey(compName)) {
      throw new HelixException("Comparator type <"+compName+"> unknown");
    }
    return comparatorMap.get(compName);
  }
View Full Code Here

  public static String getComponent(String component, String alert) throws HelixException
  {
    //find EXP and keep going until paren are closed
    int expStartPos = alert.indexOf(component);
    if (expStartPos < 0) {
      throw new HelixException(alert+" does not contain component "+component);
    }
    expStartPos += (component.length()+1); //advance length of string and one for open paren
    int expEndPos = expStartPos;
    int openParenCount = 1;
    while (openParenCount > 0) {
      if (alert.charAt(expEndPos) == '(') {
        openParenCount++;
      }
      else if (alert.charAt(expEndPos) == ')') {
        openParenCount--;
      }
      expEndPos++;
    }
    if (openParenCount != 0) {
      throw new HelixException(alert+" does not contain valid "+component+" component, " +
          "parentheses do not close");
    }
    //return what is in between paren
    return alert.substring(expStartPos, expEndPos-1);
  }
View Full Code Here

    //separately validate each portion
    ExpressionParser.validateExpression(exp);
   
    //validate comparator
    if (!comparatorMap.containsKey(cmp.toUpperCase())) {
      throw new HelixException("Unknown comparator type "+cmp);
    }
    String actionValue = null;
    try
    {
      actionValue = AlertParser.getComponent(AlertParser.ACTION_NAME, alert);
View Full Code Here

      String validActions = "";
      for (ActionOnError action : ActionOnError.values())
      {
        validActions = validActions + action + " ";
      }
      throw new HelixException("Unknown cmd type " + actionValue + ", valid types : " + validActions);
    }
  }
View Full Code Here

    double mergedVal;
    double mergedTime;
   
    if (currValTup == null || newValTup == null || currTimeTup == null ||
        newTimeTup == null) {
      throw new HelixException("Tuples cannot be null");
    }
   
    //old tuples may be empty, indicating no value/time exist
    if (currValTup.size() > 0 && currTimeTup.size() > 0) {
      currVal = Double.parseDouble(currValTup.iterator().next());
View Full Code Here

  @Override
  public boolean setProperty(PropertyType type, HelixProperty value, String... keys)
  {
    if (!value.isValid())
    {
      throw new HelixException("The ZNRecord for " + type + " is not valid.");
    }
    return setProperty(type, value.getRecord(), keys);
  }
View Full Code Here

      Map<String, String> existingStat, Map<String, String> incomingStat)
      throws HelixException
  {
    if (existingStat == null)
    {
      throw new HelixException("existing stat for merge is null");
    }
    if (incomingStat == null)
    {
      throw new HelixException("incoming stat for merge is null");
    }
    // get agg type and arguments, then get agg object
    String aggTypeStr = ExpressionParser.getAggregatorStr(statName);
    String[] aggArgs = ExpressionParser.getAggregatorArgs(statName);
    Aggregator agg = ExpressionParser.getAggregator(aggTypeStr);
    // XXX: some of below lines might fail with null exceptions

    // get timestamps, values out of zk maps
    String existingTime = existingStat.get(TIMESTAMP_NAME);
    String existingVal = existingStat.get(VALUE_NAME);
    String incomingTime = incomingStat.get(TIMESTAMP_NAME);
    String incomingVal = incomingStat.get(VALUE_NAME);
    // parse values into tuples, if the values exist. else, tuples are null
    Tuple<String> existingTimeTuple = (existingTime != null) ? Tuple
        .fromString(existingTime) : null;
    Tuple<String> existingValueTuple = (existingVal != null) ? Tuple
        .fromString(existingVal) : null;
    Tuple<String> incomingTimeTuple = (incomingTime != null) ? Tuple
        .fromString(incomingTime) : null;
    Tuple<String> incomingValueTuple = (incomingVal != null) ? Tuple
        .fromString(incomingVal) : null;

    // dp merge
    agg.merge(existingValueTuple, incomingValueTuple, existingTimeTuple,
        incomingTimeTuple, aggArgs);
    // put merged tuples back in map
    Map<String, String> mergedMap = new HashMap<String, String>();
    if (existingTimeTuple.size() == 0)
    {
      throw new HelixException("merged time tuple has size zero");
    }
    if (existingValueTuple.size() == 0)
    {
      throw new HelixException("merged value tuple has size zero");
    }

    mergedMap.put(TIMESTAMP_NAME, existingTimeTuple.toString());
    mergedMap.put(VALUE_NAME, existingValueTuple.toString());
    return mergedMap;
View Full Code Here

  {
    if (!_handlerFactoryMap.containsKey(type))
    {
      if (!type.equalsIgnoreCase(factory.getMessageType()))
      {
        throw new HelixException("Message factory type mismatch. Type: " + type
            + " factory : " + factory.getMessageType());

      }
      _handlerFactoryMap.put(type, factory);
      _threadpoolMap.put(type, Executors.newFixedThreadPool(threadpoolSize));
View Full Code Here

                                           String instanceName,
                                           Map<String, String> taskResultMap)
  {
    if (srcMessage.getCorrelationId() == null)
    {
      throw new HelixException("Message " + srcMessage.getMsgId()
          + " does not contain correlation id");
    }
    Message replyMessage =
        new Message(MessageType.TASK_REPLY, UUID.randomUUID().toString());
    replyMessage.setCorrelationId(srcMessage.getCorrelationId());
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.