You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2015/11/27 14:47:37 UTC
[1/2] ignite git commit: IGNITE-2009: Fixed leak in cached SQL
queries.
Repository: ignite
Updated Branches:
refs/heads/ignite-1.5 e519c2f5b -> 56aeea3d1
IGNITE-2009: Fixed leak in cached SQL queries.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/fc10b3e4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/fc10b3e4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/fc10b3e4
Branch: refs/heads/ignite-1.5
Commit: fc10b3e40fadd7ad792aaea63fe270c6413c5068
Parents: 3080f61
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Nov 27 16:48:01 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Nov 27 16:48:01 2015 +0300
----------------------------------------------------------------------
.../processors/query/h2/IgniteH2Indexing.java | 24 +++++++++++++-------
1 file changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/fc10b3e4/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index cc452c1..1437a16 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -49,6 +49,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import javax.cache.Cache;
import javax.cache.CacheException;
@@ -255,7 +256,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
set(c);
// Reset statement cache when new connection is created.
- stmtCache.get().clear();
+ stmtCache.remove(Thread.currentThread());
}
return c;
@@ -280,12 +281,8 @@ public class IgniteH2Indexing implements GridQueryIndexing {
/** */
private volatile GridKernalContext ctx;
- /** */
- private final ThreadLocal<StatementCache> stmtCache = new ThreadLocal<StatementCache>() {
- @Override protected StatementCache initialValue() {
- return new StatementCache(PREPARED_STMT_CACHE_SIZE);
- }
- };
+ /** Statement cache. */
+ private final ConcurrentHashMap<Thread, StatementCache> stmtCache = new ConcurrentHashMap<>();
/** */
private final GridBoundedConcurrentLinkedHashMap<T3<String, String, Boolean>, TwoStepCachedQuery> twoStepCache =
@@ -313,7 +310,18 @@ public class IgniteH2Indexing implements GridQueryIndexing {
*/
private PreparedStatement prepareStatement(Connection c, String sql, boolean useStmtCache) throws SQLException {
if (useStmtCache) {
- StatementCache cache = stmtCache.get();
+ Thread curThread = Thread.currentThread();
+
+ StatementCache cache = stmtCache.get(curThread);
+
+ if (cache == null) {
+ StatementCache cache0 = new StatementCache(PREPARED_STMT_CACHE_SIZE);
+
+ cache = stmtCache.putIfAbsent(curThread, cache0);
+
+ if (cache == null)
+ cache = cache0;
+ }
PreparedStatement stmt = cache.get(sql);
[2/2] ignite git commit: Merge remote-tracking branch
'origin/ignite-1.5' into ignite-1.5
Posted by vo...@apache.org.
Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/56aeea3d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/56aeea3d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/56aeea3d
Branch: refs/heads/ignite-1.5
Commit: 56aeea3d1f519229ad7ce80992a23bf367ef72c1
Parents: fc10b3e e519c2f
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Nov 27 16:48:28 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Nov 27 16:48:28 2015 +0300
----------------------------------------------------------------------
.../hibernate/CacheHibernatePersonStore.java | 4 +-
.../hibernate/CacheHibernateStoreExample.java | 2 +-
.../datagrid/store/hibernate/Person.hbm.xml | 2 +-
.../apache/ignite/examples/binary/Address.java | 72 ---------
.../apache/ignite/examples/binary/Employee.java | 93 -----------
.../ignite/examples/binary/EmployeeKey.java | 93 -----------
.../ignite/examples/binary/Organization.java | 93 -----------
.../examples/binary/OrganizationType.java | 32 ----
...ComputeClientBinaryTaskExecutionExample.java | 4 +-
.../CacheClientBinaryPutGetExample.java | 6 +-
.../datagrid/CacheClientBinaryQueryExample.java | 22 +--
.../examples/datagrid/CacheQueryExample.java | 161 ++++---------------
.../ignite/examples/datagrid/store/Person.java | 154 ------------------
.../store/auto/CacheAutoStoreExample.java | 4 +-
.../auto/CacheAutoStoreLoadDataExample.java | 4 +-
.../datagrid/store/auto/CacheConfig.java | 6 +-
.../store/dummy/CacheDummyPersonStore.java | 12 +-
.../store/dummy/CacheDummyStoreExample.java | 4 +-
.../store/jdbc/CacheJdbcPersonStore.java | 18 +--
.../store/jdbc/CacheJdbcStoreExample.java | 4 +-
.../store/spring/CacheSpringPersonStore.java | 10 +-
.../store/spring/CacheSpringStoreExample.java | 4 +-
.../ignite/examples/model/Organization.java | 55 +++++++
.../apache/ignite/examples/model/Person.java | 120 ++++++++++++++
.../ignite/examples/model/binary/Address.java | 72 +++++++++
.../ignite/examples/model/binary/Employee.java | 93 +++++++++++
.../examples/model/binary/EmployeeKey.java | 93 +++++++++++
.../examples/model/binary/Organization.java | 93 +++++++++++
.../examples/model/binary/OrganizationType.java | 32 ++++
.../examples/ScalarCacheQueryExample.scala | 66 ++------
30 files changed, 651 insertions(+), 777 deletions(-)
----------------------------------------------------------------------