Example usage for com.mongodb ClientSessionOptions builder

List of usage examples for com.mongodb ClientSessionOptions builder

Introduction

In this page you can find the example usage for com.mongodb ClientSessionOptions builder.

Prototype

public static Builder builder(final ClientSessionOptions options) 

Source Link

Document

Gets an instance of a builder initialized with the given options

Usage

From source file:org.restheart.db.sessions.ClientSessionFactory.java

License:Open Source License

ClientSessionImpl createClientSession(UUID sid, final ClientSessionOptions options,
        final ReadConcern readConcern, final WriteConcern writeConcern, final ReadPreference readPreference) {
    notNull("readConcern", readConcern);
    notNull("writeConcern", writeConcern);
    notNull("readPreference", readPreference);

    // TODO allow request to specify session and txn options
    ClientSessionOptions mergedOptions = ClientSessionOptions.builder(options).causallyConsistent(true).build();

    ClientSessionImpl cs = new ClientSessionImpl(new SimpleServerSessionPool(SessionsUtils.getCluster(), sid),
            mClient, mergedOptions, SessionsUtils.getMongoClientDelegate());

    return cs;/*w w w.j a va 2  s  . c o  m*/
}