public synchronized void close ( ) { if ( ! isClosed ) { if ( bucket != null ) { LOG . debug ( "Closing Couchbase bucket" ) ; bucket . close ( ) ; } if ( cluster != null ) { LOG . debug ( "Disconnecting Couchbase cluster" ) ; cluster . disconnect ( ) ; } if ( env != null ) { LOG . debug ( "Shutting down Couchbase environment" ) ; env . shutdown ( ) ; } // Explicitly shutdown the RxJava scheduler threads. Not doing so will leak threads when a pipeline stops. // Note: this disallows restarting scheduler threads without also explicitly calling Schedulers.start() // LOG.debug("Stopping RxJava schedulers"); // Schedulers.shutdown(); isClosed = true ; } }
Disconnects from Couchbase and releases all resources