Package org.apache.blur.thrift.generated.Blur

Examples of org.apache.blur.thrift.generated.Blur.Client


    socket.setSoTimeout(timeout);
    socket.connect(new InetSocketAddress(host, port), timeout);
    trans = new TSocket(socket);

    TProtocol proto = new TBinaryProtocol(new TFramedTransport(trans));
    Client client = new Client(proto);
    return client;
  }
View Full Code Here


        Thread.sleep(50);
      } catch (InterruptedException e) {
        return;
      }
      try {
        Client client = BlurClientManager.newClient(connection);
        BlurClientManager.close(client);
        break;
      } catch (TException e) {
        throw new RuntimeException(e);
      } catch (IOException e) {
View Full Code Here

    return shardClients;
  }

  private boolean tryToConnect(String sc, AtomicReference<Client> ref) {
    try {
      Client c = BlurClientManager.newClient(new Connection(sc));
      ref.set(c);
      return true;
    } catch (TTransportException e) {
      ref.set(null);
      if (Main.debug) {
View Full Code Here

    }
    return null;
  }

  private void tryToClose(AtomicReference<Client> ref) {
    Client client = ref.get();
    if (client != null) {
      ref.set(null);
      try {
        client.getInputProtocol().getTransport().close();
      } catch (Exception e) {
        if (Main.debug) {
          e.printStackTrace();
        }
      }
View Full Code Here

    return shardClients;
  }

  private boolean tryToConnect(String sc, AtomicReference<Client> ref) {
    try {
      Client c = BlurClientManager.newClient(new Connection(sc));
      ref.set(c);
      return true;
    } catch (TTransportException e) {
      ref.set(null);
      if (Main.debug) {
View Full Code Here

    }
    return null;
  }

  private void tryToClose(AtomicReference<Client> ref) {
    Client client = ref.get();
    if (client != null) {
      ref.set(null);
      try {
        client.getInputProtocol().getTransport().close();
      } catch (Exception e) {
        if (Main.debug) {
          e.printStackTrace();
        }
      }
View Full Code Here

      // Need to maintain original order.
      final IdentityHashMap<Selector, Integer> indexMap = new IdentityHashMap<Selector, Integer>();
      for (int i = 0; i < results.results.size(); i++) {
        final LazyBlurResult result = (LazyBlurResult) results.results.get(i);
        Client client = result.getClient();
        Selector s = new Selector(selector);
        s.setLocationId(result.locationId);
        List<Selector> list = map.get(client);
        if (list == null) {
          list = new ArrayList<Selector>();
          map.put(client, list);
        }
        list.add(s);
        indexMap.put(s, i);
      }

      // Execute batch fetches
      List<Future<Boolean>> futures = new ArrayList<Future<Boolean>>();
      final AtomicReferenceArray<FetchResult> fetchResults = new AtomicReferenceArray<FetchResult>(
          results.results.size());
      for (Entry<Client, List<Selector>> entry : map.entrySet()) {
        final Client client = entry.getKey();
        final List<Selector> list = entry.getValue();
        futures.add(executor.submit(new Callable<Boolean>() {
          @Override
          public Boolean call() throws Exception {
            Tracer trace = Trace.trace("remote call - thrift", Trace.param("node", getNode(client)));
            try {
              TraceId traceId = Trace.getTraceId();
              if (traceId != null) {
                client.startTrace(traceId.getRootId(), traceId.getRequestId());
              }
              List<FetchResult> fetchRowBatch = client.fetchRowBatch(table, list);
              for (int i = 0; i < list.size(); i++) {
                int index = indexMap.get(list.get(i));
                fetchResults.set(index, fetchRowBatch.get(i));
              }
              return Boolean.TRUE;
            } finally {
              trace.done();
            }
          }

          private String getNode(Client client) {
            TProtocol inputProtocol = client.getInputProtocol();
            TTransport transport = inputProtocol.getTransport();
            if (transport instanceof TFramedTransport) {
              TFramedTransport framedTransport = (TFramedTransport) transport;
              transport = framedTransport.getTransport();
            }
View Full Code Here

TOP

Related Classes of org.apache.blur.thrift.generated.Blur.Client

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.