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

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

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

origin: org.elasticsearch/elasticsearch

public final ActionFuture<Response> execute(Request request) {
  PlainActionFuture<Response> future = newFuture();
  execute(request, future);
  return future;
}
origin: org.elasticsearch/elasticsearch

@Override
public final <Request extends ActionRequest, Response extends ActionResponse,
  RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>> ActionFuture<Response> execute(
    Action<Request, Response, RequestBuilder> action, Request request) {
  PlainActionFuture<Response> actionFuture = PlainActionFuture.newFuture();
  execute(action, request, actionFuture);
  return actionFuture;
}
origin: org.elasticsearch/elasticsearch

/**
 * Invokes #accept(BulkRequest, ActionListener). Backs off on the provided exception. Retries will be scheduled using
 * the class's thread pool.
 *
 * @param consumer The consumer to which apply the request and listener
 * @param bulkRequest The bulk request that should be executed.
 * @return a future representing the bulk response returned by the client.
 */
public PlainActionFuture<BulkResponse> withBackoff(BiConsumer<BulkRequest, ActionListener<BulkResponse>> consumer,
                          BulkRequest bulkRequest) {
  PlainActionFuture<BulkResponse> future = PlainActionFuture.newFuture();
  withBackoff(consumer, bulkRequest, future);
  return future;
}
origin: org.elasticsearch/elasticsearch

/**
 * Closes the channels.
 *
 * @param channels to close
 * @param blocking indicates if we should block on channel close
 */
static <C extends CloseableChannel> void closeChannels(List<C> channels, boolean blocking) {
  try {
    IOUtils.close(channels);
  } catch (IOException e) {
    // The CloseableChannel#close method does not throw IOException, so this should not occur.
    throw new AssertionError(e);
  }
  if (blocking) {
    ArrayList<ActionFuture<Void>> futures = new ArrayList<>(channels.size());
    for (final C channel : channels) {
      PlainActionFuture<Void> closeFuture = PlainActionFuture.newFuture();
      channel.addCloseListener(closeFuture);
      futures.add(closeFuture);
    }
    blockOnFutures(futures);
  }
}
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: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

@Override
public final <Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>> ActionFuture<Response> execute(
    Action<Request, Response, RequestBuilder> action, Request request) {
  PlainActionFuture<Response> actionFuture = PlainActionFuture.newFuture();
  execute(action, request, actionFuture);
  return actionFuture;
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

public final ActionFuture<Response> execute(Request request) {
  PlainActionFuture<Response> future = newFuture();
  execute(request, future);
  return future;
}
origin: com.strapdata.elasticsearch/elasticsearch

@Override
public final <Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>> ActionFuture<Response> execute(
    Action<Request, Response, RequestBuilder> action, Request request) {
  PlainActionFuture<Response> actionFuture = PlainActionFuture.newFuture();
  execute(action, request, actionFuture);
  return actionFuture;
}
origin: com.strapdata.elasticsearch/elasticsearch

public final ActionFuture<Response> execute(Request request) {
  PlainActionFuture<Response> future = newFuture();
  execute(request, future);
  return future;
}
origin: harbby/presto-connectors

@Override
public final <Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>> ActionFuture<Response> execute(Action<Request, Response, RequestBuilder> action, Request request) {
  PlainActionFuture<Response> actionFuture = PlainActionFuture.newFuture();
  execute(action, request, actionFuture);
  return actionFuture;
}
origin: harbby/presto-connectors

public final ActionFuture<Response> execute(Request request) {
  PlainActionFuture<Response> future = newFuture();
  execute(request, future);
  return future;
}
origin: apache/servicemix-bundles

public final ActionFuture<Response> execute(Request request) {
  PlainActionFuture<Response> future = newFuture();
  execute(request, future);
  return future;
}
origin: com.strapdata.elasticsearch/elasticsearch

public static SyncRetryHandler create(Class<? extends Throwable> retryOnThrowable, BackoffPolicy backoffPolicy, Client client) {
  PlainActionFuture<BulkResponse> actionFuture = PlainActionFuture.newFuture();
  return new SyncRetryHandler(retryOnThrowable, backoffPolicy, client, actionFuture);
}
origin: harbby/presto-connectors

public static SyncRetryHandler create(Class<? extends Throwable> retryOnThrowable, BackoffPolicy backoffPolicy, Client client) {
  PlainActionFuture<BulkResponse> actionFuture = PlainActionFuture.newFuture();
  return new SyncRetryHandler(retryOnThrowable, backoffPolicy, client, actionFuture);
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

/**
 * Invokes #accept(BulkRequest, ActionListener). Backs off on the provided exception. Retries will be scheduled using
 * the class's thread pool.
 *
 * @param consumer The consumer to which apply the request and listener
 * @param bulkRequest The bulk request that should be executed.
 * @return a future representing the bulk response returned by the client.
 */
public PlainActionFuture<BulkResponse> withBackoff(BiConsumer<BulkRequest, ActionListener<BulkResponse>> consumer,
                          BulkRequest bulkRequest) {
  PlainActionFuture<BulkResponse> future = PlainActionFuture.newFuture();
  withBackoff(consumer, bulkRequest, future);
  return future;
}
origin: apache/servicemix-bundles

/**
 * Invokes #accept(BulkRequest, ActionListener). Backs off on the provided exception. Retries will be scheduled using
 * the class's thread pool.
 *
 * @param consumer The consumer to which apply the request and listener
 * @param bulkRequest The bulk request that should be executed.
 * @param settings settings
 * @return a future representing the bulk response returned by the client.
 */
public PlainActionFuture<BulkResponse> withBackoff(BiConsumer<BulkRequest, ActionListener<BulkResponse>> consumer,
                          BulkRequest bulkRequest, Settings settings) {
  PlainActionFuture<BulkResponse> future = PlainActionFuture.newFuture();
  withBackoff(consumer, bulkRequest, future, settings);
  return future;
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

/**
 * Closes the channels.
 *
 * @param channels to close
 * @param blocking indicates if we should block on channel close
 */
static <C extends TcpChannel> void closeChannels(List<C> channels, boolean blocking) {
  if (blocking) {
    ArrayList<ActionFuture<Void>> futures = new ArrayList<>(channels.size());
    for (final C channel : channels) {
      if (channel.isOpen()) {
        PlainActionFuture<Void> closeFuture = PlainActionFuture.newFuture();
        channel.addCloseListener(closeFuture);
        channel.close();
        futures.add(closeFuture);
      }
    }
    blockOnFutures(futures);
  } else {
    Releasables.close(channels);
  }
}
origin: apache/servicemix-bundles

/**
 * Closes the channels.
 *
 * @param channels to close
 * @param blocking indicates if we should block on channel close
 */
static <C extends TcpChannel> void closeChannels(List<C> channels, boolean blocking) {
  if (blocking) {
    ArrayList<ActionFuture<Void>> futures = new ArrayList<>(channels.size());
    for (final C channel : channels) {
      if (channel.isOpen()) {
        PlainActionFuture<Void> closeFuture = PlainActionFuture.newFuture();
        channel.addCloseListener(closeFuture);
        channel.close();
        futures.add(closeFuture);
      }
    }
    blockOnFutures(futures);
  } else {
    Releasables.close(channels);
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

for (int i = 0; i < numConnections; ++i) {
  try {
    PlainActionFuture<Void> connectFuture = PlainActionFuture.newFuture();
    connectionFutures.add(connectFuture);
    TcpChannel channel = initiateChannel(node, connectFuture);
origin: apache/servicemix-bundles

public final class NodeChannels implements Connection {
  private final Map<TransportRequestOptions.Type, ConnectionProfile.ConnectionTypeHandle> typeMapping;
  private final List<TcpChannel> channels;
  private final DiscoveryNode node;
  private final AtomicBoolean closed = new AtomicBoolean(false);
  private final Version version;
  NodeChannels(DiscoveryNode node, List<TcpChannel> channels, ConnectionProfile connectionProfile, Version handshakeVersion) {
    this.node = node;
    this.channels = Collections.unmodifiableList(channels);
    assert channels.size() == connectionProfile.getNumConnections() : "expected channels size to be == "
      + connectionProfile.getNumConnections() + " but was: [" + channels.size() + "]";
    typeMapping = new EnumMap<>(TransportRequestOptions.Type.class);
    for (ConnectionProfile.ConnectionTypeHandle handle : connectionProfile.getHandles()) {
      for (TransportRequestOptions.Type type : handle.getTypes())
        typeMapping.put(type, handle);
    }
    version = handshakeVersion;
  }
  @Override
  public Version getVersion() {
    return version;
  }
  public List<TcpChannel> getChannels() {
    return channels;
  }
  public TcpChannel channel(TransportRequestOptions.Type type) {
org.elasticsearch.action.supportPlainActionFuturenewFuture

Popular methods of PlainActionFuture

  • <init>
  • actionGet
  • get
  • onResponse

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getSupportFragmentManager (FragmentActivity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • setScale (BigDecimal)
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Best IntelliJ plugins
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