Package net.sf.katta.util

Examples of net.sf.katta.util.KattaException


        if (i > 0) {
          LOG.error("Loaded shard:" + shardPath);
        }
        return;
      } catch (final URISyntaxException e) {
        throw new KattaException("Can not parse uri for path: " + shardPath, e);
      } catch (final Exception e) {
        LOG.error(String.format("Error loading shard: %s (try %d of %d)", shardPath, i, maxTries), e);
        if (i >= maxTries - 1) {
          throw new KattaException("Can not load shard: " + shardPath, e);
        }
      }
    }
  }
View Full Code Here


          error = e.error;
        }
      }
    }
    if (error != null) {
      return new KattaException("Error", error);
    } else {
      return null;
    }
  }
View Full Code Here

    if (indices == null) {
      indices = ALL_INDICES;
    }
    Map<String, List<String>> nodeShardsMap = getNode2ShardsMap(indices);
    if (nodeShardsMap.values().isEmpty()) {
      throw new KattaException("No shards for indices: "
              + (indices != null ? Arrays.asList(indices).toString() : "null"));
    }
    return broadcastInternal(resultPolicy, method, shardArrayIndex, nodeShardsMap, args);
  }
View Full Code Here

        shards.addAll(indexShards);
      }
    }
    final Map<String, List<String>> nodeShardsMap = _selectionPolicy.createNode2ShardsMap(shards);
    if (nodeShardsMap.values().isEmpty()) {
      throw new KattaException("No shards selected: " + shards);
    }
    return broadcastInternal(resultPolicy, method, shardArrayParamIndex, nodeShardsMap, args);
  }
View Full Code Here

          LOG.warn("No shards found for index name/pattern: " + index);
        }
      }
    }
    if (allShards.isEmpty()) {
      throw new KattaException("Index [pattern(s)] '" + Arrays.toString(indexNames)
              + "' do not match to any deployed index: " + getIndices());
    }
    return allShards;
  }
View Full Code Here

    final String deployPolicyClassName = masterConfiguration.getDeployPolicy();
    try {
      final Class<IDeployPolicy> policyClazz = (Class<IDeployPolicy>) Class.forName(deployPolicyClassName);
      _deployPolicy = policyClazz.newInstance();
    } catch (final Exception e) {
      throw new KattaException("Unable to instantiate deploy policy", e);
    }

    _safeModeMaxTime = masterConfiguration.getInt(MasterConfiguration.SAFE_MODE_MAX_TIME);
  }
View Full Code Here

  public void run() {
    String methodDesc = null;
    try {
      VersionedProtocol proxy = _shardManager.getProxy(_node, false);
      if (proxy == null) {
        throw new KattaException("No proxy for node: " + _node);
      }
      if (_shardArrayIndex >= 0) {
        // We need to pass the list of shards to the server's method.
        _args[_shardArrayIndex] = _shards.toArray(new String[_shards.size()]);
      }
      long startTime = 0;
      if (LOG.isTraceEnabled()) {
        methodDesc = describeMethodCall(_method, _args, _node);
        LOG.trace(String.format("About to invoke %s using proxy %s (id=%d)", methodDesc, Proxy
                .getInvocationHandler(proxy), instanceId));
        startTime = System.currentTimeMillis();
      }
      T result = (T) _method.invoke(proxy, _args);
      _shardManager.reportNodeCommunicationSuccess(_node);
      if (LOG.isTraceEnabled()) {
        LOG.trace(String.format("Calling %s returned %s, took %d msec (id=%d)", methodDesc, resultToString(result),
                (System.currentTimeMillis() - startTime), instanceId));
        String methodDesc2 = describeMethodCall(_method, _args, _node);
        if (!methodDesc.equals(methodDesc2)) {
          LOG.error(String.format("Method call changed from %s to %s (id=%d)", methodDesc, methodDesc2, instanceId));
        }
      }
      _result.addResult(result, _shards);
    } catch (Throwable t) {
      // Notify the work queue, so it can mark the node as down.
      _shardManager.reportNodeCommunicationFailure(_node, t);
      if (_tryCount >= _maxTryCount) {
        LOG.error(String.format("Error calling %s (try # %d of %d) (id=%d)", (methodDesc != null ? methodDesc : _method
                + " on " + _node), _tryCount, _maxTryCount, instanceId), t);
        _result.addError(new KattaException(String.format("%s for shards %s failed (id=%d)",
                getClass().getSimpleName(), _shards, instanceId), t), _shards);
        return;
      }
      if (!_result.isClosed()) {
        try {
View Full Code Here

    for (Future<MapWritable> future : futures) {
      try {
        results.add(future.get());
      } catch (ExecutionException e) {
        throw new KattaException("Could not get hit details.", e.getCause());
      }
    }

    executorService.shutdown();
View Full Code Here

TOP

Related Classes of net.sf.katta.util.KattaException

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.