ignite-1.5 Minor fix in JDBC POJO store.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5887ae4d Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5887ae4d Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5887ae4d Branch: refs/heads/ignite-638 Commit: 5887ae4d7a318089bb8b19e56cbecc782be1ba76 Parents: 1f5a409 Author: Alexey Kuznetsov <akuznet...@apache.org> Authored: Fri Nov 13 10:44:35 2015 +0700 Committer: Alexey Kuznetsov <akuznet...@apache.org> Committed: Fri Nov 13 10:44:35 2015 +0700 ---------------------------------------------------------------------- .../store/jdbc/CacheAbstractJdbcStore.java | 34 +++++++++++--------- 1 file changed, 19 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/5887ae4d/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java index 6e27b9a..6e19234 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java @@ -354,22 +354,26 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>, Transaction tx = ses.transaction(); if (tx != null) { - Connection conn = ses.<String, Connection>properties().remove(ATTR_CONN_PROP); + Map<String, Connection> sesProps = ses.properties(); - assert conn != null; + Connection conn = sesProps.get(ATTR_CONN_PROP); - try { - if (commit) - conn.commit(); - else - conn.rollback(); - } - catch (SQLException e) { - throw new CacheWriterException( - "Failed to end transaction [xid=" + tx.xid() + ", commit=" + commit + ']', e); - } - finally { - U.closeQuiet(conn); + if (conn != null) { + sesProps.remove(ATTR_CONN_PROP); + + try { + if (commit) + conn.commit(); + else + conn.rollback(); + } + catch (SQLException e) { + throw new CacheWriterException( + "Failed to end transaction [xid=" + tx.xid() + ", commit=" + commit + ']', e); + } + finally { + U.closeQuiet(conn); + } } if (log.isDebugEnabled()) @@ -1821,4 +1825,4 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>, } } } -} \ No newline at end of file +}