After using a bit of the java client API of Couchbase (2.4.1) I ran into this exception:
Error in scheduled task java.lang.IllegalStateException:
The Content of this Observable is already released.
Subscribe earlier or tune the CouchbaseEnvironment#autoreleaseAfter() setting.
I was using a ViewQuery in imperative mode, it fails when getting the rows from the result (ViewResult is correct as totalRows() and success() have nice values)
ViewResult result = service.executeViewQuery(...);
List<ViewRow> rows = result.allRows();
Effectively setting up autoreleaseAfter solves the problem but I don't know if it is safe or just side-stepping the problem.
CouchbaseEnvironment env = DefaultCouchbaseEnvironment
.builder()
.autoreleaseAfter(5000)
.build();
I guess this mode doesn't close the connection after a query, it lets it live until the timeout (5 seconds) is achieved.
Does it close automatically "earlier" if the http call is finished (using Spring MVC)? It seems that mode brings danger as it can hold more connections but does it really matter?
Finally I feel that the "correct" use of this API is to go through rxjava Observable API whereas most of the documentation found only show imperative examples. Is autorelease mode out of date (and going to become deprecated) or is it still going to be supported in near future?