Hi Konstantin, The RiakClient class is reentrant and thread-safe, so you should be able to share it among the different workers. You may have to adjust the min / max connection settings to get the most performance, but that's relatively easy.
One other thing to notice is RiakClient's cleanup() method <http://basho.github.io/riak-java-client/2.1.0/com/basho/riak/client/api/RiakClient.html#cleanup-->, since you are working in a servlet / container environment. Thanks, Alex On Mon, Nov 21, 2016 at 3:49 PM, Konstantin Kalin < konstantin.ka...@gmail.com> wrote: > I'm currently migrating Java client from 1.4 to 2.1 and I have a question > about RiakCluster class. > > We hide Riak Java API by our interface since we use multiple backends and > Riak is one of them. > Let's say I have two independent business activities that makes calls to > Riak cluster. Both activities are executed within same Tomcat instance. > Currently we use two RiakClient instances (1.4). Each activity initializes > its own RiakClient. > Since I do the migration I cannot decide. Would it have more sense to > create a "singleton" object that will own RiakCluster instead of creating > two instances? What should I consider as recommended approach? > > Thank you, > Konstantin. > > _______________________________________________ > 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