Hi Alex, the code bellow is used to set up the Riak Client (if no one is
already started) or share the client with the threads.

 public RiakClient getDB() throws UnknownHostException {
        if (client == null) {
            client = RiakClient.newClient("localhost");
        }
        return client;
    }

According to the Java library's documentation on GitHub, the object
returned as a client could be used by multiple threads...
The class where I'm doing this is a singleton class, in a facade model.

Att.,

*Allexandre Sampaio*
*Sistemas de Informação - IFBA*
*Vitória da Conquista - BA*
*(77) 99964 3521*

2017-04-14 22:13 GMT-03:00 Alex Moore <amo...@basho.com>:

> Hi Allexandre,
>
> Could you share your code for setting up the RiakNode/RiakCluster/RiakClient
> objects on the Java side, and how you are sharing them amongst your worker
> threads?
>
> Thanks,
> Alex
> Clients Team Lead
>
> On Thu, Apr 13, 2017 at 6:09 PM, Allexandre Sampaio <
> allexandre...@gmail.com> wrote:
>
>> Hi, I'm using Riak TS in a multithreaded application, running on an
>> Ubuntu 16.04 server, for a college project. The library I'm using is
>> riak-client-2.1.1, with all of its dependencies.
>> The problem starts when I try to set more than some dozens threads, so
>> the Riak service starts to refuse the connection and throw errors.
>> I've checked and all the threads are using the same client (that is
>> thread safe, according to its docs).
>> I also tried to change the riak conf file to allow the maximum of threads
>> (1024), but it didn't change nothing...
>>
>> Need help.
>> Thanks!
>>
>> Att.,
>> *Allexandre Sampaio*
>> *Sistemas de Informação - IFBA*
>>
>> *Vitória da Conquista - BA, Brasil*
>> *(77) 99964 3521*
>>
>> _______________________________________________
>> riak-users mailing list
>> riak-users@lists.basho.com
>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>>
>>
>
_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to