You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2015/10/22 19:20:07 UTC
ignite git commit: IGNITE-1753 WIP on POJO store refactoring.
Repository: ignite
Updated Branches:
refs/heads/ignite-1753 22222112d -> 62836fa09
IGNITE-1753 WIP on POJO store refactoring.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/62836fa0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/62836fa0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/62836fa0
Branch: refs/heads/ignite-1753
Commit: 62836fa09b5940517f9e6922d6d61c2a7974c726
Parents: 2222211
Author: AKuznetsov <ak...@gridgain.com>
Authored: Fri Oct 23 00:20:00 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Fri Oct 23 00:20:00 2015 +0700
----------------------------------------------------------------------
.../jdbc/CacheJdbcPojoStoreConfiguration.java | 176 ++++++++++++++++++-
1 file changed, 168 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/62836fa0/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreConfiguration.java b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreConfiguration.java
index 86ef32b..b233045 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreConfiguration.java
@@ -17,8 +17,9 @@
package org.apache.ignite.cache.store.jdbc;
-import java.io.Serializable;
-import org.apache.ignite.cache.store.jdbc.dialect.JdbcDialect;
+import org.apache.ignite.cache.store.jdbc.dialect.*;
+
+import java.io.*;
/**
* JDBC POJO store configuration.
@@ -36,8 +37,8 @@ public class CacheJdbcPojoStoreConfiguration implements Serializable {
/** Default batch size for put and remove operations. */
protected static final int DFLT_PARALLEL_LOAD_CACHE_MINIMUM_THRESHOLD = 512;
- /** Types that store could process. */
- private CacheJdbcPojoStoreType[] types;
+ /** Maximum batch size for writeAll and deleteAll operations. */
+ private int batchSz = DFLT_BATCH_SIZE;
/** Name of data source bean. */
private String dataSrcBean;
@@ -48,12 +49,171 @@ public class CacheJdbcPojoStoreConfiguration implements Serializable {
/** Max workers thread count. These threads are responsible for load cache. */
private int maxPoolSz = Runtime.getRuntime().availableProcessors();
- /** Maximum batch size for writeAll and deleteAll operations. */
+ /** Maximum write attempts in case of database error. */
private int maxWrtAttempts = DFLT_WRITE_ATTEMPTS;
- /** Maximum batch size for writeAll and deleteAll operations. */
- private int batchSz = DFLT_BATCH_SIZE;
-
/** Parallel load cache minimum threshold. If {@code 0} then load sequentially. */
private int parallelLoadCacheMinThreshold = DFLT_PARALLEL_LOAD_CACHE_MINIMUM_THRESHOLD;
+
+ /** Types that store could process. */
+ private CacheJdbcPojoStoreType[] types;
+
+ /** Empty constructor (all values are initialized to their defaults). */
+ public CacheJdbcPojoStoreConfiguration() {
+ /* No-op. */
+ }
+
+ /**
+ * Copy constructor.
+ *
+ * @param cfg Configuration to copy.
+ */
+ public CacheJdbcPojoStoreConfiguration(CacheJdbcPojoStoreConfiguration cfg) {
+
+ }
+
+ /**
+ * Get maximum batch size for delete and delete operations.
+ *
+ * @return Maximum batch size.
+ */
+ public int getBatchSize() {
+ return batchSz;
+ }
+
+ /**
+ * Set maximum batch size for write and delete operations.
+ *
+ * @param batchSz Maximum batch size.
+ * @return {@code This} for chaining.
+ */
+ public CacheJdbcPojoStoreConfiguration setBatchSize(int batchSz) {
+ this.batchSz = batchSz;
+
+ return this;
+ }
+
+ /**
+ * Gets name of the data source bean.
+ *
+ * @return Data source bean name.
+ */
+ public String getDataSrcBean() {
+ return dataSrcBean;
+ }
+
+ /**
+ * Sets name of the data source bean.
+ *
+ * @param dataSrcBean Data source bean name.
+ * @return {@code This} for chaining.
+ */
+ public CacheJdbcPojoStoreConfiguration setDataSourceBean(String dataSrcBean) {
+ this.dataSrcBean = dataSrcBean;
+
+ return this;
+ }
+
+ /**
+ * Get database dialect.
+ *
+ * @return Database dialect.
+ */
+ public JdbcDialect getDialect() {
+ return dialect;
+ }
+
+ /**
+ * Set database dialect.
+ *
+ * @param dialect Database dialect.
+ * @return {@code This} for chaining.
+ */
+ public CacheJdbcPojoStoreConfiguration setDialect(JdbcDialect dialect) {
+ this.dialect = dialect;
+
+ return this;
+ }
+
+ /**
+ * Get maximum workers thread count. These threads are responsible for queries execution.
+ *
+ * @return Maximum workers thread count.
+ */
+ public int getMaximumPoolSize() {
+ return maxPoolSz;
+ }
+
+ /**
+ * Set Maximum workers thread count. These threads are responsible for queries execution.
+ *
+ * @param maxPoolSz Max workers thread count.
+ * @return {@code This} for chaining.
+ */
+ public CacheJdbcPojoStoreConfiguration setMaximumPoolSize(int maxPoolSz) {
+ this.maxPoolSz = maxPoolSz;
+
+ return this;
+ }
+
+ /**
+ * Gets maximum number of write attempts in case of database error
+ *
+ * @return Maximum number of write attempts.
+ */
+ public int getMaxWriteAttempts() {
+ return maxWrtAttempts;
+ }
+
+ /**
+ * Sets maximum number of write attempts in case of database error
+ *
+ * @param
+ * @return {@code This} for chaining.
+ */
+ public CacheJdbcPojoStoreConfiguration setMaxWriteAttempts(int maxWrtAttempts) {
+ this.maxWrtAttempts = maxWrtAttempts;
+
+ return this;
+ }
+
+ /**
+ * Parallel load cache minimum row count threshold.
+ *
+ * @return If {@code 0} then load sequentially.
+ */
+ public int getParallelLoadCacheMinimumThreshold() {
+ return parallelLoadCacheMinThreshold;
+ }
+
+ /**
+ * Parallel load cache minimum row count threshold.
+ *
+ * @param parallelLoadCacheMinThreshold Minimum row count threshold. If {@code 0} then load sequentially.
+ * @return {@code This} for chaining.
+ */
+ public CacheJdbcPojoStoreConfiguration setParallelLoadCacheMinimumThreshold(int parallelLoadCacheMinThreshold) {
+ this.parallelLoadCacheMinThreshold = parallelLoadCacheMinThreshold;
+
+ return this;
+ }
+
+ /**
+ *
+ * @return Types known by store.
+ */
+ public CacheJdbcPojoStoreType[] getTypes() {
+ return types;
+ }
+
+ /**
+ *
+ * @param types Store should process.
+ * @return {@code This} for chaining.
+ */
+ public CacheJdbcPojoStoreConfiguration setTypes(CacheJdbcPojoStoreType[] types) {
+ this.types = types;
+
+ return this;
+ }
}