Package com.basho.riak.client.raw.pbc

Examples of com.basho.riak.client.raw.pbc.PBClusterConfig


                .concurrencyLevel(4)
                .maximumSize(1000000l)
                .expireAfterWrite(5, TimeUnit.MINUTES)
                .build();
        // Riak Protocol Buffers client with supplied IP and Port
        PBClusterConfig riakClusterConfig = new PBClusterConfig(20);
        // See above examples for client config options
        PBClientConfig riakClientConfig = PBClientConfig.defaults();
        //riakClusterConfig.addHosts(riakClientConfig, "192.168.1.102", "192.168.1.104", "192.168.1.105");
        riakClusterConfig.addHosts(riakClientConfig, riakIps);
        riakClient = RiakFactory.newClient(riakClusterConfig);

        liveStatisticsDao = new RiakLiveStatisticsDao(riakClient, metricHourCache);
        alertDao = new RiakAlertDao(riakClient);
        accountDao = new RiakAccountDao(riakClient);
View Full Code Here


        {
            hosts.add( DEFAULT_HOST );
        }
        bucketKey = config.bucket().get() == null ? DEFAULT_BUCKET_KEY : config.bucket().get();

        PBClusterConfig pbClusterConfig = new PBClusterConfig( maxConnections );
        for( String host : hosts )
        {
            String[] splitted = host.split( ":" );
            int port = DEFAULT_PORT;
            if( splitted.length > 1 )
            {
                host = splitted[0];
                port = Integer.valueOf( splitted[1] );
            }
            PBClientConfig clientConfig = new PBClientConfig.Builder().withConnectionTimeoutMillis( connectionTimeout ).
                withIdleConnectionTTLMillis( idleConnectionTTL ).
                withPoolSize( maxPoolSize ).
                withInitialPoolSize( initialPoolSize ).
                withSocketBufferSizeKb( socketBufferSize ).
                withHost( host ).withPort( port ).build();
            pbClusterConfig.addClient( clientConfig );
        }
        riakClient = RiakFactory.newClient( pbClusterConfig );

        if( !riakClient.listBuckets().contains( bucketKey ) )
        {
View Full Code Here

    /**
     * @param riakLocatons
     * @return a cluster client of PB clients
     */
    private static IRiakClient pbClusterClient(RiakLocation[] riakLocatons) throws RiakException {
        PBClusterConfig conf = new PBClusterConfig(500); // TODO make this config
       
        for (RiakLocation loc : riakLocatons) {
            if(!RiakTransport.PB.equals(loc.getTransport())) {
                throw new IllegalArgumentException("Cluster clients must be homogenous");
            }
            conf.addClient(new PBClientConfig.Builder()
                .withHost(loc.getHost())
                .withPort(loc.getPort())
                .build());
        }
        return RiakFactory.newClient(conf);
View Full Code Here

TOP

Related Classes of com.basho.riak.client.raw.pbc.PBClusterConfig

Copyright © 2018 www.massapicom. 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.