All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.instaclustr.cassandra.service.DefaultCqlSessionService Maven / Gradle / Ivy

There is a newer version: 2.0.0
Show newest version
package com.instaclustr.cassandra.service;

import com.datastax.oss.driver.api.core.CqlSession;
import com.instaclustr.operations.FunctionWithEx;

public class DefaultCqlSessionService implements CqlSessionService {

    @Override
    public CqlSession getCqlSession() {
        return createCqlSession();
    }

    @Override
    public  T doWithCqlSession(final FunctionWithEx func) throws Exception {
        try (final CqlSession session = createCqlSession()) {
            return func.apply(session);
        }
    }

    protected CqlSession createCqlSession() {
        return CqlSession.builder().build();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy