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
One other thing to notice is RiakClient's cleanup() method
since you are working in a servlet / container environment.
On Mon, Nov 21, 2016 at 3:49 PM, Konstantin Kalin <
> 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,
> riak-users mailing list
riak-users mailing list