protected void onSessionClose(SessionImpl session) {
        Lock lock = lockManager.getLock(getLockingKey(session.keyspace()));
        lock.lock();
        try {
            if (keyspaceCacheMap.containsKey(session.keyspace())) {
                KeyspaceCacheContainer cacheContainer = keyspaceCacheMap.get(session.keyspace());
                cacheContainer.removeSessionReference(session);
                // If there are no more sessions associated to current keyspace,
                // close graph and remove reference from cache.
                if (cacheContainer.referenceCount() == 0) {
                    JanusGraph graph = cacheContainer.graph();
                    graph.close();
                    keyspaceCacheMap.remove(session.keyspace());
                }
            }
        } finally {
            lock.unlock();
        }
    }
protected void onSessionClose ( SessionImpl session ) { Lock lock = lockManager . getLock ( getLockingKey ( session . keyspace ( ) ) ) ; lock . lock ( ) ; try { if ( keyspaceCacheMap . containsKey ( session . keyspace ( ) ) ) { KeyspaceCacheContainer cacheContainer = keyspaceCacheMap . get ( session . keyspace ( ) ) ; cacheContainer . removeSessionReference ( session ) ; if ( cacheContainer . referenceCount ( ) == 0 ) { JanusGraph graph = cacheContainer . graph ( ) ; graph . close ( ) ; keyspaceCacheMap . remove ( session . keyspace ( ) ) ; } } } finally { lock . unlock ( ) ; } }
Callback function invoked by Session when it gets closed.
This access the keyspaceCacheMap to remove the reference of closed session.

@param session SessionImpl that is being closed