Tabnine Logo
PlainActionFuture.actionGet
Code IndexAdd Tabnine to your IDE (free)

How to use
actionGet
method
in
org.elasticsearch.action.support.PlainActionFuture

Best Java code snippets using org.elasticsearch.action.support.PlainActionFuture.actionGet (Showing top 7 results out of 315)

origin: org.elasticsearch/elasticsearch

private Transport.Connection internalOpenConnection(DiscoveryNode node, ConnectionProfile connectionProfile) {
  PlainActionFuture<Transport.Connection> future = PlainActionFuture.newFuture();
  Releasable pendingConnection = transport.openConnection(node, connectionProfile, future);
  Transport.Connection connection;
  try {
    connection = future.actionGet();
  } catch (IllegalStateException e) {
    // If the future was interrupted we must cancel the pending connection to avoid channels leaking
    if (e.getCause() instanceof InterruptedException) {
      pendingConnection.close();
    }
    throw e;
  }
  try {
    connectionListener.onConnectionOpened(connection);
  } finally {
    connection.addCloseListener(ActionListener.wrap(() -> connectionListener.onConnectionClosed(connection)));
  }
  if (connection.isClosed()) {
    throw new ConnectTransportException(node, "a channel closed while connecting");
  }
  return connection;
}
origin: com.strapdata.elasticsearch.test/framework

private static <S extends ESSelector> void startSelectors(Iterable<S> selectors, ThreadFactory threadFactory) {
  for (ESSelector acceptor : selectors) {
    if (acceptor.isRunning() == false) {
      threadFactory.newThread(acceptor::runLoop).start();
      acceptor.isRunningFuture().actionGet();
    }
  }
}
origin: com.strapdata.elasticsearch.test/framework

  protected QueryBuilder rewriteAndFetch(QueryBuilder builder, QueryRewriteContext context) throws IOException {
    PlainActionFuture<QueryBuilder> future = new PlainActionFuture<>();
    Rewriteable.rewriteAndFetch(builder, context, future);
    return future.actionGet();
  }
}
origin: com.strapdata.elasticsearch.test/framework

@Override
protected void doRun() throws Exception {
  go.await();
  for (int iter = 0; iter < 10; iter++) {
    PlainActionFuture<TestResponse> listener = new PlainActionFuture<>();
    final String info = sender + "_B_" + iter;
    serviceB.sendRequest(nodeA, "test", new TestRequest(info),
      new ActionListenerResponseHandler<>(listener, TestResponse::new));
    try {
      listener.actionGet();
    } catch (Exception e) {
      logger.trace(
        (Supplier<?>) () -> new ParameterizedMessage("caught exception while sending to node {}", nodeA), e);
    }
  }
}
origin: com.strapdata.elasticsearch.test/framework

@Override
protected void doRun() throws Exception {
  go.await();
  for (int iter = 0; iter < 10; iter++) {
    PlainActionFuture<TestResponse> listener = new PlainActionFuture<>();
    final String info = sender + "_" + iter;
    final DiscoveryNode node = nodeB; // capture now
    try {
      serviceA.sendRequest(node, "test", new TestRequest(info),
        new ActionListenerResponseHandler<>(listener, TestResponse::new));
      try {
        listener.actionGet();
      } catch (ConnectTransportException e) {
        // ok!
      } catch (Exception e) {
        logger.error(
          (Supplier<?>) () -> new ParameterizedMessage("caught exception while sending to node {}", node), e);
        sendingErrors.add(e);
      }
    } catch (NodeNotConnectedException ex) {
      // ok
    }
  }
}
origin: org.elasticsearch.plugin/percolator-client

@Override
public void parse(ParseContext context) throws IOException {
  QueryShardContext queryShardContext = this.queryShardContext.get();
  if (context.doc().getField(queryBuilderField.name()) != null) {
    // If a percolator query has been defined in an array object then multiple percolator queries
    // could be provided. In order to prevent this we fail if we try to parse more than one query
    // for the current document.
    throw new IllegalArgumentException("a document can only contain one percolator query");
  }
  XContentParser parser = context.parser();
  QueryBuilder queryBuilder = parseQueryBuilder(
      parser, parser.getTokenLocation()
  );
  verifyQuery(queryBuilder);
  // Fetching of terms, shapes and indexed scripts happen during this rewrite:
  PlainActionFuture<QueryBuilder> future = new PlainActionFuture<>();
  Rewriteable.rewriteAndFetch(queryBuilder, queryShardContext, future);
  queryBuilder = future.actionGet();
  Version indexVersion = context.mapperService().getIndexSettings().getIndexVersionCreated();
  createQueryBuilderField(indexVersion, queryBuilderField, queryBuilder, context);
  QueryBuilder queryBuilderForProcessing = queryBuilder.rewrite(new QueryShardContext(queryShardContext) {
    @Override
    public boolean convertNowRangeToMatchAll() {
      return true;
    }
  });
  Query query = toQuery(queryShardContext, isMapUnmappedFieldAsText(), queryBuilderForProcessing);
  processQuery(query, context);
}
origin: org.codelibs.elasticsearch.module/percolator

@Override
public void parse(ParseContext context) throws IOException {
  QueryShardContext queryShardContext = this.queryShardContext.get();
  if (context.doc().getField(queryBuilderField.name()) != null) {
    // If a percolator query has been defined in an array object then multiple percolator queries
    // could be provided. In order to prevent this we fail if we try to parse more than one query
    // for the current document.
    throw new IllegalArgumentException("a document can only contain one percolator query");
  }
  XContentParser parser = context.parser();
  QueryBuilder queryBuilder = parseQueryBuilder(
      parser, parser.getTokenLocation()
  );
  verifyQuery(queryBuilder);
  // Fetching of terms, shapes and indexed scripts happen during this rewrite:
  PlainActionFuture<QueryBuilder> future = new PlainActionFuture<>();
  Rewriteable.rewriteAndFetch(queryBuilder, queryShardContext, future);
  queryBuilder = future.actionGet();
  Version indexVersion = context.mapperService().getIndexSettings().getIndexVersionCreated();
  createQueryBuilderField(indexVersion, queryBuilderField, queryBuilder, context);
  QueryBuilder queryBuilderForProcessing = queryBuilder.rewrite(new QueryShardContext(queryShardContext) {
    @Override
    public boolean convertNowRangeToMatchAll() {
      return true;
    }
  });
  Query query = toQuery(queryShardContext, isMapUnmappedFieldAsText(), queryBuilderForProcessing);
  processQuery(query, context);
}
org.elasticsearch.action.supportPlainActionFutureactionGet

Popular methods of PlainActionFuture

  • <init>
  • newFuture
  • get
  • onResponse

Popular in Java

  • Making http requests using okhttp
  • getApplicationContext (Context)
  • setContentView (Activity)
  • requestLocationUpdates (LocationManager)
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now