Author: mircea.markus
Date: 2009-03-09 09:58:08 -0400 (Mon, 09 Mar 2009)
New Revision: 7891
Modified:
core/branches/flat/src/main/java/org/horizon/loader/AbstractCacheStore.java
core/branches/flat/src/main/java/org/horizon/loader/file/FileCacheStore.java
core/branches/flat/src/main/java/org/horizon/loader/jdbc/TableManipulation.java
core/branches/flat/src/main/java/org/horizon/loader/jdbc/binary/JdbcBinaryCacheStore.java
core/branches/flat/src/main/java/org/horizon/loader/jdbc/binary/JdbcBinaryCacheStoreConfig.java
core/branches/flat/src/main/java/org/horizon/loader/jdbc/mixed/JdbcMixedCacheStoreConfig.java
core/branches/flat/src/main/java/org/horizon/loader/jdbc/stringbased/JdbcStringBasedCacheStore.java
core/branches/flat/src/main/java/org/horizon/loader/jdbc/stringbased/JdbcStringBasedCacheStoreConfig.java
Log:
1.batchSize and readSize are now configurable
2. created an marshaller field in AbstractCacheStore
Modified: core/branches/flat/src/main/java/org/horizon/loader/AbstractCacheStore.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/loader/AbstractCacheStore.java 2009-03-09
09:05:21 UTC (rev 7890)
+++ core/branches/flat/src/main/java/org/horizon/loader/AbstractCacheStore.java 2009-03-09
13:58:08 UTC (rev 7891)
@@ -35,8 +35,11 @@
private ExecutorService purgerService;
+ private Marshaller marshaller;
+
public void init(CacheLoaderConfig config, Cache cache, Marshaller m) {
this.config = (AbstractCacheStoreConfig) config;
+ this.marshaller = m;
if (config == null) throw new IllegalStateException("Null config!!!");
}
@@ -129,4 +132,8 @@
throw new CacheLoaderException("Problems closing output stream", e);
}
}
+
+ protected Marshaller getMarshaller() {
+ return marshaller;
+ }
}
Modified: core/branches/flat/src/main/java/org/horizon/loader/file/FileCacheStore.java
===================================================================
---
core/branches/flat/src/main/java/org/horizon/loader/file/FileCacheStore.java 2009-03-09
09:05:21 UTC (rev 7890)
+++
core/branches/flat/src/main/java/org/horizon/loader/file/FileCacheStore.java 2009-03-09
13:58:08 UTC (rev 7891)
@@ -30,7 +30,6 @@
FileCacheStoreConfig config;
Cache cache;
- Marshaller marshaller;
File root;
/**
@@ -44,7 +43,6 @@
super.init(config, cache, m);
this.config = (FileCacheStoreConfig) config;
this.cache = cache;
- this.marshaller = m;
}
protected Set<StoredEntry> loadAllLockSafe() throws CacheLoaderException {
Modified: core/branches/flat/src/main/java/org/horizon/loader/jdbc/TableManipulation.java
===================================================================
---
core/branches/flat/src/main/java/org/horizon/loader/jdbc/TableManipulation.java 2009-03-09
09:05:21 UTC (rev 7890)
+++
core/branches/flat/src/main/java/org/horizon/loader/jdbc/TableManipulation.java 2009-03-09
13:58:08 UTC (rev 7891)
@@ -22,6 +22,10 @@
private static Log log = LogFactory.getLog(TableManipulation.class);
+ public static final int DEFAULT_FETCH_SIZE = 100;
+
+ public static final int DEFAULT_BATCH_SIZE = 100;
+
private String idColumnName;
private String idColumnType;
private String tableName;
@@ -29,6 +33,8 @@
private String dataColumnType;
private String timestampColumnName;
private String timestampColumnType;
+ private int fetchSize = DEFAULT_FETCH_SIZE;
+ private int batchSize = DEFAULT_BATCH_SIZE;
/*
* following two params manage creation and destruction during start up/shutdown.
@@ -331,4 +337,36 @@
public String getTimestampColumnType() {
return timestampColumnType;
}
+
+ /**
+ * For DB queries (e.g. {@link
org.horizon.loader.CacheStore#toStream(java.io.ObjectOutput)} ) 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 #DEFAULT_FETCH_SIZE}.
+ */
+ public int getFetchSize() {
+ return fetchSize;
+ }
+
+ /**
+ * @see #getFetchSize()
+ */
+ public void setFetchSize(int fetchSize) {
+ this.fetchSize = fetchSize;
+ }
+
+ /**
+ * When doing repetitive DB inserts (e.g. on {@link
org.horizon.loader.CacheStore#fromStream(java.io.ObjectInput)}
+ * 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 #DEFAULT_BATCH_SIZE}.
+ */
+ public int getBatchSize() {
+ return batchSize;
+ }
+
+ /**
+ * @see #getBatchSize()
+ */
+ public void setBatchSize(int batchSize) {
+ this.batchSize = batchSize;
+ }
}
Modified:
core/branches/flat/src/main/java/org/horizon/loader/jdbc/binary/JdbcBinaryCacheStore.java
===================================================================
---
core/branches/flat/src/main/java/org/horizon/loader/jdbc/binary/JdbcBinaryCacheStore.java 2009-03-09
09:05:21 UTC (rev 7890)
+++
core/branches/flat/src/main/java/org/horizon/loader/jdbc/binary/JdbcBinaryCacheStore.java 2009-03-09
13:58:08 UTC (rev 7891)
@@ -48,7 +48,6 @@
private JdbcBinaryCacheStoreConfig config;
private ConnectionFactory connectionFactory;
- private Marshaller marshaller;
private TableManipulation tableManipulation;
public void init(CacheLoaderConfig config, Cache cache, Marshaller m) {
@@ -56,7 +55,6 @@
log.trace("Initializing JdbcBinaryCacheStore " + config);
super.init(config, cache, m);
this.config = (JdbcBinaryCacheStoreConfig) config;
- this.marshaller = m;
}
public void start() throws CacheLoaderException {
@@ -86,7 +84,7 @@
}
conn = connectionFactory.getConnection();
ps = conn.prepareStatement(sql);
- ByteBuffer byteBuffer = JdbcUtil.marshall(marshaller, bucket);
+ ByteBuffer byteBuffer = JdbcUtil.marshall(getMarshaller(), bucket);
ps.setBinaryStream(1, byteBuffer.getStream(), byteBuffer.getLength());
ps.setLong(2, bucket.timestampOfFirstEntryToExpire());
ps.setString(3, bucket.getBucketName());
@@ -112,7 +110,7 @@
}
conn = connectionFactory.getConnection();
ps = conn.prepareStatement(sql);
- ByteBuffer buffer = JdbcUtil.marshall(marshaller, bucket);
+ ByteBuffer buffer = JdbcUtil.marshall(getMarshaller(), bucket);
ps.setBinaryStream(1, buffer.getStream(), buffer.getLength());
ps.setLong(2, bucket.timestampOfFirstEntryToExpire());
ps.setString(3, bucket.getBucketName());
@@ -144,7 +142,7 @@
if (!rs.next()) return null;
String bucketName = rs.getString(1);
InputStream inputStream = rs.getBinaryStream(2);
- Bucket bucket = (Bucket) JdbcUtil.unmarshall(marshaller, inputStream);
+ Bucket bucket = (Bucket) JdbcUtil.unmarshall(getMarshaller(), inputStream);
bucket.setBucketName(bucketName);//bucket name is volatile, so not persisted.
return bucket;
} catch (SQLException e) {
@@ -170,10 +168,11 @@
conn = connectionFactory.getConnection();
ps = conn.prepareStatement(sql);
rs = ps.executeQuery();
+ rs.setFetchSize(config.getFetchSize());
Set<StoredEntry> result = new HashSet<StoredEntry>();
while (rs.next()) {
InputStream binaryStream = rs.getBinaryStream(1);
- Bucket bucket = (Bucket) JdbcUtil.unmarshall(marshaller, binaryStream);
+ Bucket bucket = (Bucket) JdbcUtil.unmarshall(getMarshaller(), binaryStream);
result.addAll(bucket.getStoredEntries());
}
return result;
@@ -197,12 +196,12 @@
ps = conn.prepareStatement(sql);
int readBuckets = 0;
- int batchSize = 100;
+ int batchSize = config.getBatchSize();
String bucketName = (String) objectInput.readObject();
while (!bucketName.equals(BINARY_STREAM_DELIMITER)) {
Bucket bucket = (Bucket) objectInput.readObject();
readBuckets++;
- ByteBuffer buffer = JdbcUtil.marshall(marshaller, bucket);
+ ByteBuffer buffer = JdbcUtil.marshall(getMarshaller(), bucket);
ps.setBinaryStream(1, buffer.getStream(), buffer.getLength());
ps.setLong(2, bucket.timestampOfFirstEntryToExpire());
ps.setString(3, bucketName);
@@ -240,10 +239,10 @@
String sql = tableManipulation.getLoadAllRowsSql();
ps = conn.prepareStatement(sql);
rs = ps.executeQuery();
- rs.setFetchSize(100);
+ rs.setFetchSize(config.getFetchSize());
while (rs.next()) {
InputStream inputStream = rs.getBinaryStream(1);
- Bucket bucket = (Bucket) JdbcUtil.unmarshall(marshaller, inputStream);
+ Bucket bucket = (Bucket) JdbcUtil.unmarshall(getMarshaller(), inputStream);
String bucketName = rs.getString(2);
objectOutput.writeObject(bucketName);
objectOutput.writeObject(bucket);
@@ -296,7 +295,7 @@
if (immediateLockForWritting(key)) {
if (log.isTraceEnabled()) log.trace("Adding bucket keyed " + key
+ " for purging.");
InputStream binaryStream = rs.getBinaryStream(1);
- Bucket bucket = (Bucket) JdbcUtil.unmarshall(marshaller, binaryStream);
+ Bucket bucket = (Bucket) JdbcUtil.unmarshall(getMarshaller(),
binaryStream);
bucket.setBucketName(key);
expiredBuckets.add(bucket);
} else {
@@ -329,7 +328,7 @@
Bucket bucket = it.next();
bucket.removeExpiredEntries();
if (!bucket.isEmpty()) {
- ByteBuffer byteBuffer = JdbcUtil.marshall(marshaller, bucket);
+ ByteBuffer byteBuffer = JdbcUtil.marshall(getMarshaller(), bucket);
ps.setBinaryStream(1, byteBuffer.getStream(), byteBuffer.getLength());
ps.setLong(2, bucket.timestampOfFirstEntryToExpire());
ps.addBatch();
Modified:
core/branches/flat/src/main/java/org/horizon/loader/jdbc/binary/JdbcBinaryCacheStoreConfig.java
===================================================================
---
core/branches/flat/src/main/java/org/horizon/loader/jdbc/binary/JdbcBinaryCacheStoreConfig.java 2009-03-09
09:05:21 UTC (rev 7890)
+++
core/branches/flat/src/main/java/org/horizon/loader/jdbc/binary/JdbcBinaryCacheStoreConfig.java 2009-03-09
13:58:08 UTC (rev 7891)
@@ -143,6 +143,37 @@
}
public void setTableManipulation(TableManipulation tableManipulation) {
+ testImmutability("tableManipulation");
this.tableManipulation = tableManipulation;
}
+
+ /**
+ * @see org.horizon.loader.jdbc.TableManipulation#getFetchSize()
+ */
+ public void setFetchSize(int fetchSize) {
+ testImmutability("tableManipulation");
+ this.tableManipulation.setFetchSize(fetchSize);
+ }
+
+ /**
+ * @see org.horizon.loader.jdbc.TableManipulation#getBatchSize()
+ */
+ public void setBatchSize(int batchSize) {
+ testImmutability("tableManipulation");
+ this.tableManipulation.setBatchSize(batchSize);
+ }
+
+ /**
+ * @see org.horizon.loader.jdbc.TableManipulation#getFetchSize()
+ */
+ public int getFetchSize() {
+ return this.tableManipulation.getFetchSize();
+ }
+
+ /**
+ * @see org.horizon.loader.jdbc.TableManipulation#getBatchSize()
+ */
+ public int getBatchSize() {
+ return this.tableManipulation.getBatchSize();
+ }
}
Modified:
core/branches/flat/src/main/java/org/horizon/loader/jdbc/mixed/JdbcMixedCacheStoreConfig.java
===================================================================
---
core/branches/flat/src/main/java/org/horizon/loader/jdbc/mixed/JdbcMixedCacheStoreConfig.java 2009-03-09
09:05:21 UTC (rev 7890)
+++
core/branches/flat/src/main/java/org/horizon/loader/jdbc/mixed/JdbcMixedCacheStoreConfig.java 2009-03-09
13:58:08 UTC (rev 7891)
@@ -34,14 +34,17 @@
}
public void setConnectionFactoryConfig(ConnectionFactoryConfig
connectionFactoryConfig) {
+ testImmutability("connectionFactoryConfig");
this.connectionFactoryConfig = connectionFactoryConfig;
}
public void setBinaryTableManipulation(TableManipulation binaryTableManipulation) {
+ testImmutability("binaryTableManipulation");
this.binaryTableManipulation = binaryTableManipulation;
}
public void setStringsTableManipulation(TableManipulation stringsTableManipulation) {
+ testImmutability("stringsTableManipulation");
this.stringsTableManipulation = stringsTableManipulation;
}
@@ -65,14 +68,17 @@
}
public void setIdColumnNameForStrings(String idColumnNameForStrings) {
+ testImmutability("stringsTableManipulation");
this.stringsTableManipulation.setIdColumnName(idColumnNameForStrings);
}
public void setIdColumnTypeForStrings(String idColumnTypeForStrings) {
+ testImmutability("stringsTableManipulation");
this.stringsTableManipulation.setIdColumnType(idColumnTypeForStrings);
}
public void setTableNameForStrings(String tableNameForStrings) {
+ testImmutability("stringsTableManipulation");
if (tableNameForStrings == null) throw new IllegalArgumentException("Null
table name not allowed.");
if (tableNameForStrings.equals(this.binaryTableManipulation.getTableName())) {
throw new IllegalArgumentException("Same table name is used for both cache
loaders, this is not allowed!");
@@ -81,26 +87,32 @@
}
public void setDataColumnNameForStrings(String dataColumnNameForStrings) {
+ testImmutability("stringsTableManipulation");
this.stringsTableManipulation.setDataColumnName(dataColumnNameForStrings);
}
public void setDataColumnTypeForStrings(String dataColumnTypeForStrings) {
+ testImmutability("stringsTableManipulation");
this.stringsTableManipulation.setDataColumnType(dataColumnTypeForStrings);
}
public void setTimestampColumnNameForStrings(String timestampColumnNameForStrings) {
+ testImmutability("stringsTableManipulation");
this.stringsTableManipulation.setTimestampColumnName(timestampColumnNameForStrings);
}
public void setTimestampColumnTypeForStrings(String timestampColumnTypeForStrings) {
+ testImmutability("stringsTableManipulation");
this.stringsTableManipulation.setTimestampColumnType(timestampColumnTypeForStrings);
}
public void setCreateTableOnStartForStrings(boolean createTableOnStartForStrings) {
+ testImmutability("stringsTableManipulation");
this.stringsTableManipulation.setCreateTableOnStart(createTableOnStartForStrings);
}
public void setDropTableOnExitForStrings(boolean dropTableOnExitForStrings) {
+ testImmutability("stringsTableManipulation");
this.stringsTableManipulation.setDropTableOnExit(dropTableOnExitForStrings);
}
@@ -109,10 +121,12 @@
}
public void setIdColumnTypeForBinary(String idColumnTypeForBinary) {
+ testImmutability("stringsTableManipulation");
this.binaryTableManipulation.setIdColumnType(idColumnTypeForBinary);
}
public void setTableNameForBinary(String tableNameForBinary) {
+ testImmutability("binaryTableManipulation");
if (tableNameForBinary == null) throw new IllegalArgumentException("Null table
name not allowed.");
if (tableNameForBinary.equals(this.stringsTableManipulation.getTableName())) {
throw new IllegalArgumentException("Same table name is used for both cache
loaders, this is not allowed!");
@@ -121,14 +135,17 @@
}
public void setDataColumnNameForBinary(String dataColumnNameForBinary) {
+ testImmutability("binaryTableManipulation");
this.binaryTableManipulation.setDataColumnName(dataColumnNameForBinary);
}
public void setDataColumnTypeForBinary(String dataColumnTypeForBinary) {
+ testImmutability("binaryTableManipulation");
this.binaryTableManipulation.setDataColumnType(dataColumnTypeForBinary);
}
public void setTimestampColumnNameForBinary(String timestampColumnNameForBinary) {
+ testImmutability("binaryTableManipulation");
this.binaryTableManipulation.setTimestampColumnName(timestampColumnNameForBinary);
}
@@ -137,26 +154,32 @@
}
public void setCreateTableOnStartForBinary(boolean createTableOnStartForBinary) {
+ testImmutability("binaryTableManipulation");
this.binaryTableManipulation.setCreateTableOnStart(createTableOnStartForBinary);
}
public void setDropTableOnExitForBinary(boolean dropTableOnExitForBinary) {
+ testImmutability("binaryTableManipulation");
this.binaryTableManipulation.setDropTableOnExit(dropTableOnExitForBinary);
}
public void setDriverClass(String driverClass) {
+ testImmutability("connectionFactoryConfig");
this.connectionFactoryConfig.setDriverClass(driverClass);
}
public void setConnectionUrl(String connectionUrl) {
+ testImmutability("connectionFactoryConfig");
this.connectionFactoryConfig.setConnectionUrl(connectionUrl);
}
public void setUserName(String userName) {
+ testImmutability("connectionFactoryConfig");
this.connectionFactoryConfig.setUserName(userName);
}
public void setPassword(String password) {
+ testImmutability("connectionFactoryConfig");
this.connectionFactoryConfig.setPassword(password);
}
@@ -165,18 +188,40 @@
}
public void setKey2StringMapperClass(String name) {
- this.key2StringMapper = name;
+ testImmutability("key2StringMapper");
+ this.key2StringMapper = name;
}
public void setLockConcurrencyLevelForStrings(int concurrencyLevel) {
+ testImmutability("stringsConcurrencyLevel");
this.stringsConcurrencyLevel = concurrencyLevel;
}
public void setLockConcurrencyLevelForBinary(int concurrencyLevel) {
+ testImmutability("binaryConcurrencyLevel");
this.binaryConcurrencyLevel = concurrencyLevel;
}
public void setLockAcquistionTimeout(int lockAcquistionTimeout) {
+ testImmutability("lockAcquistionTimeout");
this.lockAcquistionTimeout = lockAcquistionTimeout;
}
+
+ /**
+ * @see org.horizon.loader.jdbc.TableManipulation#getFetchSize()
+ */
+ public void setFetchSize(int fetchSize) {
+ testImmutability("tableManipulation");
+ this.binaryTableManipulation.setFetchSize(fetchSize);
+ this.stringsTableManipulation.setFetchSize(fetchSize);
+ }
+
+ /**
+ * @see org.horizon.loader.jdbc.TableManipulation#getBatchSize()
+ */
+ public void setBatchSize(int batchSize) {
+ testImmutability("tableManipulation");
+ this.binaryTableManipulation.setBatchSize(batchSize);
+ this.stringsTableManipulation.setBatchSize(batchSize);
+ }
}
Modified:
core/branches/flat/src/main/java/org/horizon/loader/jdbc/stringbased/JdbcStringBasedCacheStore.java
===================================================================
---
core/branches/flat/src/main/java/org/horizon/loader/jdbc/stringbased/JdbcStringBasedCacheStore.java 2009-03-09
09:05:21 UTC (rev 7890)
+++
core/branches/flat/src/main/java/org/horizon/loader/jdbc/stringbased/JdbcStringBasedCacheStore.java 2009-03-09
13:58:08 UTC (rev 7891)
@@ -49,12 +49,9 @@
private Key2StringMapper key2StringMapper;
private ConnectionFactory connectionFactory;
private TableManipulation tableManipulation;
- private Marshaller marshaller;
-
public void init(CacheLoaderConfig config, Cache cache, Marshaller m) {
super.init(config, cache, m);
this.config = (JdbcStringBasedCacheStoreConfig) config;
- this.marshaller = m;
}
@Override
@@ -98,7 +95,7 @@
try {
connection = connectionFactory.getConnection();
ps = connection.prepareStatement(sql);
- ByteBuffer byteBuffer = JdbcUtil.marshall(marshaller, ed);
+ ByteBuffer byteBuffer = JdbcUtil.marshall(getMarshaller(), ed);
ps.setBinaryStream(1, byteBuffer.getStream(), byteBuffer.getLength());
ps.setLong(2, ed.getExpiryTime());
ps.setString(3, lockingKey);
@@ -140,13 +137,13 @@
ps = conn.prepareStatement(sql);
int readStoredEntries = 0;
- int batchSize = 100;
+ int batchSize = config.getBatchSize();
Object objFromStream = objectInput.readObject();
while (!objFromStream.equals(STRING_STREAM_DELIMITER)) {
StoredEntry se = (StoredEntry) objFromStream;
readStoredEntries++;
String key = key2StringMapper.getStringMapping(se.getKey());
- ByteBuffer buffer = JdbcUtil.marshall(marshaller, se);
+ ByteBuffer buffer = JdbcUtil.marshall(getMarshaller(), se);
ps.setBinaryStream(1, buffer.getStream(), buffer.getLength());
ps.setLong(2, se.getExpiryTime());
ps.setString(3, key);
@@ -185,9 +182,10 @@
connection = connectionFactory.getConnection();
ps = connection.prepareStatement(sql);
rs = ps.executeQuery();
+ rs.setFetchSize(config.getFetchSize());
while (rs.next()) {
InputStream is = rs.getBinaryStream(1);
- StoredEntry se = (StoredEntry) JdbcUtil.unmarshall(marshaller, is);
+ StoredEntry se = (StoredEntry) JdbcUtil.unmarshall(getMarshaller(), is);
objectOutput.writeObject(se);
}
objectOutput.writeObject(STRING_STREAM_DELIMITER);
@@ -251,11 +249,11 @@
conn = connectionFactory.getConnection();
ps = conn.prepareStatement(sql);
rs = ps.executeQuery();
- rs.setFetchSize(100);
+ rs.setFetchSize(config.getFetchSize());
Set<StoredEntry> result = new HashSet<StoredEntry>();
while (rs.next()) {
InputStream inputStream = rs.getBinaryStream(1);
- StoredEntry se = (StoredEntry) JdbcUtil.unmarshall(marshaller, inputStream);
+ StoredEntry se = (StoredEntry) JdbcUtil.unmarshall(getMarshaller(),
inputStream);
result.add(se);
}
return result;
@@ -282,7 +280,7 @@
rs = ps.executeQuery();
if (rs.next()) {
InputStream inputStream = rs.getBinaryStream(2);
- StoredEntry storedEntry = (StoredEntry) JdbcUtil.unmarshall(marshaller,
inputStream);
+ StoredEntry storedEntry = (StoredEntry) JdbcUtil.unmarshall(getMarshaller(),
inputStream);
if (storedEntry.isExpired()) {
if (log.isTraceEnabled()) {
log.trace("Not returning '" + storedEntry + "'
as it is expired. It will be removed from DB by purging thread!");
Modified:
core/branches/flat/src/main/java/org/horizon/loader/jdbc/stringbased/JdbcStringBasedCacheStoreConfig.java
===================================================================
---
core/branches/flat/src/main/java/org/horizon/loader/jdbc/stringbased/JdbcStringBasedCacheStoreConfig.java 2009-03-09
09:05:21 UTC (rev 7890)
+++
core/branches/flat/src/main/java/org/horizon/loader/jdbc/stringbased/JdbcStringBasedCacheStoreConfig.java 2009-03-09
13:58:08 UTC (rev 7891)
@@ -51,6 +51,7 @@
* @see org.horizon.loader.jdbc.stringbased.Key2StringMapper
*/
public void setKey2StringMapperClass(String className) {
+ testImmutability("key2StringMapper");
try {
key2StringMapper = (Key2StringMapper) Util.getInstance(className);
} catch (Exception e) {
@@ -62,6 +63,7 @@
* Sets the name of the table where data will be stored.
*/
public void setStringsTableName(String stringsTableName) {
+ testImmutability("tableManipulation");
this.tableManipulation.setTableName(stringsTableName);
}
@@ -73,6 +75,7 @@
* Mandatory.
*/
public void setIdColumnName(String idColumnName) {
+ testImmutability("tableManipulation");
this.tableManipulation.setIdColumnName(idColumnName);
}
@@ -80,6 +83,7 @@
* Sets the name of the column where the StoredEntry will be binary stored.
Mandatory.
*/
public void setDataColumnName(String dataColumnName) {
+ testImmutability("tableManipulation");
this.tableManipulation.setDataColumnName(dataColumnName);
}
@@ -87,10 +91,12 @@
* Sets the name of the column where the timestamp (Long in java) will be stored.
Mandatory.
*/
public void setTimestampColumnName(String timestampColumnName) {
+ testImmutability("tableManipulation");
this.tableManipulation.setTimestampColumnName(timestampColumnName);
}
public void setConnectionFactoryClass(String connectionFactoryClass) {
+ testImmutability("connectionFactoryConfig");
this.connectionFactoryConfig.setConnectionFactoryClass(connectionFactoryClass);
}
@@ -106,6 +112,7 @@
* Jdbc connection string for connecting to the database. Mandatory.
*/
public void setConnectionUrl(String connectionUrl) {
+ testImmutability("connectionFactoryConfig");
this.connectionFactoryConfig.setConnectionUrl(connectionUrl);
}
@@ -113,6 +120,7 @@
* Database username.
*/
public void setUserName(String userName) {
+ testImmutability("connectionFactoryConfig");
this.connectionFactoryConfig.setUserName(userName);
}
@@ -120,6 +128,7 @@
* Database username's password.
*/
public void setPassword(String password) {
+ testImmutability("connectionFactoryConfig");
this.connectionFactoryConfig.setPassword(password);
}
@@ -128,6 +137,7 @@
* connection.
*/
public void setDriverClass(String driverClassName) {
+ testImmutability("connectionFactoryConfig");
this.connectionFactoryConfig.setDriverClass(driverClassName);
}
@@ -135,6 +145,7 @@
* sql equivalent for java's String. Mandatory.
*/
public void setIdColumnType(String idColumnType) {
+ testImmutability("tableManipulation");
this.tableManipulation.setIdColumnType(idColumnType);
}
@@ -142,14 +153,17 @@
* Sets the type of the column where data will be binary stored. BLOB-like type, DBMS
dependent. Mandatory.
*/
public void setDataColumnType(String dataColumnType) {
+ testImmutability("tableManipulation");
this.tableManipulation.setDataColumnType(dataColumnType);
}
public void setDropTableOnExit(boolean dropTableOnExit) {
+ testImmutability("tableManipulation");
this.tableManipulation.setDropTableOnExit(dropTableOnExit);
}
public void setCreateTableOnStart(boolean createTableOnStart) {
+ testImmutability("tableManipulation");
this.tableManipulation.setCreateTableOnStart(createTableOnStart);
}
@@ -163,6 +177,37 @@
}
public void setTableManipulation(TableManipulation tableManipulation) {
+ testImmutability("tableManipulation");
this.tableManipulation = tableManipulation;
}
+
+ /**
+ * @see org.horizon.loader.jdbc.TableManipulation#getFetchSize()
+ */
+ public void setFetchSize(int fetchSize) {
+ testImmutability("tableManipulation");
+ this.tableManipulation.setFetchSize(fetchSize);
+ }
+
+ /**
+ * @see org.horizon.loader.jdbc.TableManipulation#getBatchSize()
+ */
+ public void setBatchSize(int batchSize) {
+ testImmutability("tableManipulation");
+ this.tableManipulation.setBatchSize(batchSize);
+ }
+
+ /**
+ * @see org.horizon.loader.jdbc.TableManipulation#getFetchSize()
+ */
+ public int getFetchSize() {
+ return this.tableManipulation.getFetchSize();
+ }
+
+ /**
+ * @see org.horizon.loader.jdbc.TableManipulation#getBatchSize()
+ */
+ public int getBatchSize() {
+ return this.tableManipulation.getBatchSize();
+ }
}