Package org.apache.drill.exec.rpc

Examples of org.apache.drill.exec.rpc.RpcException


    FutureHandler f = new FutureHandler();
    try {
      client.connect(f, endpoint, props, getUserCredentials());
      f.checkedGet();
    } catch (InterruptedException e) {
      throw new RpcException(e);
    }
  }
View Full Code Here


      getInner().set(null);
    }

    @Override
    public void connectionFailed(FailureType type, Throwable t) {
      getInner().setException(new RpcException(String.format("Failure connecting to server. Failure of type %s.", type.name()), t));
    }
View Full Code Here

    SendBatchAsyncListen b = new SendBatchAsyncListen(outcomeListener, batch);
    try{
      sendingSemaphore.acquire();
      manager.runCommand(b);
    }catch(InterruptedException e){
      outcomeListener.failed(new RpcException("Interrupted while trying to get sending semaphore.", e));
    }
  }
View Full Code Here

    SendBatchAsyncFuture b = new SendBatchAsyncFuture(batch, context);
    try{
      sendingSemaphore.acquire();
      manager.runCommand(b);
    }catch(InterruptedException e){
      b.connectionFailed(FailureType.CONNECTION, new RpcException("Interrupted while trying to get sending semaphore.", e));
    }
    return b.getFuture();
  }
View Full Code Here

      }
    }

    if(failed) {
      String message = buildErrorMessage(batch);
      l.submissionFailed(new RpcException(message));
      resultsListener.remove(result.getQueryId(), l);
    }else{
      try {
        l.resultArrived(batch, throttle);
      } catch (Exception e) {
        batch.release();
        l.submissionFailed(new RpcException(e));
      }
    }

    if (
        (failed || result.getIsLastChunk())
View Full Code Here

    return sb.toString();
  }

  private void failAll() {
    for (UserResultsListener l : resultsListener.values()) {
      l.submissionFailed(new RpcException("Received result without QueryId"));
    }
  }
View Full Code Here

      logger.debug("Received query to run.  Returning query handle.");
      try {
        RunQuery query = RunQuery.PARSER.parseFrom(new ByteBufInputStream(pBody));
        return new Response(RpcType.QUERY_HANDLE, worker.submitWork(connection, query));
      } catch (InvalidProtocolBufferException e) {
        throw new RpcException("Failure while decoding RunQuery body.", e);
      }

    case RpcType.REQUEST_RESULTS_VALUE:
      logger.debug("Received results requests.  Returning empty query result.");
      try {
        RequestResults req = RequestResults.PARSER.parseFrom(new ByteBufInputStream(pBody));
        return new Response(RpcType.QUERY_RESULT, worker.getResult(connection, req));
      } catch (InvalidProtocolBufferException e) {
        throw new RpcException("Failure while decoding RequestResults body.", e);
      }

    case RpcType.CANCEL_QUERY_VALUE:
      try {
        QueryId queryId = QueryId.PARSER.parseFrom(new ByteBufInputStream(pBody));
        return new Response(RpcType.ACK, worker.cancelQuery(queryId));
      } catch (InvalidProtocolBufferException e) {
        throw new RpcException("Failure while decoding QueryId body.", e);
      }

    default:
      throw new UnsupportedOperationException(String.format("UserServer received rpc of unknown type.  Type was %d.", rpcType));
    }
View Full Code Here

      @Override
      public MessageLite getHandshakeResponse(UserToBitHandshake inbound) throws Exception {
        logger.trace("Handling handshake from user to bit. {}", inbound);
        if(inbound.getRpcVersion() != UserRpcConfig.RPC_VERSION) {
          throw new RpcException(String.format("Invalid rpc version. Expected %d, actual %d.", inbound.getRpcVersion(), UserRpcConfig.RPC_VERSION));
        }

        connection.setUser(inbound);

        return BitToUserHandshake.newBuilder().setRpcVersion(UserRpcConfig.RPC_VERSION).build();
View Full Code Here

    case RpcType.QUERY_HANDLE_VALUE:
      return QueryId.getDefaultInstance();
    case RpcType.QUERY_RESULT_VALUE:
      return QueryResult.getDefaultInstance();
    }
    throw new RpcException(String.format("Unable to deal with RpcType of %d", rpcType));
  }
View Full Code Here

    switch (rpcType) {
    case RpcType.QUERY_RESULT_VALUE:
      queryResultHandler.batchArrived(throttle, pBody, dBody);
      return new Response(RpcType.ACK, Ack.getDefaultInstance());
    default:
      throw new RpcException(String.format("Unknown Rpc Type %d. ", rpcType));
    }

  }
View Full Code Here

TOP

Related Classes of org.apache.drill.exec.rpc.RpcException

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.