Avoiding shutting down couchbase java client


Is there a way to reuse a couchbase java client connection? I always have to shutdown the connection when making queries in for loop, otherwise I get an out of memory.

Shutting down the connection each time is just inefficient in my use case

Thanks for your help !


shutting down the SDK every time is a anti-pattern and should be avoided. Common practice is to create a CouchbaseClient() instance once and then share it across threads, since it is thread safe.

For example, see http://docs.couchbase.com/couchbase-sdk-java-1.4/index.html#managing-connections