ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [01/29] ignite git commit: ignite-4795 All transactional methods of IgniteCache should throw TransactionException
Date Thu, 13 Apr 2017 15:56:31 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-4929 dffea7168 -> 9408ba665


ignite-4795 All transactional methods of IgniteCache should throw TransactionException


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9319305c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9319305c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9319305c

Branch: refs/heads/ignite-4929
Commit: 9319305cdfd95d4510a19e638fd912bc857865c9
Parents: 62a3b4d
Author: Дмитрий Рябов <SomeFireOne@gmail.com>
Authored: Mon Apr 10 17:55:09 2017 +0300
Committer: agura <agura@apache.org>
Committed: Mon Apr 10 17:56:01 2017 +0300

----------------------------------------------------------------------
 .../java/org/apache/ignite/IgniteCache.java     | 265 +++++++------------
 .../transactions/IgniteTransactionsImpl.java    |   4 +-
 .../TransactionDeadlockException.java           |   4 +-
 .../transactions/TransactionException.java      |  80 ++++++
 .../TransactionHeuristicException.java          |   4 +-
 .../TransactionOptimisticException.java         |   4 +-
 .../TransactionRollbackException.java           |   4 +-
 .../TransactionTimeoutException.java            |   4 +-
 8 files changed, 180 insertions(+), 189 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/9319305c/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
index f6801b9..c751966 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
@@ -61,6 +61,7 @@ import org.apache.ignite.lang.IgniteBiPredicate;
 import org.apache.ignite.lang.IgniteClosure;
 import org.apache.ignite.lang.IgniteFuture;
 import org.apache.ignite.mxbean.CacheMetricsMXBean;
+import org.apache.ignite.transactions.TransactionException;
 import org.apache.ignite.transactions.TransactionHeuristicException;
 import org.apache.ignite.transactions.TransactionRollbackException;
 import org.apache.ignite.transactions.TransactionTimeoutException;
@@ -89,6 +90,9 @@ import org.jetbrains.annotations.Nullable;
  * <h1 class="header">Transactions</h1>
  * Cache API supports transactions. You can group and set of cache methods within a transaction
  * to provide ACID-compliant behavior. See {@link IgniteTransactions} for more information.
+ * <br>
+ * Methods which can be used inside transaction (put, get...) throw TransactionException.
+ * See {@link TransactionException} for more information.
  *
  * @param <K> Cache key type.
  * @param <V> Cache value type.
@@ -273,12 +277,10 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
      *      previous value).
      * @throws NullPointerException If either key or value are {@code null}.
      * @throws CacheException If put operation failed.
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
     @IgniteAsyncSupported
-    public V getAndPutIfAbsent(K key, V val) throws CacheException;
+    public V getAndPutIfAbsent(K key, V val) throws CacheException, TransactionException;
 
     /**
      * Asynchronously stores given key-value pair in cache only if cache had no previous mapping for it. If cache
@@ -304,11 +306,9 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
      * @return a Future representing pending completion of the operation.
      * @throws NullPointerException If either key or value are {@code null}.
      * @throws CacheException If put operation failed.
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
-    public IgniteFuture<V> getAndPutIfAbsentAsync(K key, V val) throws CacheException;
+    public IgniteFuture<V> getAndPutIfAbsentAsync(K key, V val) throws CacheException, TransactionException;
 
     /**
      * Creates a {@link Lock} instance associated with passed key.
@@ -565,13 +565,11 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
      * if any, defined by the {@link EntryProcessor} implementation.  No mappings
      * will be returned for {@link EntryProcessor}s that return a
      * <code>null</code> value for a key.
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
     @IgniteAsyncSupported
     public <T> Map<K, EntryProcessorResult<T>> invokeAll(Map<? extends K, ? extends EntryProcessor<K, V, T>> map,
-        Object... args);
+        Object... args) throws TransactionException;
 
     /**
      * Asynchronously version of the {@link #invokeAll(Set, EntryProcessor, Object...)} method.
@@ -580,21 +578,17 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
      * @param args Additional arguments to pass to the {@link EntryProcessor}.
      * @return a Future representing pending completion of the operation. See more about future result
      * at the {@link #invokeAll(Map, Object...)}.
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
     public <T> IgniteFuture<Map<K, EntryProcessorResult<T>>> invokeAllAsync(
-        Map<? extends K, ? extends EntryProcessor<K, V, T>> map, Object... args);
+        Map<? extends K, ? extends EntryProcessor<K, V, T>> map, Object... args) throws TransactionException;
 
     /**
      * {@inheritDoc}
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
     @IgniteAsyncSupported
-    @Override public V get(K key);
+    @Override public V get(K key) throws TransactionException;
 
     /**
      * Asynchronously gets an entry from the cache.
@@ -623,12 +617,10 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
      * @throws ClassCastException If the implementation is configured to perform
      * runtime-type-checking, and the key or value types are incompatible with those that have been
      * configured for the {@link Cache}.
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
     @IgniteAsyncSupported
-    public CacheEntry<K, V> getEntry(K key);
+    public CacheEntry<K, V> getEntry(K key) throws TransactionException;
 
     /**
      * Asynchronously gets an entry from the cache.
@@ -645,20 +637,16 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
      * @throws ClassCastException If the implementation is configured to perform
      * runtime-type-checking, and the key or value types are incompatible with those that have been
      * configured for the {@link Cache}.
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
-    public IgniteFuture<CacheEntry<K, V>> getEntryAsync(K key);
+    public IgniteFuture<CacheEntry<K, V>> getEntryAsync(K key) throws TransactionException;
 
     /**
      * {@inheritDoc}
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
     @IgniteAsyncSupported
-    @Override public Map<K, V> getAll(Set<? extends K> keys);
+    @Override public Map<K, V> getAll(Set<? extends K> keys) throws TransactionException;
 
     /**
      * Asynchronously gets a collection of entries from the {@link Cache}, returning them as
@@ -672,11 +660,9 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
      *
      * @param keys Keys set.
      * @return a Future representing pending completion of the operation.
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
-    public IgniteFuture<Map<K, V>> getAllAsync(Set<? extends K> keys);
+    public IgniteFuture<Map<K, V>> getAllAsync(Set<? extends K> keys) throws TransactionException;
 
     /**
      * Gets a collection of entries from the {@link Cache}.
@@ -696,12 +682,10 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
      * @throws ClassCastException If the implementation is configured to perform
      * runtime-type-checking, and the key or value types are incompatible with those that have been
      * configured for the {@link Cache}.
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
     @IgniteAsyncSupported
-    public Collection<CacheEntry<K, V>> getEntries(Set<? extends K> keys);
+    public Collection<CacheEntry<K, V>> getEntries(Set<? extends K> keys) throws TransactionException;
 
     /**
      * Asynchronously gets a collection of entries from the {@link Cache}.
@@ -720,11 +704,9 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
      * @throws ClassCastException If the implementation is configured to perform
      * runtime-type-checking, and the key or value types are incompatible with those that have been
      * configured for the {@link Cache}.
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
-    public IgniteFuture<Collection<CacheEntry<K, V>>> getEntriesAsync(Set<? extends K> keys);
+    public IgniteFuture<Collection<CacheEntry<K, V>>> getEntriesAsync(Set<? extends K> keys) throws TransactionException;
 
     /**
      * Gets values from cache. Will bypass started transaction, if any, i.e. will not enlist entries
@@ -747,12 +729,10 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
 
     /**
      * {@inheritDoc}
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
     @IgniteAsyncSupported
-    @Override public boolean containsKey(K key);
+    @Override public boolean containsKey(K key) throws TransactionException;
 
     /**
      * Asynchronously determines if the {@link Cache} contains an entry for the specified key.
@@ -763,43 +743,35 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
      *
      * @param key Key.
      * @return a Future representing pending completion of the operation.
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
-    public IgniteFuture<Boolean> containsKeyAsync(K key);
+    public IgniteFuture<Boolean> containsKeyAsync(K key) throws TransactionException;
 
     /**
      * Determines if the {@link Cache} contains entries for the specified keys.
      *
      * @param keys Key whose presence in this cache is to be tested.
      * @return {@code True} if this cache contains a mapping for the specified keys.
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
     @IgniteAsyncSupported
-    public boolean containsKeys(Set<? extends K> keys);
+    public boolean containsKeys(Set<? extends K> keys) throws TransactionException;
 
     /**
      * Asynchronously determines if the {@link Cache} contains entries for the specified keys.
      *
      * @param keys Key whose presence in this cache is to be tested.
      * @return a Future representing pending completion of the operation.
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
-    public IgniteFuture<Boolean> containsKeysAsync(Set<? extends K> keys);
+    public IgniteFuture<Boolean> containsKeysAsync(Set<? extends K> keys) throws TransactionException;
 
     /**
      * {@inheritDoc}
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
     @IgniteAsyncSupported
-    @Override public void put(K key, V val);
+    @Override public void put(K key, V val) throws TransactionException;
 
     /**
      * Asynchronously associates the specified value with the specified key in the cache.
@@ -812,20 +784,16 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
      * @param key Key.
      * @param val Value.
      * @return a Future representing pending completion of the operation.
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
-    public IgniteFuture<Void> putAsync(K key, V val);
+    public IgniteFuture<Void> putAsync(K key, V val) throws TransactionException;
 
     /**
      * {@inheritDoc}
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
     @IgniteAsyncSupported
-    @Override public V getAndPut(K key, V val);
+    @Override public V getAndPut(K key, V val) throws TransactionException;
 
     /**
      * Asynchronously associates the specified value with the specified key in this cache,
@@ -843,20 +811,16 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
      * @param key Key.
      * @param val Value.
      * @return a Future representing pending completion of the operation.
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
-    public IgniteFuture<V> getAndPutAsync(K key, V val);
+    public IgniteFuture<V> getAndPutAsync(K key, V val) throws TransactionException;
 
     /**
      * {@inheritDoc}
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
     @IgniteAsyncSupported
-    @Override public void putAll(Map<? extends K, ? extends V> map);
+    @Override public void putAll(Map<? extends K, ? extends V> map) throws TransactionException;
 
     /**
      * Asynchronously copies all of the entries from the specified map to the {@link Cache}.
@@ -877,20 +841,16 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
      *
      * @param map Map containing keys and values to put into the cache.
      * @return a Future representing pending completion of the operation.
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
-    public IgniteFuture<Void> putAllAsync(Map<? extends K, ? extends V> map);
+    public IgniteFuture<Void> putAllAsync(Map<? extends K, ? extends V> map) throws TransactionException;
 
     /**
      * {@inheritDoc}
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
     @IgniteAsyncSupported
-    @Override public boolean putIfAbsent(K key, V val);
+    @Override public boolean putIfAbsent(K key, V val) throws TransactionException;
 
     /**
      * Asynchronously associates the specified key with the given value if it is
@@ -907,12 +867,10 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
 
     /**
      * {@inheritDoc}
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
     @IgniteAsyncSupported
-    @Override public boolean remove(K key);
+    @Override public boolean remove(K key) throws TransactionException;
 
     /**
      * Asynchronously removes the mapping for a key from this cache if it is present.
@@ -930,20 +888,16 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
      *
      * @param key Key.
      * @return a Future representing pending completion of the operation.
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
-    public IgniteFuture<Boolean> removeAsync(K key);
+    public IgniteFuture<Boolean> removeAsync(K key) throws TransactionException;
 
     /**
      * {@inheritDoc}
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
     @IgniteAsyncSupported
-    @Override public boolean remove(K key, V oldVal);
+    @Override public boolean remove(K key, V oldVal) throws TransactionException;
 
     /**
      * Asynchronously removes the mapping for a key only if currently mapped to the
@@ -952,20 +906,16 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
      * @param key Key.
      * @param oldVal Old value.
      * @return a Future representing pending completion of the operation.
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
-    public IgniteFuture<Boolean> removeAsync(K key, V oldVal);
+    public IgniteFuture<Boolean> removeAsync(K key, V oldVal) throws TransactionException;
 
     /**
      * {@inheritDoc}
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
     @IgniteAsyncSupported
-    @Override public V getAndRemove(K key);
+    @Override public V getAndRemove(K key) throws TransactionException;
 
     /**
      * Asynchronously removes the entry for a key only if currently mapped to some
@@ -973,20 +923,16 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
      *
      * @param key Key.
      * @return a Future representing pending completion of the operation.
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
-    public IgniteFuture<V> getAndRemoveAsync(K key);
+    public IgniteFuture<V> getAndRemoveAsync(K key) throws TransactionException;
 
     /**
      * {@inheritDoc}
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
     @IgniteAsyncSupported
-    @Override public boolean replace(K key, V oldVal, V newVal);
+    @Override public boolean replace(K key, V oldVal, V newVal) throws TransactionException;
 
     /**
      * Asynchronous version of the {@link #replace(Object, Object, Object)}.
@@ -995,20 +941,16 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
      * @param oldVal Old value.
      * @param newVal New value.
      * @return a Future representing pending completion of the operation.
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
-    public IgniteFuture<Boolean> replaceAsync(K key, V oldVal, V newVal);
+    public IgniteFuture<Boolean> replaceAsync(K key, V oldVal, V newVal) throws TransactionException;
 
     /**
      * {@inheritDoc}
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
     @IgniteAsyncSupported
-    @Override public boolean replace(K key, V val);
+    @Override public boolean replace(K key, V val) throws TransactionException;
 
     /**
      * Asynchronously replaces the entry for a key only if currently mapped to a
@@ -1017,20 +959,16 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
      * @param key Key.
      * @param val Value.
      * @return a Future representing pending completion of the operation.
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
-    public IgniteFuture<Boolean> replaceAsync(K key, V val);
+    public IgniteFuture<Boolean> replaceAsync(K key, V val) throws TransactionException;
 
     /**
      * {@inheritDoc}
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
     @IgniteAsyncSupported
-    @Override public V getAndReplace(K key, V val);
+    @Override public V getAndReplace(K key, V val) throws TransactionException;
 
     /**
      * Asynchronously replaces the value for a given key if and only if there is a
@@ -1047,12 +985,10 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
 
     /**
      * {@inheritDoc}
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
     @IgniteAsyncSupported
-    @Override public void removeAll(Set<? extends K> keys);
+    @Override public void removeAll(Set<? extends K> keys) throws TransactionException;
 
     /**
      * Asynchronously removes entries for the specified keys.
@@ -1068,11 +1004,9 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
      *
      * @param keys Keys set.
      * @return a Future representing pending completion of the operation.
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
-    public IgniteFuture<Void> removeAllAsync(Set<? extends K> keys);
+    public IgniteFuture<Void> removeAllAsync(Set<? extends K> keys) throws TransactionException;
 
     /**
      * Removes all of the mappings from this cache.
@@ -1211,12 +1145,10 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
 
     /**
      * {@inheritDoc}
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
     @IgniteAsyncSupported
-    @Override public <T> T invoke(K key, EntryProcessor<K, V, T> entryProcessor, Object... arguments);
+    @Override public <T> T invoke(K key, EntryProcessor<K, V, T> entryProcessor, Object... arguments) throws TransactionException;
 
     /**
      * Asynchronously invokes an {@link EntryProcessor} against the {@link javax.cache.Cache.Entry} specified by
@@ -1228,11 +1160,10 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
      * @param entryProcessor The {@link EntryProcessor} to invoke.
      * @param arguments Additional arguments to pass to the {@link EntryProcessor}.
      * @return a Future representing pending completion of the operation.
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
-    public <T> IgniteFuture<T> invokeAsync(K key, EntryProcessor<K, V, T> entryProcessor, Object... arguments);
+    public <T> IgniteFuture<T> invokeAsync(K key, EntryProcessor<K, V, T> entryProcessor, Object... arguments)
+		    throws TransactionException;
 
     /**
      * Invokes an {@link CacheEntryProcessor} against the {@link javax.cache.Cache.Entry} specified by
@@ -1258,13 +1189,12 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
      *                                 CacheEntryProcessor}, a Caching Implementation
      *                                 must wrap any {@link Exception} thrown
      *                                 wrapped in an {@link EntryProcessorException}.
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      * @see CacheEntryProcessor
      */
     @IgniteAsyncSupported
-    public <T> T invoke(K key, CacheEntryProcessor<K, V, T> entryProcessor, Object... arguments);
+    public <T> T invoke(K key, CacheEntryProcessor<K, V, T> entryProcessor, Object... arguments)
+		    throws TransactionException;
 
     /**
      * Asynchronously invokes an {@link CacheEntryProcessor} against the {@link javax.cache.Cache.Entry} specified by
@@ -1290,22 +1220,19 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
      *                                 CacheEntryProcessor}, a Caching Implementation
      *                                 must wrap any {@link Exception} thrown
      *                                 wrapped in an {@link EntryProcessorException}.
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      * @see CacheEntryProcessor
      */
-    public <T> IgniteFuture<T> invokeAsync(K key, CacheEntryProcessor<K, V, T> entryProcessor, Object... arguments);
+    public <T> IgniteFuture<T> invokeAsync(K key, CacheEntryProcessor<K, V, T> entryProcessor, Object... arguments)
+		    throws TransactionException;
 
     /**
      * {@inheritDoc}
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
     @IgniteAsyncSupported
     @Override public <T> Map<K, EntryProcessorResult<T>> invokeAll(Set<? extends K> keys,
-        EntryProcessor<K, V, T> entryProcessor, Object... args);
+        EntryProcessor<K, V, T> entryProcessor, Object... args) throws TransactionException;
 
     /**
      * Asynchronously invokes an {@link EntryProcessor} against the set of {@link javax.cache.Cache.Entry}s
@@ -1332,12 +1259,10 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
      * @param entryProcessor The {@link EntryProcessor} to invoke.
      * @param args Additional arguments to pass to the {@link EntryProcessor}.
      * @return a Future representing pending completion of the operation.
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      */
     public <T> IgniteFuture<Map<K, EntryProcessorResult<T>>> invokeAllAsync(Set<? extends K> keys,
-        EntryProcessor<K, V, T> entryProcessor, Object... args);
+        EntryProcessor<K, V, T> entryProcessor, Object... args) throws TransactionException;
 
 
     /**
@@ -1377,14 +1302,12 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
      *                               runtime-type-checking, and the key or value
      *                               types are incompatible with those that have been
      *                               configured for the {@link Cache}.
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      * @see CacheEntryProcessor
      */
     @IgniteAsyncSupported
     public <T> Map<K, EntryProcessorResult<T>> invokeAll(Set<? extends K> keys,
-        CacheEntryProcessor<K, V, T> entryProcessor, Object... args);
+        CacheEntryProcessor<K, V, T> entryProcessor, Object... args) throws TransactionException;
 
     /**
      * Asynchronously invokes an {@link CacheEntryProcessor} against the set of {@link javax.cache.Cache.Entry}s
@@ -1420,13 +1343,11 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
      *                               runtime-type-checking, and the key or value
      *                               types are incompatible with those that have been
      *                               configured for the {@link Cache}.
-     * @throws TransactionTimeoutException If operation performs within transaction and timeout occurred.
-     * @throws TransactionRollbackException If operation performs within transaction that automatically rolled back.
-     * @throws TransactionHeuristicException If operation performs within transaction that entered an unknown state.
+     * @throws TransactionException If operation within transaction is failed.
      * @see CacheEntryProcessor
      */
     public <T> IgniteFuture<Map<K, EntryProcessorResult<T>>> invokeAllAsync(Set<? extends K> keys,
-        CacheEntryProcessor<K, V, T> entryProcessor, Object... args);
+        CacheEntryProcessor<K, V, T> entryProcessor, Object... args) throws TransactionException;
 
     /**
      * Closes this cache instance.

http://git-wip-us.apache.org/repos/asf/ignite/blob/9319305c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTransactionsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTransactionsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTransactionsImpl.java
index ddafbac..12f655a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTransactionsImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTransactionsImpl.java
@@ -17,7 +17,6 @@
 
 package org.apache.ignite.internal.processors.cache.transactions;
 
-import org.apache.ignite.IgniteException;
 import org.apache.ignite.configuration.TransactionConfiguration;
 import org.apache.ignite.internal.IgniteTransactionsEx;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
@@ -29,6 +28,7 @@ import org.apache.ignite.transactions.Transaction;
 import org.apache.ignite.transactions.TransactionConcurrency;
 import org.apache.ignite.transactions.TransactionIsolation;
 import org.apache.ignite.transactions.TransactionMetrics;
+import org.apache.ignite.transactions.TransactionException;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -200,6 +200,6 @@ public class IgniteTransactionsImpl<K, V> implements IgniteTransactionsEx {
      */
     private void checkTransactional(GridCacheContext ctx) {
         if (!ctx.transactional())
-            throw new IgniteException("Failed to start transaction on non-transactional cache: " + ctx.name());
+            throw new TransactionException("Failed to start transaction on non-transactional cache: " + ctx.name());
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/9319305c/modules/core/src/main/java/org/apache/ignite/transactions/TransactionDeadlockException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/TransactionDeadlockException.java b/modules/core/src/main/java/org/apache/ignite/transactions/TransactionDeadlockException.java
index 4dc13fe..995a1ae 100644
--- a/modules/core/src/main/java/org/apache/ignite/transactions/TransactionDeadlockException.java
+++ b/modules/core/src/main/java/org/apache/ignite/transactions/TransactionDeadlockException.java
@@ -17,8 +17,6 @@
 
 package org.apache.ignite.transactions;
 
-import org.apache.ignite.IgniteException;
-
 /**
  * Transaction deadlock exception.
  * <p>
@@ -27,7 +25,7 @@ import org.apache.ignite.IgniteException;
  * <p>
  * Usually this exception is cause for {@link TransactionTimeoutException}.
  */
-public class TransactionDeadlockException extends IgniteException {
+public class TransactionDeadlockException extends TransactionException {
     /** Serial version UID. */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/9319305c/modules/core/src/main/java/org/apache/ignite/transactions/TransactionException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/TransactionException.java b/modules/core/src/main/java/org/apache/ignite/transactions/TransactionException.java
new file mode 100644
index 0000000..a175473
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/transactions/TransactionException.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.transactions;
+
+import org.apache.ignite.IgniteException;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Base class for all transaction related exceptions.
+ * In case of {@link org.apache.ignite.cache.CacheAtomicityMode#TRANSACTIONAL} cache -
+ * any method throwing this or nested exception have transactional behaviour
+ * (it can be rolled back and not seen outside transaction before committed).
+ * In case of {@link org.apache.ignite.cache.CacheAtomicityMode#ATOMIC} cache - every action is committed when it done.
+ * <p>
+ * Before doing main thing, all transactional methods (commit, rollback and close) must obtain a readLock from
+ * context's gateway to prevent simultaneous actions which can break result of transaction.
+ *
+ * Then method delegates action to internal transaction representation which can fail in some cases and throw exception.
+ *
+ * Anyway, if there is success or fail, method must free gateway lock.
+ * <p>
+ * {@link TransactionDeadlockException} If deadlock detected within transaction.
+ * {@link TransactionHeuristicException} If operation performs within transaction that entered an unknown state.
+ * {@link TransactionOptimisticException} If operation with optimistic behavior failed.
+ * {@link TransactionRollbackException} If operation performs within transaction that automatically rolled back.
+ * {@link TransactionTimeoutException} If operation performs within transaction and timeout occurred.
+ */
+public class TransactionException extends IgniteException {
+	/** Serial version UID. */
+	private static final long serialVersionUID = 0L;
+
+	/** Creates empty exception. */
+	public TransactionException() {
+		// No-op.
+	}
+
+	/**
+	 * Creates new exception with given error message.
+	 *
+	 * @param msg Error message.
+	 */
+	public TransactionException(String msg) {
+		super(msg);
+	}
+
+	/**
+	 * Creates new transaction exception with given throwable as a cause and
+	 * source of error message.
+	 *
+	 * @param cause Non-null throwable cause.
+	 */
+	public TransactionException(Throwable cause) {
+		super(cause);
+	}
+
+	/**
+	 * Creates new exception with given error message and optional nested exception.
+	 *
+	 * @param msg Error message.
+	 * @param cause Optional nested exception (can be {@code null}).
+	 */
+	public TransactionException(String msg, @Nullable Throwable cause) {
+		super(msg, cause);
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/9319305c/modules/core/src/main/java/org/apache/ignite/transactions/TransactionHeuristicException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/TransactionHeuristicException.java b/modules/core/src/main/java/org/apache/ignite/transactions/TransactionHeuristicException.java
index b3cc77c..2ec908d 100644
--- a/modules/core/src/main/java/org/apache/ignite/transactions/TransactionHeuristicException.java
+++ b/modules/core/src/main/java/org/apache/ignite/transactions/TransactionHeuristicException.java
@@ -17,8 +17,6 @@
 
 package org.apache.ignite.transactions;
 
-import org.apache.ignite.IgniteException;
-
 /**
  * Exception thrown whenever grid transaction enters an unknown state.
  * This exception is usually thrown whenever commit partially succeeds.
@@ -26,7 +24,7 @@ import org.apache.ignite.IgniteException;
  * integrity, by invalidating all values participating in this transaction
  * on remote nodes.
  */
-public class TransactionHeuristicException extends IgniteException {
+public class TransactionHeuristicException extends TransactionException {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/9319305c/modules/core/src/main/java/org/apache/ignite/transactions/TransactionOptimisticException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/TransactionOptimisticException.java b/modules/core/src/main/java/org/apache/ignite/transactions/TransactionOptimisticException.java
index 7b8ad8e..f5a3113 100644
--- a/modules/core/src/main/java/org/apache/ignite/transactions/TransactionOptimisticException.java
+++ b/modules/core/src/main/java/org/apache/ignite/transactions/TransactionOptimisticException.java
@@ -17,12 +17,10 @@
 
 package org.apache.ignite.transactions;
 
-import org.apache.ignite.IgniteException;
-
 /**
  * Exception thrown whenever grid transactions fail optimistically.
  */
-public class TransactionOptimisticException extends IgniteException {
+public class TransactionOptimisticException extends TransactionException {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/9319305c/modules/core/src/main/java/org/apache/ignite/transactions/TransactionRollbackException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/TransactionRollbackException.java b/modules/core/src/main/java/org/apache/ignite/transactions/TransactionRollbackException.java
index d60087b..70765ce 100644
--- a/modules/core/src/main/java/org/apache/ignite/transactions/TransactionRollbackException.java
+++ b/modules/core/src/main/java/org/apache/ignite/transactions/TransactionRollbackException.java
@@ -17,12 +17,10 @@
 
 package org.apache.ignite.transactions;
 
-import org.apache.ignite.IgniteException;
-
 /**
  * Exception thrown whenever grid transactions has been automatically rolled back.
  */
-public class TransactionRollbackException extends IgniteException {
+public class TransactionRollbackException extends TransactionException {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/9319305c/modules/core/src/main/java/org/apache/ignite/transactions/TransactionTimeoutException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/TransactionTimeoutException.java b/modules/core/src/main/java/org/apache/ignite/transactions/TransactionTimeoutException.java
index ab76cf7..1aa1a50 100644
--- a/modules/core/src/main/java/org/apache/ignite/transactions/TransactionTimeoutException.java
+++ b/modules/core/src/main/java/org/apache/ignite/transactions/TransactionTimeoutException.java
@@ -17,13 +17,11 @@
 
 package org.apache.ignite.transactions;
 
-import org.apache.ignite.IgniteException;
-
 /**
  * Exception thrown whenever transactions time out. Because transaction can be timed out due to a deadlock
  * this exception can contain {@link TransactionDeadlockException} as cause.
  */
-public class TransactionTimeoutException extends IgniteException {
+public class TransactionTimeoutException extends TransactionException {
     /** */
     private static final long serialVersionUID = 0L;
 


Mime
View raw message