Example usage for com.mongodb.client ClientSession getServerSession

List of usage examples for com.mongodb.client ClientSession getServerSession

Introduction

In this page you can find the example usage for com.mongodb.client ClientSession getServerSession.

Prototype

ServerSession getServerSession();

Source Link

Usage

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

License:Open Source License

public static UUID getSid(ClientSession cs) {
    if (cs != null && cs.getServerSession() != null && cs.getServerSession().getIdentifier() != null
            && cs.getServerSession().getIdentifier().isDocument()
            && cs.getServerSession().getIdentifier().asDocument().containsKey("id")
            && cs.getServerSession().getIdentifier().asDocument().get("id").isBinary()) {
        return cs.getServerSession().getIdentifier().asDocument().get("id").asBinary().asUuid();
    } else {/*from  w  w w.  jav  a  2  s  .c  om*/
        return null;
    }
}