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

com.github.davidmoten.rx.jdbc.ConnectionProviderBatch Maven / Gradle / Ivy

The newest version!
package com.github.davidmoten.rx.jdbc;

import com.github.davidmoten.guavamini.Preconditions;

class ConnectionProviderBatch implements ConnectionProvider {

    private final int batchSize;
    private final ConnectionProvider cp;
    private ConnectionBatch con;

    ConnectionProviderBatch(ConnectionProvider cp, int batchSize) {
        Preconditions.checkNotNull(cp, "cp should not be null");
        this.cp = cp;
        this.batchSize = batchSize;
    }

    @Override
    public ConnectionBatch get() {
        if (con == null) {
            con = new ConnectionBatch(cp.get(), batchSize);
        }
        return con;
    }

    @Override
    public void close() {
        cp.close();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy