Package org.apache.drill.exec.rpc

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


        failAll();
      }
    }
     
    if(failed){
      l.submissionFailed(new RpcException("Remote failure while running query." + batch.getHeader().getErrorList()));
      resultsListener.remove(result.getQueryId(), l);
    }else{
      l.resultArrived(batch);
    }
   
View Full Code Here


  }

  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);
      }

    default:
      throw new UnsupportedOperationException();
    }
View Full Code Here

    return new ServerHandshakeHandler<UserToBitHandshake>(RpcType.HANDSHAKE, UserToBitHandshake.PARSER){

      @Override
      public MessageLite getHandshakeResponse(UserToBitHandshake inbound) throws Exception {
        logger.debug("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));
        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(pBody, dBody);
      return new Response(RpcType.ACK, Ack.getDefaultInstance());
    default:
      throw new RpcException(String.format("Unknown Rpc Type %d. ", rpcType));
    }

  }
View Full Code Here

  @Override
  protected void validateHandshake(BitToUserHandshake inbound) throws RpcException {
    logger.debug("Handling handshake from bit to user. {}", inbound);
    if (inbound.getRpcVersion() != UserRpcConfig.RPC_VERSION)
      throw new RpcException(String.format("Invalid rpc version.  Expected %d, actual %d.", inbound.getRpcVersion(),
          UserRpcConfig.RPC_VERSION));

  }
View Full Code Here

      try {
        FragmentRecordBatch header = get(pBody, FragmentRecordBatch.PARSER);
        incomingRecordBatch(connection, header, dBody);
        return BitRpcConfig.OK;
      } catch (FragmentSetupException e) {
        throw new RpcException("Failure receiving record batch.", e);
      }

    default:
      throw new RpcException("Not yet supported.");
    }

  }
View Full Code Here

    return new ServerHandshakeHandler<BitHandshake>(RpcType.HANDSHAKE, BitHandshake.PARSER){
     
      @Override
      public MessageLite getHandshakeResponse(BitHandshake inbound) throws Exception {
//        logger.debug("Handling handshake from other bit. {}", inbound);
        if(inbound.getRpcVersion() != BitRpcConfig.RPC_VERSION) throw new RpcException(String.format("Invalid rpc version.  Expected %d, actual %d.", inbound.getRpcVersion(), BitRpcConfig.RPC_VERSION));
        if(!inbound.hasEndpoint() || inbound.getEndpoint().getAddress().isEmpty() || inbound.getEndpoint().getBitPort() < 1) throw new RpcException(String.format("RPC didn't provide valid counter endpoint information.  Received %s.", inbound.getEndpoint()));
        connection.setEndpoint(inbound.getEndpoint());

        // add the
        BitConnectionManager manager = connectionRegistry.getConnectionManager(inbound.getEndpoint());
       
View Full Code Here

    return handler.handle(connection, rpcType, pBody, dBody);
  }

  @Override
  protected void validateHandshake(BitHandshake handshake) throws RpcException {
    if(handshake.getRpcVersion() != BitRpcConfig.RPC_VERSION) throw new RpcException(String.format("Invalid rpc version.  Expected %d, actual %d.", handshake.getRpcVersion(), BitRpcConfig.RPC_VERSION));
  }
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.