com.github.davidmoten.rx.jdbc.ConnectionProviderBatch Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rxjava-jdbc Show documentation
Show all versions of rxjava-jdbc Show documentation
rx-java Observables for jdbc
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();
}
}