Tabnine Logo
Cluster$Manager.addPrepared
Code IndexAdd Tabnine to your IDE (free)

How to use
addPrepared
method
in
com.datastax.driver.core.Cluster$Manager

Best Java code snippets using com.datastax.driver.core.Cluster$Manager.addPrepared (Showing top 5 results out of 315)

origin: com.datastax.cassandra/cassandra-driver-core

  DefaultPreparedStatement.fromMessage(
    pmsg, cluster, query, poolsState.keyspace);
stmt = cluster.manager.addPrepared(stmt);
if (cluster.getConfiguration().getQueryOptions().isPrepareOnAllHosts()) {
origin: com.stratio.cassandra/cassandra-driver-core

  public PreparedStatement apply(Message.Response response) {
    switch (response.type) {
      case RESULT:
        Responses.Result rm = (Responses.Result)response;
        switch (rm.kind) {
          case PREPARED:
            Responses.Result.Prepared pmsg = (Responses.Result.Prepared)rm;
            PreparedStatement stmt = DefaultPreparedStatement.fromMessage(pmsg, cluster.getMetadata(), query, poolsState.keyspace);
            stmt = cluster.manager.addPrepared(stmt);
            try {
              // All Sessions are connected to the same nodes so it's enough to prepare only the nodes of this session.
              // If that changes, we'll have to make sure this propagate to other sessions too.
              prepare(stmt.getQueryString(), future.getAddress());
            } catch (InterruptedException e) {
              Thread.currentThread().interrupt();
              // This method doesn't propagate interruption, at least not for now. However, if we've
              // interrupted preparing queries on other node it's not a problem as we'll re-prepare
              // later if need be. So just ignore.
            }
            return stmt;
          default:
            throw new DriverInternalError(String.format("%s response received when prepared statement was expected", rm.kind));
        }
      case ERROR:
        throw ((Responses.Error)response).asException(future.getAddress());
      default:
        throw new DriverInternalError(String.format("%s response received when prepared statement was expected", response.type));
    }
  }
}, executor()); // Since the transformation involves querying other nodes, we should not do that in an I/O thread
origin: com.yugabyte/cassandra-driver-core

  @Override
  public ListenableFuture<PreparedStatement> apply(Response response) {
    switch (response.type) {
      case RESULT:
        Responses.Result rm = (Responses.Result) response;
        switch (rm.kind) {
          case PREPARED:
            Responses.Result.Prepared pmsg = (Responses.Result.Prepared) rm;
            PreparedStatement stmt = DefaultPreparedStatement.fromMessage(pmsg, cluster, query, poolsState.keyspace);
            stmt = cluster.manager.addPrepared(stmt);
            if (cluster.getConfiguration().getQueryOptions().isPrepareOnAllHosts()) {
              // All Sessions are connected to the same nodes so it's enough to prepare only the nodes of this session.
              // If that changes, we'll have to make sure this propagate to other sessions too.
              return prepare(stmt, future.getAddress());
            } else {
              return Futures.immediateFuture(stmt);
            }
          default:
            return Futures.immediateFailedFuture(
                new DriverInternalError(String.format("%s response received when prepared statement was expected", rm.kind)));
        }
      case ERROR:
        return Futures.immediateFailedFuture(
            ((Responses.Error) response).asException(future.getAddress()));
      default:
        return Futures.immediateFailedFuture(
            new DriverInternalError(String.format("%s response received when prepared statement was expected", response.type)));
    }
  }
}, executor());
origin: io.prestosql.cassandra/cassandra-driver

  @Override
  public ListenableFuture<PreparedStatement> apply(Response response) {
    switch (response.type) {
      case RESULT:
        Responses.Result rm = (Responses.Result) response;
        switch (rm.kind) {
          case PREPARED:
            Responses.Result.Prepared pmsg = (Responses.Result.Prepared) rm;
            PreparedStatement stmt = DefaultPreparedStatement.fromMessage(pmsg, cluster, query, poolsState.keyspace);
            stmt = cluster.manager.addPrepared(stmt);
            if (cluster.getConfiguration().getQueryOptions().isPrepareOnAllHosts()) {
              // All Sessions are connected to the same nodes so it's enough to prepare only the nodes of this session.
              // If that changes, we'll have to make sure this propagate to other sessions too.
              return prepare(stmt, future.getAddress());
            } else {
              return Futures.immediateFuture(stmt);
            }
          default:
            return Futures.immediateFailedFuture(
                new DriverInternalError(String.format("%s response received when prepared statement was expected", rm.kind)));
        }
      case ERROR:
        return Futures.immediateFailedFuture(
            ((Responses.Error) response).asException(future.getAddress()));
      default:
        return Futures.immediateFailedFuture(
            new DriverInternalError(String.format("%s response received when prepared statement was expected", response.type)));
    }
  }
}, executor());
origin: com.facebook.presto.cassandra/cassandra-driver

  @Override
  public ListenableFuture<PreparedStatement> apply(Response response) {
    switch (response.type) {
      case RESULT:
        Responses.Result rm = (Responses.Result) response;
        switch (rm.kind) {
          case PREPARED:
            Responses.Result.Prepared pmsg = (Responses.Result.Prepared) rm;
            PreparedStatement stmt = DefaultPreparedStatement.fromMessage(pmsg, cluster, query, poolsState.keyspace);
            stmt = cluster.manager.addPrepared(stmt);
            if (cluster.getConfiguration().getQueryOptions().isPrepareOnAllHosts()) {
              // All Sessions are connected to the same nodes so it's enough to prepare only the nodes of this session.
              // If that changes, we'll have to make sure this propagate to other sessions too.
              return prepare(stmt, future.getAddress());
            } else {
              return Futures.immediateFuture(stmt);
            }
          default:
            return Futures.immediateFailedFuture(
                new DriverInternalError(String.format("%s response received when prepared statement was expected", rm.kind)));
        }
      case ERROR:
        return Futures.immediateFailedFuture(
            ((Responses.Error) response).asException(future.getAddress()));
      default:
        return Futures.immediateFailedFuture(
            new DriverInternalError(String.format("%s response received when prepared statement was expected", response.type)));
    }
  }
}, executor());
com.datastax.driver.coreCluster$ManageraddPrepared

Popular methods of Cluster$Manager

  • loadBalancingPolicy
  • submitSchemaRefresh
  • triggerOnDown
  • isClosed
  • submitNodeListRefresh
  • <init>
  • close
  • ensurePoolsSizing
  • init
  • logUnsupportedVersionProtocol
  • prepareAllQueries
  • protocolVersion
  • prepareAllQueries,
  • protocolVersion,
  • reconnectionPolicy,
  • refreshConnectedHosts,
  • refreshSchemaAndSignal,
  • removeHost,
  • translateAddress,
  • triggerOnAdd,
  • triggerOnRemove

Popular in Java

  • Reading from database using SQL prepared statement
  • compareTo (BigDecimal)
  • getApplicationContext (Context)
  • scheduleAtFixedRate (Timer)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • Menu (java.awt)
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • ImageIO (javax.imageio)
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • 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