Examples of QueryMessage


Examples of org.apache.cassandra.transport.messages.QueryMessage

    }

    private void refreshNodeListAndTokenMap(Connection connection) throws ConnectionException, BusyConnectionException, ExecutionException, InterruptedException {
        // Make sure we're up to date on nodes and tokens

        DefaultResultSetFuture peersFuture = new DefaultResultSetFuture(null, new QueryMessage(SELECT_PEERS, ConsistencyLevel.DEFAULT_CASSANDRA_CL));
        DefaultResultSetFuture localFuture = new DefaultResultSetFuture(null, new QueryMessage(SELECT_LOCAL, ConsistencyLevel.DEFAULT_CASSANDRA_CL));
        connection.write(peersFuture);
        connection.write(localFuture);

        String partitioner = null;
        Map<Host, Collection<String>> tokenMap = new HashMap<Host, Collection<String>>();
View Full Code Here

Examples of org.apache.cassandra.transport.messages.QueryMessage

        long start = System.nanoTime();
        long elapsed = 0;
        while (elapsed < MAX_SCHEMA_AGREEMENT_WAIT_MS) {

            DefaultResultSetFuture peersFuture = new DefaultResultSetFuture(null, new QueryMessage(SELECT_SCHEMA_PEERS, ConsistencyLevel.DEFAULT_CASSANDRA_CL));
            DefaultResultSetFuture localFuture = new DefaultResultSetFuture(null, new QueryMessage(SELECT_SCHEMA_LOCAL, ConsistencyLevel.DEFAULT_CASSANDRA_CL));
            connection.write(peersFuture);
            connection.write(localFuture);

            Set<UUID> versions = new HashSet<UUID>();
View Full Code Here

Examples of org.apache.cassandra.transport.messages.QueryMessage

        try {
            logger.trace("[{}] Setting keyspace {}", name, keyspace);
            long timeout = factory.getConnectTimeoutMillis();
            // Note: we quote the keyspace below, because the name is the one coming from Cassandra, so it's in the right case already
            Future future = write(new QueryMessage("USE \"" + keyspace + "\"", ConsistencyLevel.DEFAULT_CASSANDRA_CL));
            Message.Response response = Uninterruptibles.getUninterruptibly(future, timeout, TimeUnit.MILLISECONDS);
            switch (response.type) {
                case RESULT:
                    this.keyspace = keyspace;
                    break;
View Full Code Here

Examples of org.apache.cassandra.transport.messages.QueryMessage

        Message.Request request = callback.request();
        if (retryConsistencyLevel != null) {
            org.apache.cassandra.db.ConsistencyLevel cl = ConsistencyLevel.toCassandraCL(retryConsistencyLevel);
            if (request instanceof QueryMessage) {
                QueryMessage qm = (QueryMessage)request;
                if (qm.consistency != cl)
                    request = new QueryMessage(qm.query, cl);
            }
            else if (request instanceof ExecuteMessage) {
                ExecuteMessage em = (ExecuteMessage)request;
                if (em.consistency != cl)
                    request = new ExecuteMessage(em.statementId, em.values, cl);
View Full Code Here

Examples of org.apache.cassandra.transport.messages.QueryMessage

            // the coordinator log in the trace. Since the duration is the last thing the coordinator log, that's
            // what we check to know if the trace is "complete" (again, it may not contain the log of replicas).
            while (duration == Integer.MIN_VALUE && tries <= MAX_TRIES) {
                ++tries;

                ResultSetFuture sessionsFuture = session.executeQuery(new QueryMessage(String.format(SELECT_SESSIONS_FORMAT, traceId), ConsistencyLevel.DEFAULT_CASSANDRA_CL), Query.DEFAULT);
                ResultSetFuture eventsFuture = session.executeQuery(new QueryMessage(String.format(SELECT_EVENTS_FORMAT, traceId), ConsistencyLevel.DEFAULT_CASSANDRA_CL), Query.DEFAULT);

                Row sessRow = sessionsFuture.get().one();
                if (sessRow != null && !sessRow.isNull("duration")) {

                    requestType = sessRow.getString("request");
View Full Code Here

Examples of org.apache.cassandra.transport.messages.QueryMessage

        execute(msg);
    }

    public ResultMessage execute(String query, ConsistencyLevel consistency)
    {
        Message.Response msg = execute(new QueryMessage(query, consistency));
        assert msg instanceof ResultMessage;
        return (ResultMessage)msg;
    }
View Full Code Here

Examples of org.apache.cayenne.remote.QueryMessage

            }
        };
        DataContext context = new DataContext(parent, new ObjectStore(
                new MockDataRowStore()));

        QueryMessage message = new QueryMessage(new MockQuery());
        new ClientServerChannel(context).onQuery(null, message.getQuery());
        assertTrue(genericDone[0]);
    }
View Full Code Here

Examples of org.apache.cayenne.remote.QueryMessage

                return createServerSession();
            }
        };

        try {
            service.processMessage(new QueryMessage(null) {

                @Override
                public Query getQuery() {
                    // serializable exception thrown
                    throw new CayenneRuntimeException();
                }
            });

            fail("Expected to throw");
        }
        catch (Exception ex) {
            Util.cloneViaSerialization(ex);
        }

        try {
            service.processMessage(new QueryMessage(null) {

                @Override
                public Query getQuery() {
                    // non-serializable exception thrown
                    throw new MockUnserializableException();
View Full Code Here

Examples of org.apache.cayenne.remote.QueryMessage

            }
        };
        DataContext context = new DataContext(parent, new ObjectStore(
                new MockDataRowStore()));

        QueryMessage message = new QueryMessage(new MockQuery());
        new ClientServerChannel(context).onQuery(null, message.getQuery());
        assertTrue(genericDone[0]);
    }
View Full Code Here

Examples of org.apache.cayenne.remote.QueryMessage

                return super.onQuery(context, query);
            }
        };
        DataContext context = (DataContext) runtime.newContext(parent);

        QueryMessage message = new QueryMessage(new MockQuery());
        new ClientServerChannel(context).onQuery(null, message.getQuery());
        assertTrue(genericDone[0]);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.