org.infinispan.persistence.jdbc.configuration.JdbcMixedStoreConfigurationBuilder Maven / Gradle / Ivy
package org.infinispan.persistence.jdbc.configuration;
import java.util.Map;
import java.util.Properties;
import org.infinispan.commons.CacheConfigurationException;
import org.infinispan.configuration.cache.PersistenceConfigurationBuilder;
import org.infinispan.configuration.parsing.XmlConfigHelper;
import org.infinispan.persistence.jdbc.TableManipulation;
import org.infinispan.persistence.keymappers.DefaultTwoWayKey2StringMapper;
import org.infinispan.persistence.keymappers.Key2StringMapper;
/**
*
* JdbcMixedCacheStoreConfigurationBuilder.
*
* @author Tristan Tarrant
* @since 5.2
*/
public class JdbcMixedStoreConfigurationBuilder extends AbstractJdbcStoreConfigurationBuilder
implements JdbcMixedStoreConfigurationChildBuilder {
private final MixedTableManipulationConfigurationBuilder binaryTable;
private final MixedTableManipulationConfigurationBuilder stringTable;
private String key2StringMapper = DefaultTwoWayKey2StringMapper.class.getName();
private int batchSize = TableManipulation.DEFAULT_BATCH_SIZE;
private int fetchSize = TableManipulation.DEFAULT_FETCH_SIZE;
private int lockConcurrencyLevel = JdbcBinaryStoreConfigurationBuilder.DEFAULT_CONCURRENCY_LEVEL;
private long lockAcquisitionTimeout = JdbcBinaryStoreConfigurationBuilder.DEFAULT_LOCK_ACQUISITION_TIMEOUT;
public JdbcMixedStoreConfigurationBuilder(PersistenceConfigurationBuilder builder) {
super(builder);
this.binaryTable = new MixedTableManipulationConfigurationBuilder(this);
this.stringTable = new MixedTableManipulationConfigurationBuilder(this);
}
@Override
public JdbcMixedStoreConfigurationBuilder self() {
return this;
}
/**
* When doing repetitive DB inserts this will be batched
* according to this parameter. This is an optional parameter, and if it is not specified it will
* be defaulted to {@link org.infinispan.persistence.jdbc.TableManipulation#DEFAULT_BATCH_SIZE}.
*/
public JdbcMixedStoreConfigurationBuilder batchSize(int batchSize) {
this.batchSize = batchSize;
return this;
}
/**
* For DB queries the fetch size will be set on {@link java.sql.ResultSet#setFetchSize(int)}. This is optional
* parameter, if not specified will be defaulted to {@link org.infinispan.persistence.jdbc.TableManipulation#DEFAULT_FETCH_SIZE}.
*/
public JdbcMixedStoreConfigurationBuilder fetchSize(int fetchSize) {
this.fetchSize = fetchSize;
return this;
}
/**
* Allows configuration of table-specific parameters such as column names and types for the table
* used to store entries with binary keys
*/
@Override
public MixedTableManipulationConfigurationBuilder binaryTable() {
return binaryTable;
}
/**
* Allows configuration of table-specific parameters such as column names and types for the table
* used to store entries with string keys
*/
@Override
public MixedTableManipulationConfigurationBuilder stringTable() {
return stringTable;
}
@Override
public JdbcMixedStoreConfigurationBuilder withProperties(Properties props) {
Map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy