• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java SimpleClient类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.cassandra.transport.SimpleClient的典型用法代码示例。如果您正苦于以下问题:Java SimpleClient类的具体用法?Java SimpleClient怎么用?Java SimpleClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SimpleClient类属于org.apache.cassandra.transport包,在下文中一共展示了SimpleClient类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: run

import org.apache.cassandra.transport.SimpleClient; //导入依赖的package包/类
public void run(final SimpleClient client) throws IOException
{
    run(new CQLQueryExecutor()
    {
        public boolean execute(String cqlQuery, List<String> queryParams) throws Exception
        {
            ResultMessage result = null;
            if (session.usePreparedStatements())
            {
                byte[] stmntId = getPreparedStatement(client, cqlQuery);
                result = client.executePrepared(stmntId, queryParamsAsByteBuffer(queryParams), ThriftConversion.fromThrift(session.getConsistencyLevel()));
            }
            else
            {
                String formattedQuery = formatCqlQuery(cqlQuery, queryParams);
                result = client.execute(formattedQuery, ThriftConversion.fromThrift(session.getConsistencyLevel()));
            }
            return validateNativeResult(result);
        }
    });
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:22,代码来源:CQLOperation.java


示例2: getSimpleNativeClient

import org.apache.cassandra.transport.SimpleClient; //导入依赖的package包/类
public SimpleClient getSimpleNativeClient()
{
    try
    {
        String currentNode = node.randomNode();
        SimpleClient client = new SimpleClient(currentNode, port.nativePort);
        client.connect(false);
        client.execute("USE \"" + schema.keyspace + "\";", org.apache.cassandra.db.ConsistencyLevel.ONE);
        return client;
    }
    catch (Exception e)
    {
        throw new RuntimeException(e.getMessage());
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:16,代码来源:StressSettings.java


示例3: getNativeClient

import org.apache.cassandra.transport.SimpleClient; //导入依赖的package包/类
public SimpleClient getNativeClient()
{
    try
    {
        String currentNode = nodes[Stress.randomizer.nextInt(nodes.length)];
        SimpleClient client = new SimpleClient(currentNode, 9042);
        client.connect(false);
        client.execute("USE \"Keyspace1\";", org.apache.cassandra.db.ConsistencyLevel.ONE);
        return client;
    }
    catch (Exception e)
    {
        throw new RuntimeException(e.getMessage());
    }
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:16,代码来源:Session.java


示例4: getPreparedStatement

import org.apache.cassandra.transport.SimpleClient; //导入依赖的package包/类
protected static byte[] getPreparedStatement(SimpleClient client, String cqlQuery) throws Exception
{
    byte[] statementId = preparedStatementsNative.get(cqlQuery.hashCode());
    if (statementId == null)
    {
        statementId = client.prepare(cqlQuery).statementId.bytes;
        preparedStatementsNative.put(cqlQuery.hashCode(), statementId);
    }
    return statementId;
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:11,代码来源:Operation.java


示例5: testLargeBatchWithProtoV4

import org.apache.cassandra.transport.SimpleClient; //导入依赖的package包/类
@Test
public void testLargeBatchWithProtoV4() throws Exception
{
    createTable("CREATE TABLE %s (pk int PRIMARY KEY, v text)");

    try (SimpleClient client = new SimpleClient(nativeAddr.getHostAddress(), nativePort, Server.VERSION_4))
    {
        client.connect(false);

        QueryMessage query = new QueryMessage(createBatchStatement(DatabaseDescriptor.getBatchSizeWarnThreshold()), QueryOptions.DEFAULT);
        Message.Response resp = client.execute(query);
        assertEquals(1, resp.getWarnings().size());
    }
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:15,代码来源:ClientWarningsTest.java


示例6: testLargeBatchWithProtoV2

import org.apache.cassandra.transport.SimpleClient; //导入依赖的package包/类
@Test
public void testLargeBatchWithProtoV2() throws Exception
{
    createTable("CREATE TABLE %s (pk int PRIMARY KEY, v text)");

    try (SimpleClient client = new SimpleClient(nativeAddr.getHostAddress(), nativePort, Server.VERSION_3))
    {
        client.connect(false);

        QueryMessage query = new QueryMessage(createBatchStatement(DatabaseDescriptor.getBatchSizeWarnThreshold()), QueryOptions.DEFAULT);
        Message.Response resp = client.execute(query);
        assertNull(resp.getWarnings());
    }
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:15,代码来源:ClientWarningsTest.java


示例7: getSimpleNativeClient

import org.apache.cassandra.transport.SimpleClient; //导入依赖的package包/类
public SimpleClient getSimpleNativeClient()
{
    try
    {
        String currentNode = node.randomNode();
        SimpleClient client = new SimpleClient(currentNode, port.nativePort);
        client.connect(false);
        client.execute("USE \"Keyspace1\";", org.apache.cassandra.db.ConsistencyLevel.ONE);
        return client;
    }
    catch (Exception e)
    {
        throw new RuntimeException(e.getMessage());
    }
}
 
开发者ID:mafernandez-stratio,项目名称:cassandra-cqlMod,代码行数:16,代码来源:StressSettings.java


示例8: run

import org.apache.cassandra.transport.SimpleClient; //导入依赖的package包/类
@Override
public void run(SimpleClient client) throws IOException
{
    run(wrap(client));
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:6,代码来源:CqlOperation.java


示例9: wrap

import org.apache.cassandra.transport.SimpleClient; //导入依赖的package包/类
public ClientWrapper wrap(SimpleClient client)
{
    return new SimpleClientWrapper(client);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:5,代码来源:CqlOperation.java


示例10: SimpleClientWrapper

import org.apache.cassandra.transport.SimpleClient; //导入依赖的package包/类
private SimpleClientWrapper(SimpleClient client)
{
    this.client = client;
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:5,代码来源:CqlOperation.java


示例11: run

import org.apache.cassandra.transport.SimpleClient; //导入依赖的package包/类
@Override
public void run(SimpleClient client) throws IOException
{
    throw new UnsupportedOperationException();
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:6,代码来源:SchemaStatement.java


示例12: run

import org.apache.cassandra.transport.SimpleClient; //导入依赖的package包/类
public void run(SimpleClient client) throws IOException {
    throw new UnsupportedOperationException();
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:4,代码来源:Operation.java


示例13: run

import org.apache.cassandra.transport.SimpleClient; //导入依赖的package包/类
public void run()
{
    operations.initTimers();

    try
    {
        SimpleClient sclient = null;
        ThriftClient tclient = null;
        JavaDriverClient jclient = null;

        switch (settings.mode.api)
        {
            case JAVA_DRIVER_NATIVE:
                jclient = settings.getJavaDriverClient();
                break;
            case SIMPLE_NATIVE:
                sclient = settings.getSimpleNativeClient();
                break;
            case THRIFT:
            case THRIFT_SMART:
                tclient = settings.getThriftClient();
                break;
            default:
                throw new IllegalStateException();
        }

        while (true)
        {
            Operation op = operations.next();
            if (!op.ready(workManager, rateLimiter))
                break;

            try
            {
                switch (settings.mode.api)
                {
                    case JAVA_DRIVER_NATIVE:
                        op.run(jclient);
                        break;
                    case SIMPLE_NATIVE:
                        op.run(sclient);
                        break;
                    case THRIFT:
                    case THRIFT_SMART:
                    default:
                        op.run(tclient);
                }
            }
            catch (Exception e)
            {
                if (output == null)
                {
                    System.err.println(e.getMessage());
                    success = false;
                    System.exit(-1);
                }

                e.printStackTrace(output);
                success = false;
                workManager.stop();
                metrics.cancel();
                return;
            }
        }
    }
    finally
    {
        done.countDown();
        operations.closeTimers();
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:72,代码来源:StressAction.java


示例14: run

import org.apache.cassandra.transport.SimpleClient; //导入依赖的package包/类
public void run(SimpleClient client) throws IOException
{
    throw new RuntimeException("Multiget is not implemented for CQL");
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:5,代码来源:CqlMultiGetter.java



注:本文中的org.apache.cassandra.transport.SimpleClient类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Cron类代码示例发布时间:2022-05-22
下一篇:
Java GetApplicationReportRequestPBImpl类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap