Search in sources :

Example 16 with AerospikeClient

use of com.aerospike.client.AerospikeClient in project aerospike-client-java by aerospike.

the class Example method runExamples.

/**
 * Connect and run one or more client examples.
 */
public static void runExamples(Console console, Parameters params, List<String> examples) throws Exception {
    ClientPolicy policy = new ClientPolicy();
    policy.user = params.user;
    policy.password = params.password;
    policy.authMode = params.authMode;
    policy.tlsPolicy = params.tlsPolicy;
    params.policy = policy.readPolicyDefault;
    params.writePolicy = policy.writePolicyDefault;
    Host[] hosts = Host.parseHosts(params.host, params.port);
    AerospikeClient client = new AerospikeClient(policy, hosts);
    try {
        params.setServerSpecific(client);
        for (String exampleName : examples) {
            runExample(exampleName, client, params, console);
        }
    } finally {
        client.close();
    }
}
Also used : AerospikeClient(com.aerospike.client.AerospikeClient) ClientPolicy(com.aerospike.client.policy.ClientPolicy) Host(com.aerospike.client.Host)

Aggregations

AerospikeClient (com.aerospike.client.AerospikeClient)16 AerospikeException (com.aerospike.client.AerospikeException)7 ClientPolicy (com.aerospike.client.policy.ClientPolicy)6 Host (com.aerospike.client.Host)4 Key (com.aerospike.client.Key)4 RecordSet (com.aerospike.client.query.RecordSet)4 Statement (com.aerospike.client.query.Statement)4 Record (com.aerospike.client.Record)3 EventPolicy (com.aerospike.client.async.EventPolicy)3 NettyEventLoops (com.aerospike.client.async.NettyEventLoops)3 NioEventLoops (com.aerospike.client.async.NioEventLoops)3 EventLoopGroup (io.netty.channel.EventLoopGroup)3 EpollEventLoopGroup (io.netty.channel.epoll.EpollEventLoopGroup)3 KQueueEventLoopGroup (io.netty.channel.kqueue.KQueueEventLoopGroup)3 NioEventLoopGroup (io.netty.channel.nio.NioEventLoopGroup)3 IOUringEventLoopGroup (io.netty.incubator.channel.uring.IOUringEventLoopGroup)3 Bin (com.aerospike.client.Bin)2 Args (com.aerospike.test.util.Args)2 IOException (java.io.IOException)2 BeforeClass (org.junit.BeforeClass)2