Package org.apache.hadoop.hbase.protobuf.generated.ClientProtos

Examples of org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MultiGetResponse


            public List<Boolean> call() throws IOException {
              try {
                MultiGetRequest requests = RequestConverter.buildMultiGetRequest(
                  getLocation().getRegionInfo().getRegionName(), getsByRegionEntry.getValue(),
                  true, false);
                MultiGetResponse responses = getStub().multiGet(null, requests);
                return responses.getExistsList();
              } catch (ServiceException se) {
                throw ProtobufUtil.getRemoteException(se);
              }
            }
          };
          return rpcCallerFactory.<List<Boolean>> newCaller().callWithRetries(callable,
              operationTimeout);
        }
      };
      futures.put(getsByRegionEntry.getKey(), pool.submit(callable));
    }

    // step 3: collect the failures and successes
    Map<Integer, List<Boolean>> responses = new HashMap<Integer, List<Boolean>>();
    for (final Map.Entry<Integer, List<Get>> sortedGetEntry : getsByRegion.entrySet()) {
      try {
        Future<List<Boolean>> future = futures.get(sortedGetEntry.getKey());
        List<Boolean> resp = future.get();

        if (resp == null) {
          LOG.warn("Failed for gets on region: " + sortedGetEntry.getKey());
        }
        responses.put(sortedGetEntry.getKey(), resp);
      } catch (ExecutionException e) {
        LOG.warn("Failed for gets on region: " + sortedGetEntry.getKey());
      } catch (InterruptedException e) {
        LOG.warn("Failed for gets on region: " + sortedGetEntry.getKey());
        Thread.currentThread().interrupt();
      }
    }
    Boolean[] results = new Boolean[sortedGetsList.size()];

    // step 4: build the response.
    Map<Integer, Integer> indexes = new HashMap<Integer, Integer>();
    for (int i = 0; i < sortedGetsList.size(); i++) {
      Integer regionInfoIndex = getToRegionIndexMap.get(sortedGetsList.get(i).getGet());
      Integer index = indexes.get(regionInfoIndex);
      if (index == null) {
        index = 0;
      }
      results[sortedGetsList.get(i).getInitialIndex()] = responses.get(regionInfoIndex).get(index);
      indexes.put(regionInfoIndex, index + 1);
    }

    return results;
  }
View Full Code Here


              .get(0).getRow(), operationTimeout) {
            public List<Boolean> call() throws IOException {
              try {
                MultiGetRequest requests = RequestConverter.buildMultiGetRequest(location
                    .getRegionInfo().getRegionName(), getsByRegionEntry.getValue(), true, false);
                MultiGetResponse responses = server.multiGet(null, requests);
                return responses.getExistsList();
              } catch (ServiceException se) {
                throw ProtobufUtil.getRemoteException(se);
              }
            }
          }.withRetries();
        }
      };
      futures.put(getsByRegionEntry.getKey(), pool.submit(callable));
    }

    // step 3: collect the failures and successes
    Map<Integer, List<Boolean>> responses = new HashMap<Integer, List<Boolean>>();
    for (final Map.Entry<Integer, List<Get>> sortedGetEntry : getsByRegion.entrySet()) {
      try {
        Future<List<Boolean>> future = futures.get(sortedGetEntry.getKey());
        List<Boolean> resp = future.get();

        if (resp == null) {
          LOG.warn("Failed for gets on region: " + sortedGetEntry.getKey());
        }
        responses.put(sortedGetEntry.getKey(), resp);
      } catch (ExecutionException e) {
        LOG.warn("Failed for gets on region: " + sortedGetEntry.getKey());
      } catch (InterruptedException e) {
        LOG.warn("Failed for gets on region: " + sortedGetEntry.getKey());
        Thread.currentThread().interrupt();
      }
    }
    Boolean[] results = new Boolean[sortedGetsList.size()];

    // step 4: build the response.
    Map<Integer, Integer> indexes = new HashMap<Integer, Integer>();
    for (int i = 0; i < sortedGetsList.size(); i++) {
      Integer regionInfoIndex = getToRegionIndexMap.get(sortedGetsList.get(i).getGet());
      Integer index = indexes.get(regionInfoIndex);
      if (index == null) {
        index = 0;
      }
      results[sortedGetsList.get(i).getInitialIndex()] = responses.get(regionInfoIndex).get(index);
      indexes.put(regionInfoIndex, index + 1);
    }

    return results;
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MultiGetResponse

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.