http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheSwapManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheSwapManager.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheSwapManager.java index abf8cb6..7a66e69 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheSwapManager.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheSwapManager.java @@ -9,13 +9,13 @@ package org.gridgain.grid.kernal.processors.cache; +import org.apache.ignite.*; import org.apache.ignite.lang.*; -import org.gridgain.grid.*; +import org.apache.ignite.spi.swapspace.*; import org.gridgain.grid.kernal.managers.swapspace.*; import org.gridgain.grid.kernal.processors.cache.query.*; import org.gridgain.grid.kernal.processors.license.*; import org.gridgain.grid.kernal.processors.offheap.*; -import org.apache.ignite.spi.swapspace.*; import org.gridgain.grid.util.*; import org.gridgain.grid.util.lang.*; import org.gridgain.grid.util.offheap.*; @@ -29,8 +29,8 @@ import java.nio.*; import java.util.*; import java.util.concurrent.*; -import static org.gridgain.grid.cache.GridCacheMemoryMode.*; import static org.apache.ignite.events.IgniteEventType.*; +import static org.gridgain.grid.cache.GridCacheMemoryMode.*; import static org.gridgain.grid.kernal.processors.license.GridLicenseSubsystem.*; /** @@ -79,7 +79,7 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { } /** {@inheritDoc} */ - @Override public void start0() throws GridException { + @Override public void start0() throws IgniteCheckedException { spaceName = CU.swapSpaceName(cctx); swapMgr = cctx.gridSwap(); @@ -116,7 +116,7 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { writeToSwap(part, null, kb, vb); } - catch (GridException e) { + catch (IgniteCheckedException e) { log.error("Failed to unmarshal off-heap entry [part=" + part + ", hash=" + hash + ']', e); } } @@ -155,9 +155,9 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { /** * @return Swap size. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - public long swapSize() throws GridException { + public long swapSize() throws IgniteCheckedException { return enabled ? swapMgr.swapSize(spaceName) : -1; } @@ -165,9 +165,9 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { * Gets number of swap entries (keys). * * @return Swap keys count. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - public long swapKeys() throws GridException { + public long swapKeys() throws IgniteCheckedException { return enabled ? swapMgr.swapKeys(spaceName) : -1; } @@ -325,7 +325,7 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { if (it != null) it.close(); } - catch (GridException e) { + catch (IgniteCheckedException e) { log.error("Failed to close iterator.", e); } finally { @@ -339,9 +339,9 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { /** * @param e Swap entry to reconstitute. * @return Reconstituted swap entry or {@code null} if entry is obsolete. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - @Nullable private GridCacheSwapEntry<V> swapEntry(GridCacheSwapEntry<V> e) throws GridException { + @Nullable private GridCacheSwapEntry<V> swapEntry(GridCacheSwapEntry<V> e) throws IgniteCheckedException { return swapEntry(e, true); } @@ -351,9 +351,9 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { * @param e Swap entry to reconstitute. * @param unmarshal If {@code true} then value is unmarshalled. * @return Reconstituted swap entry or {@code null} if entry is obsolete. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - @Nullable private GridCacheSwapEntry<V> swapEntry(GridCacheSwapEntry<V> e, boolean unmarshal) throws GridException { + @Nullable private GridCacheSwapEntry<V> swapEntry(GridCacheSwapEntry<V> e, boolean unmarshal) throws IgniteCheckedException { assert e != null; checkIteratorQueue(); @@ -385,9 +385,9 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { * @param key Key to check. * @param keyBytes Key bytes to check. * @return {@code True} if key is contained. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - public boolean containsKey(K key, byte[] keyBytes) throws GridException { + public boolean containsKey(K key, byte[] keyBytes) throws IgniteCheckedException { if (!offheapEnabled && !swapEnabled) return false; @@ -417,10 +417,10 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { * @param keyBytes Key bytes. * @param entryLocked {@code True} if cache entry is locked. * @return Value from swap or {@code null}. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ @SuppressWarnings({"unchecked"}) - @Nullable GridCacheSwapEntry<V> read(K key, byte[] keyBytes, boolean entryLocked) throws GridException { + @Nullable GridCacheSwapEntry<V> read(K key, byte[] keyBytes, boolean entryLocked) throws IgniteCheckedException { if (!offheapEnabled && !swapEnabled) return null; @@ -467,10 +467,10 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { * @param key Key to remove. * @param keyBytes Key bytes. * @return Value from swap or {@code null}. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ @SuppressWarnings({"unchecked"}) - @Nullable GridCacheSwapEntry<V> readAndRemove(final K key, final byte[] keyBytes) throws GridException { + @Nullable GridCacheSwapEntry<V> readAndRemove(final K key, final byte[] keyBytes) throws IgniteCheckedException { if (!offheapEnabled && !swapEnabled) return null; @@ -524,15 +524,15 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { * @param part Partition. * @param keyBytes Key bytes. * @return Value from swap or {@code null}. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ @Nullable private GridCacheSwapEntry<V> readAndRemoveSwap(final K key, final int part, final byte[] keyBytes) - throws GridException { + throws IgniteCheckedException { if (!swapEnabled) return null; final GridTuple<GridCacheSwapEntry<V>> t = F.t1(); - final GridTuple<GridException> err = F.t1(); + final GridTuple<IgniteCheckedException> err = F.t1(); swapMgr.remove(spaceName, new SwapKey(key, part, keyBytes), new CI1<byte[]>() { @Override public void apply(byte[] rmv) { @@ -561,7 +561,7 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { if (qryMgr != null) qryMgr.onUnswap(key, v, valBytes); } - catch (GridException e) { + catch (IgniteCheckedException e) { err.set(e); } } @@ -578,9 +578,9 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { * @param entry Entry to read. * @param locked {@code True} if cache entry is locked. * @return Read value. - * @throws GridException If read failed. + * @throws IgniteCheckedException If read failed. */ - @Nullable GridCacheSwapEntry<V> read(GridCacheEntryEx<K, V> entry, boolean locked) throws GridException { + @Nullable GridCacheSwapEntry<V> read(GridCacheEntryEx<K, V> entry, boolean locked) throws IgniteCheckedException { if (!offheapEnabled && !swapEnabled) return null; @@ -590,9 +590,9 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { /** * @param entry Entry to read. * @return Read value address. - * @throws GridException If read failed. + * @throws IgniteCheckedException If read failed. */ - @Nullable GridCacheSwapEntry<V> readOffheapPointer(GridCacheEntryEx<K, V> entry) throws GridException { + @Nullable GridCacheSwapEntry<V> readOffheapPointer(GridCacheEntryEx<K, V> entry) throws IgniteCheckedException { if (!offheapEnabled) return null; @@ -617,9 +617,9 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { /** * @param key Key to read swap entry for. * @return Read value. - * @throws GridException If read failed. + * @throws IgniteCheckedException If read failed. */ - @Nullable public GridCacheSwapEntry<V> read(K key) throws GridException { + @Nullable public GridCacheSwapEntry<V> read(K key) throws IgniteCheckedException { if (!offheapEnabled && !swapEnabled) return null; @@ -629,9 +629,9 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { /** * @param entry Entry to read. * @return Read value. - * @throws GridException If read failed. + * @throws IgniteCheckedException If read failed. */ - @Nullable GridCacheSwapEntry<V> readAndRemove(GridCacheEntryEx<K, V> entry) throws GridException { + @Nullable GridCacheSwapEntry<V> readAndRemove(GridCacheEntryEx<K, V> entry) throws IgniteCheckedException { if (!offheapEnabled && !swapEnabled) return null; @@ -641,9 +641,9 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { /** * @param keys Collection of keys to remove from swap. * @return Collection of swap entries. - * @throws GridException If failed, + * @throws IgniteCheckedException If failed, */ - public Collection<GridCacheBatchSwapEntry<K, V>> readAndRemove(Collection<? extends K> keys) throws GridException { + public Collection<GridCacheBatchSwapEntry<K, V>> readAndRemove(Collection<? extends K> keys) throws IgniteCheckedException { if (!offheapEnabled && !swapEnabled) return Collections.emptyList(); @@ -706,15 +706,15 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { } // Swap is enabled. - final GridTuple<GridException> err = F.t1(); + final GridTuple<IgniteCheckedException> err = F.t1(); Collection<SwapKey> converted = new ArrayList<>(F.viewReadOnly(keysList, new C1<K, SwapKey>() { @Override public SwapKey apply(K key) { try { return new SwapKey(key, cctx.affinity().partition(key), CU.marshal(cctx.shared(), key)); } - catch (GridException e) { - throw new GridRuntimeException(e); + catch (IgniteCheckedException e) { + throw new IgniteException(e); } } })); @@ -759,7 +759,7 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { if (qryMgr != null) qryMgr.onUnswap(key, entry.value(), entry.valueBytes()); } - catch (GridException e) { + catch (IgniteCheckedException e) { err.set(e); } } @@ -776,9 +776,9 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { /** * @param key Key to read swap entry for. * @return Read value. - * @throws GridException If read failed. + * @throws IgniteCheckedException If read failed. */ - @Nullable GridCacheSwapEntry<V> readAndRemove(K key) throws GridException { + @Nullable GridCacheSwapEntry<V> readAndRemove(K key) throws IgniteCheckedException { if (!offheapEnabled && !swapEnabled) return null; @@ -789,9 +789,9 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { * @param key Key to remove. * @param keyBytes Key bytes. * @return {@code True} If succeeded. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - boolean removeOffheap(final K key, byte[] keyBytes) throws GridException { + boolean removeOffheap(final K key, byte[] keyBytes) throws IgniteCheckedException { assert offheapEnabled; checkIteratorQueue(); @@ -813,9 +813,9 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { * * @param key Key. * @param keyBytes Key bytes. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - void enableOffheapEviction(final K key, byte[] keyBytes) throws GridException { + void enableOffheapEviction(final K key, byte[] keyBytes) throws IgniteCheckedException { if (!offheapEnabled) return; @@ -829,9 +829,9 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { /** * @param key Key to remove. * @param keyBytes Key bytes. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - public void remove(final K key, byte[] keyBytes) throws GridException { + public void remove(final K key, byte[] keyBytes) throws IgniteCheckedException { if (!offheapEnabled && !swapEnabled) return; @@ -852,8 +852,8 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { qryMgr.onUnswap(key, entry.value(), entry.valueBytes()); } - catch (GridException e) { - throw new GridRuntimeException(e); + catch (IgniteCheckedException e) { + throw new IgniteException(e); } } }; @@ -889,7 +889,7 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { * @param expireTime Swap entry expiration time. * @param keyClsLdrId Class loader ID for entry key. * @param valClsLdrId Class loader ID for entry value. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ void write(K key, byte[] keyBytes, @@ -900,7 +900,7 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { long expireTime, @Nullable IgniteUuid keyClsLdrId, @Nullable IgniteUuid valClsLdrId) - throws GridException { + throws IgniteCheckedException { if (!offheapEnabled && !swapEnabled) return; @@ -931,9 +931,9 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { * Performs batch write of swapped entries. * * @param swapped Collection of swapped entries. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - void writeAll(Iterable<GridCacheBatchSwapEntry<K, V>> swapped) throws GridException { + void writeAll(Iterable<GridCacheBatchSwapEntry<K, V>> swapped) throws IgniteCheckedException { assert offheapEnabled || swapEnabled; checkIteratorQueue(); @@ -983,9 +983,9 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { * @param key Key. If {@code null} then it will be deserialized from {@code keyBytes}. * @param keyBytes Key bytes. * @param entry Entry bytes. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - private void writeToSwap(int part, @Nullable K key, byte[] keyBytes, byte[] entry) throws GridException{ + private void writeToSwap(int part, @Nullable K key, byte[] keyBytes, byte[] entry) throws IgniteCheckedException{ checkIteratorQueue(); if (key == null) @@ -1009,9 +1009,9 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { /** * Clears swap. * - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - public void clearSwap() throws GridException { + public void clearSwap() throws IgniteCheckedException { if (swapEnabled) swapMgr.clear(spaceName); } @@ -1022,12 +1022,12 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { * @param part Partition to iterate over. * @param unmarshal Unmarshal value flag. * @return Iterator over partition. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ @Nullable public GridCloseableIterator<Map.Entry<byte[], GridCacheSwapEntry<V>>> iterator( final int part, final boolean unmarshal) - throws GridException { + throws IgniteCheckedException { if (!swapEnabled() && !offHeapEnabled()) return null; @@ -1053,7 +1053,7 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { advance(); } - private void advance() throws GridException { + private void advance() throws IgniteCheckedException { if (it.hasNext()) return; @@ -1076,7 +1076,7 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { done = true; } - @Override protected Map.Entry<byte[], GridCacheSwapEntry<V>> onNext() throws GridException { + @Override protected Map.Entry<byte[], GridCacheSwapEntry<V>> onNext() throws IgniteCheckedException { if (done) throw new NoSuchElementException(); @@ -1091,7 +1091,7 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { return !done; } - @Override protected void onClose() throws GridException { + @Override protected void onClose() throws IgniteCheckedException { if (it != null) it.close(); } @@ -1102,10 +1102,10 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { * Gets offheap and swap iterator over partition. * * @return Iterator over partition. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ @Nullable public GridCloseableIterator<Map.Entry<byte[], byte[]>> rawIterator() - throws GridException { + throws IgniteCheckedException { if (!swapEnabled() && !offHeapEnabled()) return new GridEmptyCloseableIterator<>(); @@ -1133,7 +1133,7 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { advance(); } - private void advance() throws GridException { + private void advance() throws IgniteCheckedException { if (it.hasNext()) return; @@ -1154,7 +1154,7 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { done = true; } - @Override protected Map.Entry<byte[], byte[]> onNext() throws GridException { + @Override protected Map.Entry<byte[], byte[]> onNext() throws IgniteCheckedException { if (done) throw new NoSuchElementException(); @@ -1169,7 +1169,7 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { return !done; } - @Override protected void onRemove() throws GridException { + @Override protected void onRemove() throws IgniteCheckedException { if (offheapFlag) { K key = unmarshalKey(cur.getKey(), cctx.deploy().globalLoader()); @@ -1181,7 +1181,7 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { it.removeX(); } - @Override protected void onClose() throws GridException { + @Override protected void onClose() throws IgniteCheckedException { if (it != null) it.close(); } @@ -1190,9 +1190,9 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { /** * @return Lazy swap iterator. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - public Iterator<Map.Entry<K, V>> lazySwapIterator() throws GridException { + public Iterator<Map.Entry<K, V>> lazySwapIterator() throws IgniteCheckedException { if (!swapEnabled) return new GridEmptyIterator<>(); @@ -1252,8 +1252,8 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { try { return unmarshalKey(cur0.getKey(), cctx.deploy().globalLoader()); } - catch (GridException e) { - throw new GridRuntimeException(e); + catch (IgniteCheckedException e) { + throw new IgniteException(e); } } @@ -1265,8 +1265,8 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { return e.value(); } - catch (GridException ex) { - throw new GridRuntimeException(ex); + catch (IgniteCheckedException ex) { + throw new IgniteException(ex); } } @@ -1282,7 +1282,7 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { return it.hasNext(); } - @Override protected void onRemove() throws GridException { + @Override protected void onRemove() throws IgniteCheckedException { if (cur == null) throw new IllegalStateException("Method next() has not yet been called, or the remove() method " + "has already been called after the last call to the next() method."); @@ -1298,7 +1298,7 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { } } - @Override protected void onClose() throws GridException { + @Override protected void onClose() throws IgniteCheckedException { it.close(); } }; @@ -1329,12 +1329,12 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { * @param part Partition to iterate over. * @param unmarshal Unmarshal value flag. * @return Iterator over partition. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ @Nullable public GridCloseableIterator<Map.Entry<byte[], GridCacheSwapEntry<V>>> offHeapIterator( int part, boolean unmarshal) - throws GridException { + throws IgniteCheckedException { if (!offheapEnabled) return null; @@ -1378,7 +1378,7 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { return it.hasNext(); } - @Override protected void onRemove() throws GridException { + @Override protected void onRemove() throws IgniteCheckedException { K key = unmarshalKey(cur.getKey(), cctx.deploy().globalLoader()); int part = cctx.affinity().partition(key); @@ -1386,7 +1386,7 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { offheap.removex(spaceName, part, key, cur.getKey()); } - @Override protected void onClose() throws GridException { + @Override protected void onClose() throws IgniteCheckedException { it.close(); } }; @@ -1398,12 +1398,12 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { * @param part Partition to iterate over. * @param unmarshal Unmarshal value flag. * @return Iterator over partition. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ @Nullable public GridCloseableIterator<Map.Entry<byte[], GridCacheSwapEntry<V>>> swapIterator( int part, boolean unmarshal) - throws GridException { + throws IgniteCheckedException { if (!swapEnabled) return null; @@ -1414,9 +1414,9 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { /** * @return Raw off-heap iterator. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - public GridCloseableIterator<Map.Entry<byte[], byte[]>> rawSwapIterator() throws GridException { + public GridCloseableIterator<Map.Entry<byte[], byte[]>> rawSwapIterator() throws IgniteCheckedException { if (!swapEnabled) return new GridEmptyCloseableIterator<>(); @@ -1475,7 +1475,7 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { } } } - catch (GridException ex) { + catch (IgniteCheckedException ex) { U.error(log, "Failed to process swap entry.", ex); } } @@ -1487,7 +1487,7 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { return undeployCnt; } } - catch (GridException e) { + catch (IgniteCheckedException e) { U.error(log, "Failed to clear cache swap space on undeploy.", e); } @@ -1513,9 +1513,9 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { * @param bytes Bytes to unmarshal. * @param ldr Class loader. * @return Unmarshalled value. - * @throws GridException If unmarshal failed. + * @throws IgniteCheckedException If unmarshal failed. */ - private <T> T unmarshalKey(byte[] bytes, ClassLoader ldr) throws GridException { + private <T> T unmarshalKey(byte[] bytes, ClassLoader ldr) throws IgniteCheckedException { return (T)cctx.marshaller().unmarshal(bytes, ldr); } @@ -1551,7 +1551,7 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { } /** {@inheritDoc} */ - @Override protected Map.Entry<byte[], GridCacheSwapEntry<V>> onNext() throws GridException { + @Override protected Map.Entry<byte[], GridCacheSwapEntry<V>> onNext() throws IgniteCheckedException { Map.Entry<byte[], byte[]> e = iter.nextX(); GridCacheSwapEntry<V> unmarshalled = unmarshalSwapEntry(e.getValue()); @@ -1560,12 +1560,12 @@ public class GridCacheSwapManager<K, V> extends GridCacheManagerAdapter<K, V> { } /** {@inheritDoc} */ - @Override protected boolean onHasNext() throws GridException { + @Override protected boolean onHasNext() throws IgniteCheckedException { return iter.hasNext(); } /** {@inheritDoc} */ - @Override protected void onClose() throws GridException { + @Override protected void onClose() throws IgniteCheckedException { iter.close(); }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTtlManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTtlManager.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTtlManager.java index 3e7e6ef..e01c27d 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTtlManager.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTtlManager.java @@ -9,6 +9,7 @@ package org.gridgain.grid.kernal.processors.cache; +import org.apache.ignite.*; import org.apache.ignite.thread.*; import org.gridgain.grid.*; import org.gridgain.grid.cache.*; @@ -34,7 +35,7 @@ public class GridCacheTtlManager<K, V> extends GridCacheManagerAdapter<K, V> { private final Object mux = new Object(); /** {@inheritDoc} */ - @Override protected void start0() throws GridException { + @Override protected void start0() throws IgniteCheckedException { if (cctx.kernalContext().isDaemon() || !cctx.config().isEagerTtl()) return; @@ -42,7 +43,7 @@ public class GridCacheTtlManager<K, V> extends GridCacheManagerAdapter<K, V> { } /** {@inheritDoc} */ - @Override protected void onKernalStart0() throws GridException { + @Override protected void onKernalStart0() throws IgniteCheckedException { if (cleanupWorker != null) new IgniteThread(cleanupWorker).start(); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxAdapter.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxAdapter.java index 6ed4c5a..84045a2 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxAdapter.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxAdapter.java @@ -772,7 +772,7 @@ public abstract class GridCacheTxAdapter<K, V> extends GridMetadataAwareAdapter /** * */ - @Override public void close() throws GridException { + @Override public void close() throws IgniteCheckedException { GridCacheTxState state = state(); if (state != ROLLING_BACK && state != ROLLED_BACK && state != COMMITTING && state != COMMITTED) @@ -795,9 +795,9 @@ public abstract class GridCacheTxAdapter<K, V> extends GridMetadataAwareAdapter /** * Awaits transaction completion. * - * @throws GridException If waiting failed. + * @throws IgniteCheckedException If waiting failed. */ - protected void awaitCompletion() throws GridException { + protected void awaitCompletion() throws IgniteCheckedException { lock(); try { @@ -808,7 +808,7 @@ public abstract class GridCacheTxAdapter<K, V> extends GridMetadataAwareAdapter Thread.currentThread().interrupt(); if (!done()) - throw new GridException("Got interrupted while waiting for transaction to complete: " + this, e); + throw new IgniteCheckedException("Got interrupted while waiting for transaction to complete: " + this, e); } finally { unlock(); @@ -1107,11 +1107,11 @@ public abstract class GridCacheTxAdapter<K, V> extends GridMetadataAwareAdapter * @param txEntry Entry to process. * @param metrics {@code True} if metrics should be updated. * @return Tuple containing transformation results. - * @throws GridException If failed to get previous value for transform. + * @throws IgniteCheckedException If failed to get previous value for transform. * @throws GridCacheEntryRemovedException If entry was concurrently deleted. */ protected GridTuple3<GridCacheOperation, V, byte[]> applyTransformClosures(GridCacheTxEntry<K, V> txEntry, - boolean metrics) throws GridCacheEntryRemovedException, GridException { + boolean metrics) throws GridCacheEntryRemovedException, IgniteCheckedException { GridCacheContext cacheCtx = txEntry.context(); assert cacheCtx != null; @@ -1143,7 +1143,7 @@ public abstract class GridCacheTxAdapter<K, V> extends GridMetadataAwareAdapter val = clos.apply(val); } catch (Throwable e) { - throw new GridRuntimeException("Transform closure must not throw any exceptions " + + throw new IgniteException("Transform closure must not throw any exceptions " + "(transaction will be invalidated)", e); } @@ -1213,9 +1213,9 @@ public abstract class GridCacheTxAdapter<K, V> extends GridMetadataAwareAdapter * @param e Entry to evict if it qualifies for eviction. * @param primaryOnly Flag to try to evict only on primary node. * @return {@code True} if attempt was made to evict the entry. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - protected boolean evictNearEntry(GridCacheTxEntry<K, V> e, boolean primaryOnly) throws GridException { + protected boolean evictNearEntry(GridCacheTxEntry<K, V> e, boolean primaryOnly) throws IgniteCheckedException { assert e != null; if (isNearLocallyMapped(e, primaryOnly)) { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxEntry.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxEntry.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxEntry.java index 6aa3003..91b9cc0 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxEntry.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxEntry.java @@ -9,14 +9,14 @@ package org.gridgain.grid.kernal.processors.cache; +import org.apache.ignite.*; import org.apache.ignite.lang.*; import org.apache.ignite.marshaller.optimized.*; -import org.gridgain.grid.*; import org.gridgain.grid.cache.*; import org.gridgain.grid.util.lang.*; +import org.gridgain.grid.util.tostring.*; import org.gridgain.grid.util.typedef.*; import org.gridgain.grid.util.typedef.internal.*; -import org.gridgain.grid.util.tostring.*; import org.jetbrains.annotations.*; import java.io.*; @@ -709,9 +709,9 @@ public class GridCacheTxEntry<K, V> implements GridPeerDeployAware, Externalizab /** * @param ctx Context. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - public void marshal(GridCacheSharedContext<K, V> ctx) throws GridException { + public void marshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException { // Do not serialize filters if they are null. if (depEnabled) { if (keyBytes == null) @@ -734,9 +734,9 @@ public class GridCacheTxEntry<K, V> implements GridPeerDeployAware, Externalizab * * @param ctx Cache context. * @param clsLdr Class loader. - * @throws GridException If un-marshalling failed. + * @throws IgniteCheckedException If un-marshalling failed. */ - public void unmarshal(GridCacheSharedContext<K, V> ctx, boolean near, ClassLoader clsLdr) throws GridException { + public void unmarshal(GridCacheSharedContext<K, V> ctx, boolean near, ClassLoader clsLdr) throws IgniteCheckedException { if (this.ctx == null) { GridCacheContext<K, V> cacheCtx = ctx.cacheContext(cacheId); @@ -979,10 +979,10 @@ public class GridCacheTxEntry<K, V> implements GridPeerDeployAware, Externalizab /** * @param ctx Cache context. * @param depEnabled Deployment enabled flag. - * @throws GridException If marshaling failed. + * @throws IgniteCheckedException If marshaling failed. */ public void marshal(GridCacheSharedContext<K, V> sharedCtx, GridCacheContext<K, V> ctx, boolean depEnabled) - throws GridException { + throws IgniteCheckedException { boolean valIsByteArr = val != null && val instanceof byte[]; // Do not send write values to remote nodes. @@ -997,9 +997,9 @@ public class GridCacheTxEntry<K, V> implements GridPeerDeployAware, Externalizab * @param ctx Cache context. * @param ldr Class loader. * @param depEnabled Deployment enabled flag. - * @throws GridException If unmarshalling failed. + * @throws IgniteCheckedException If unmarshalling failed. */ - public void unmarshal(GridCacheContext<K, V> ctx, ClassLoader ldr, boolean depEnabled) throws GridException { + public void unmarshal(GridCacheContext<K, V> ctx, ClassLoader ldr, boolean depEnabled) throws IgniteCheckedException { if (valBytes != null && val == null && (ctx.isUnmarshalValues() || op == TRANSFORM || depEnabled)) val = ctx.marshaller().unmarshal(valBytes, ldr); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxEx.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxEx.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxEx.java index 29978e0..f1c22ea 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxEx.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxEx.java @@ -9,8 +9,8 @@ package org.gridgain.grid.kernal.processors.cache; +import org.apache.ignite.*; import org.apache.ignite.lang.*; -import org.gridgain.grid.*; import org.gridgain.grid.cache.*; import org.gridgain.grid.kernal.processors.timeout.*; import org.gridgain.grid.util.lang.*; @@ -342,9 +342,9 @@ public interface GridCacheTxEx<K, V> extends GridCacheTx, GridTimeoutObject { /** * Prepare state. * - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - public void prepare() throws GridException; + public void prepare() throws IgniteCheckedException; /** * Prepare stage. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxHandler.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxHandler.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxHandler.java index 593c424..85a240c 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxHandler.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxHandler.java @@ -224,7 +224,7 @@ public class GridCacheTxHandler<K, V> { for (GridCacheTxEntry<K, V> e : F.concat(false, req.reads(), req.writes())) e.unmarshal(ctx, false, ctx.deploy().globalLoader()); } - catch (GridException e) { + catch (IgniteCheckedException e) { return new GridFinishedFuture<>(ctx.kernalContext(), e); } @@ -280,7 +280,7 @@ public class GridCacheTxHandler<K, V> { try { tx.rollback(); } - catch (GridException e) { + catch (IgniteCheckedException e) { U.error(log, "Failed to rollback transaction: " + tx, e); } } @@ -292,7 +292,7 @@ public class GridCacheTxHandler<K, V> { try { txFut.get(); } - catch (GridException e) { + catch (IgniteCheckedException e) { tx0.setRollbackOnly(); // Just in case. if (!(e instanceof GridCacheTxOptimisticException)) @@ -466,7 +466,7 @@ public class GridCacheTxHandler<K, V> { // Always send finish response. GridCacheMessage<K, V> res = new GridNearTxFinishResponse<>(req.version(), req.threadId(), req.futureId(), - req.miniId(), new GridException("Transaction has been already completed.")); + req.miniId(), new IgniteCheckedException("Transaction has been already completed.")); try { ctx.io().send(nodeId, res); @@ -644,7 +644,7 @@ public class GridCacheTxHandler<K, V> { if (dhtTx != null && !F.isEmpty(dhtTx.invalidPartitions())) res.invalidPartitions(dhtTx.invalidPartitions()); } - catch (GridException e) { + catch (IgniteCheckedException e) { if (e instanceof GridCacheTxRollbackException) U.error(log, "Transaction was rolled back before prepare completed: " + dhtTx, e); else if (e instanceof GridCacheTxOptimisticException) { @@ -667,7 +667,7 @@ public class GridCacheTxHandler<K, V> { // Reply back to sender. ctx.io().send(nodeId, res); } - catch (GridException e) { + catch (IgniteCheckedException e) { if (e instanceof ClusterTopologyException) { if (log.isDebugEnabled()) log.debug("Failed to send tx response to remote node (node left grid) [node=" + nodeId + @@ -733,7 +733,7 @@ public class GridCacheTxHandler<K, V> { return; } - catch (GridException e) { + catch (IgniteCheckedException e) { U.error(log, "Failed to start remote DHT and Near transactions (will invalidate transactions) [dhtTx=" + dhtTx + ", nearTx=" + nearTx + ']', e); @@ -846,7 +846,7 @@ public class GridCacheTxHandler<K, V> { try { tx.commit(); } - catch (GridException ex) { + catch (IgniteCheckedException ex) { U.error(log, "Failed to invalidate transaction: " + tx, ex); } } @@ -882,11 +882,11 @@ public class GridCacheTxHandler<K, V> { * @param req Request. * @param res Response. * @return Remote transaction. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ @Nullable GridDhtTxRemote<K, V> startRemoteTx(UUID nodeId, GridDhtTxPrepareRequest<K, V> req, - GridDhtTxPrepareResponse<K, V> res) throws GridException { + GridDhtTxPrepareResponse<K, V> res) throws IgniteCheckedException { if (!F.isEmpty(req.writes())) { GridDhtTxRemote<K, V> tx = ctx.tm().tx(req.version()); @@ -981,10 +981,10 @@ public class GridCacheTxHandler<K, V> { /** * @param key Key * @param ver Version. - * @throws GridException If invalidate failed. + * @throws IgniteCheckedException If invalidate failed. */ private void invalidateNearEntry(GridCacheContext<K, V> cacheCtx, K key, GridCacheVersion ver) - throws GridException { + throws IgniteCheckedException { GridNearCacheAdapter<K, V> near = cacheCtx.isNear() ? cacheCtx.near() : cacheCtx.dht().near(); GridCacheEntryEx<K, V> nearEntry = near.peekEx(key); @@ -1000,10 +1000,10 @@ public class GridCacheTxHandler<K, V> { * @param nodeId Sender node ID. * @param req Request. * @return Remote transaction. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ @Nullable public GridNearTxRemote<K, V> startNearRemoteTx(ClassLoader ldr, UUID nodeId, - GridDhtTxPrepareRequest<K, V> req) throws GridException { + GridDhtTxPrepareRequest<K, V> req) throws IgniteCheckedException { assert F.isEmpty(req.candidatesByKey()); if (!F.isEmpty(req.nearWrites())) { @@ -1055,12 +1055,12 @@ public class GridCacheTxHandler<K, V> { * @param nodeId Primary node ID. * @param req Request. * @return Remote transaction. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. * @throws GridDistributedLockCancelledException If lock has been cancelled. */ @SuppressWarnings({"RedundantTypeArguments"}) @Nullable GridDhtTxRemote<K, V> startRemoteTxForFinish(UUID nodeId, GridDhtTxFinishRequest<K, V> req) - throws GridException, GridDistributedLockCancelledException { + throws IgniteCheckedException, GridDistributedLockCancelledException { GridDhtTxRemote<K, V> tx = null; @@ -1207,12 +1207,12 @@ public class GridCacheTxHandler<K, V> { * @param nodeId Primary node ID. * @param req Request. * @return Remote transaction. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. * @throws GridDistributedLockCancelledException If lock has been cancelled. */ @SuppressWarnings({"RedundantTypeArguments"}) @Nullable public GridNearTxRemote<K, V> startNearRemoteTxForFinish(UUID nodeId, GridDhtTxFinishRequest<K, V> req) - throws GridException, GridDistributedLockCancelledException { + throws IgniteCheckedException, GridDistributedLockCancelledException { assert req.groupLock(); GridNearTxRemote<K, V> tx = null; @@ -1341,7 +1341,7 @@ public class GridCacheTxHandler<K, V> { U.warn(log, err); - throw new GridException(err); + throw new IgniteCheckedException(err); } return tx; @@ -1371,7 +1371,7 @@ public class GridCacheTxHandler<K, V> { log.debug("Failed to send check prepared transaction response (did node leave grid?) [nodeId=" + nodeId + ", res=" + res + ']'); } - catch (GridException e) { + catch (IgniteCheckedException e) { U.error(log, "Failed to send response to node [nodeId=" + nodeId + ", res=" + res + ']', e); } } @@ -1415,7 +1415,7 @@ public class GridCacheTxHandler<K, V> { try { info = infoFut.get(); } - catch (GridException e) { + catch (IgniteCheckedException e) { U.error(log, "Failed to obtain committed info for transaction (will rollback): " + req, e); } @@ -1471,7 +1471,7 @@ public class GridCacheTxHandler<K, V> { log.debug("Failed to send check committed transaction response (did node leave grid?) [nodeId=" + nodeId + ", res=" + res + ']'); } - catch (GridException e) { + catch (IgniteCheckedException e) { U.error(log, "Failed to send response to node [nodeId=" + nodeId + ", res=" + res + ']', e); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxLocalAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxLocalAdapter.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxLocalAdapter.java index eead11f..c2e3671 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxLocalAdapter.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxLocalAdapter.java @@ -9,14 +9,14 @@ package org.gridgain.grid.kernal.processors.cache; +import org.apache.ignite.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.security.*; import org.apache.ignite.portables.*; -import org.gridgain.grid.*; import org.gridgain.grid.cache.*; import org.gridgain.grid.kernal.processors.cache.distributed.near.*; import org.gridgain.grid.kernal.processors.cache.dr.*; import org.gridgain.grid.kernal.processors.dr.*; -import org.apache.ignite.plugin.security.*; import org.gridgain.grid.util.*; import org.gridgain.grid.util.future.*; import org.gridgain.grid.util.lang.*; @@ -29,8 +29,8 @@ import java.io.*; import java.util.*; import java.util.concurrent.atomic.*; -import static org.gridgain.grid.cache.GridCacheTxState.*; import static org.apache.ignite.events.IgniteEventType.*; +import static org.gridgain.grid.cache.GridCacheTxState.*; import static org.gridgain.grid.kernal.processors.cache.GridCacheOperation.*; import static org.gridgain.grid.kernal.processors.dr.GridDrType.*; @@ -300,7 +300,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K return new GridFinishedFuture<>(cctx.kernalContext(), cacheCtx.store().loadAllFromStore(this, keys, c)); } - catch (GridException e) { + catch (IgniteCheckedException e) { return new GridFinishedFuture<>(cctx.kernalContext(), e); } } @@ -324,10 +324,10 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K } /** - * @throws GridException If prepare step failed. + * @throws IgniteCheckedException If prepare step failed. */ @SuppressWarnings({"CatchGenericClass"}) - public void userPrepare() throws GridException { + public void userPrepare() throws IgniteCheckedException { if (state() != PREPARING) { if (timedOut()) throw new GridCacheTxTimeoutException("Transaction timed out: " + this); @@ -336,7 +336,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K setRollbackOnly(); - throw new GridException("Invalid transaction state for prepare [state=" + state + ", tx=" + this + ']'); + throw new IgniteCheckedException("Invalid transaction state for prepare [state=" + state + ", tx=" + this + ']'); } checkValid(); @@ -344,18 +344,18 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K try { cctx.tm().prepareTx(this); } - catch (GridException e) { + catch (IgniteCheckedException e) { throw e; } catch (Throwable e) { setRollbackOnly(); - throw new GridException("Transaction validation produced a runtime exception: " + this, e); + throw new IgniteCheckedException("Transaction validation produced a runtime exception: " + this, e); } } /** {@inheritDoc} */ - @Override public void commit() throws GridException { + @Override public void commit() throws IgniteCheckedException { try { commitAsync().get(); } @@ -365,7 +365,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K } /** {@inheritDoc} */ - @Override public void prepare() throws GridException { + @Override public void prepare() throws IgniteCheckedException { prepareAsync().get(); } @@ -445,10 +445,10 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K * cache transaction can still be rolled back. * * @param writeEntries Transaction write set. - * @throws GridException If batch update failed. + * @throws IgniteCheckedException If batch update failed. */ @SuppressWarnings({"CatchGenericClass"}) - protected void batchStoreCommit(Iterable<GridCacheTxEntry<K, V>> writeEntries) throws GridException { + protected void batchStoreCommit(Iterable<GridCacheTxEntry<K, V>> writeEntries) throws IgniteCheckedException { GridCacheStoreManager<K, V> store = store(); if (store != null && (!internal() || groupLock())) { @@ -549,7 +549,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K // Commit while locks are held. store.txEnd(this, true); } - catch (GridException ex) { + catch (IgniteCheckedException ex) { commitError(ex); setRollbackOnly(); @@ -567,14 +567,14 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K // Safe to remove transaction from committed tx list because nothing was committed yet. cctx.tm().removeCommittedTx(this); - throw new GridException("Failed to commit transaction to database: " + this, ex); + throw new IgniteCheckedException("Failed to commit transaction to database: " + this, ex); } } } /** {@inheritDoc} */ @SuppressWarnings({"CatchGenericClass"}) - @Override public void userCommit() throws GridException { + @Override public void userCommit() throws IgniteCheckedException { GridCacheTxState state = state(); if (state != COMMITTING) { @@ -583,7 +583,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K setRollbackOnly(); - throw new GridException("Invalid transaction state for commit [state=" + state + ", tx=" + this + ']'); + throw new IgniteCheckedException("Invalid transaction state for commit [state=" + state + ", tx=" + this + ']'); } checkValid(); @@ -835,7 +835,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K throw ex; } else { - GridException err = new GridCacheTxHeuristicException("Failed to locally write to cache " + + IgniteCheckedException err = new GridCacheTxHeuristicException("Failed to locally write to cache " + "(all transaction entries will be invalidated, however there was a window when " + "entries for this transaction were visible to others): " + this, ex); @@ -869,7 +869,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K try { store.txEnd(this, true); } - catch (GridException e) { + catch (IgniteCheckedException e) { commitError(e); setRollbackOnly(); @@ -948,13 +948,13 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K } /** {@inheritDoc} */ - @Override public void userRollback() throws GridException { + @Override public void userRollback() throws IgniteCheckedException { GridCacheTxState state = state(); if (state != ROLLING_BACK && state != ROLLED_BACK) { setRollbackOnly(); - throw new GridException("Invalid transaction state for rollback [state=" + state + ", tx=" + this + ']', + throw new IgniteCheckedException("Invalid transaction state for rollback [state=" + state + ", tx=" + this + ']', commitErr.get()); } @@ -975,7 +975,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K store.txEnd(this, false); } } - catch (Error | GridException | RuntimeException e) { + catch (Error | IgniteCheckedException | RuntimeException e) { U.addLastCause(e, commitErr.get(), log); throw e; @@ -995,7 +995,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K * @param keysCnt Keys count (to avoid call to {@code Collection.size()}). * @param deserializePortable Deserialize portable flag. * @param filter Filter to test. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. * @return Enlisted keys. */ @SuppressWarnings({"RedundantTypeArguments"}) @@ -1007,7 +1007,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K Map<K, GridCacheVersion> missed, int keysCnt, boolean deserializePortable, - IgnitePredicate<GridCacheEntry<K, V>>[] filter) throws GridException { + IgnitePredicate<GridCacheEntry<K, V>>[] filter) throws IgniteCheckedException { assert !F.isEmpty(keys); assert keysCnt == keys.size(); assert cached == null || F.first(keys).equals(cached.key()); @@ -1381,8 +1381,8 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K break; // While loop. } - catch (GridException ex) { - throw new GridRuntimeException("Failed to put value for cache entry: " + e, ex); + catch (IgniteCheckedException ex) { + throw new IgniteException("Failed to put value for cache entry: " + e, ex); } } } @@ -1461,7 +1461,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K isolation, isInvalidate(), CU.<K, V>empty()); PLC2<Map<K, V>> plc2 = new PLC2<Map<K, V>>() { - @Override public IgniteFuture<Map<K, V>> postLock() throws GridException { + @Override public IgniteFuture<Map<K, V>> postLock() throws IgniteCheckedException { if (log.isDebugEnabled()) log.debug("Acquired transaction lock for read on keys: " + lockKeys); @@ -1574,7 +1574,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K catch (GridClosureException e) { return new GridFinishedFuture<>(cctx.kernalContext(), e.unwrap()); } - catch (GridException e) { + catch (IgniteCheckedException e) { try { return plc2.apply(false, e); } @@ -1651,7 +1651,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K return new GridFinishedFuture<>(cctx.kernalContext(), retMap); } } - catch (GridException e) { + catch (IgniteCheckedException e) { setRollbackOnly(); return new GridFinishedFuture<>(cctx.kernalContext(), e); @@ -1703,10 +1703,10 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K * @param cached Cached entry. * @param filter Filter to check. * @return {@code True} if passed or pessimistic. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ private boolean filter(GridCacheEntryEx<K, V> cached, - IgnitePredicate<GridCacheEntry<K, V>>[] filter) throws GridException { + IgnitePredicate<GridCacheEntry<K, V>>[] filter) throws IgniteCheckedException { return pessimistic() || cached.context().isAll(cached, filter); } @@ -1750,7 +1750,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K try { addActiveCache(cacheCtx); } - catch (GridException e) { + catch (IgniteCheckedException e) { return new GridFinishedFuture<>(cctx.kernalContext(), e); } @@ -1831,7 +1831,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K // Check if lock is being explicitly acquired by the same thread. if (!implicit && cctx.kernalContext().config().isCacheSanityCheckEnabled() && entry.lockedByThread(threadId, xidVer)) - throw new GridException("Cannot access key within transaction if lock is " + + throw new IgniteCheckedException("Cannot access key within transaction if lock is " + "externally held [key=" + key + ", entry=" + entry + ", xidVer=" + xidVer + ", threadId=" + threadId + ", locNodeId=" + cctx.localNodeId() + ']'); @@ -1954,7 +1954,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K } else { if (transformClo == null && txEntry.op() == TRANSFORM) - throw new GridException("Failed to enlist write value for key (cannot have update value in " + + throw new IgniteCheckedException("Failed to enlist write value for key (cannot have update value in " + "transaction after transform closure is applied): " + key); GridCacheEntryEx<K, V> entry = txEntry.cached(); @@ -1988,7 +1988,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K } } } - catch (GridException e) { + catch (IgniteCheckedException e) { return new GridFinishedFuture<>(cctx.kernalContext(), e); } @@ -2007,7 +2007,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K * @param retval Flag to return value or not. * @param filter Filter to check entries. * @return Failed keys. - * @throws GridException If error. + * @throws IgniteCheckedException If error. */ protected Set<K> postLockWrite( GridCacheContext<K, V> cacheCtx, @@ -2019,12 +2019,12 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K boolean rmv, boolean retval, IgnitePredicate<GridCacheEntry<K, V>>[] filter - ) throws GridException { + ) throws IgniteCheckedException { for (K k : keys) { GridCacheTxEntry<K, V> txEntry = entry(cacheCtx.txKey(k)); if (txEntry == null) - throw new GridException("Transaction entry is null (most likely collection of keys passed into cache " + + throw new IgniteCheckedException("Transaction entry is null (most likely collection of keys passed into cache " + "operation was changed before operation completed) [missingKey=" + k + ", tx=" + this + ']'); while (true) { @@ -2211,7 +2211,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K try { checkValid(); } - catch (GridException e) { + catch (IgniteCheckedException e) { return new GridFinishedFuture<>(cctx.kernalContext(), e); } @@ -2224,7 +2224,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K try { commit(); } - catch (GridException e) { + catch (IgniteCheckedException e) { return new GridFinishedFuture<>(cctx.kernalContext(), e); } @@ -2276,7 +2276,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K retval, isolation, isInvalidate(), CU.<K, V>empty()); PLC1<GridCacheReturn<V>> plc1 = new PLC1<GridCacheReturn<V>>(ret) { - @Override public GridCacheReturn<V> postLock(GridCacheReturn<V> ret) throws GridException { + @Override public GridCacheReturn<V> postLock(GridCacheReturn<V> ret) throws IgniteCheckedException { if (log.isDebugEnabled()) log.debug("Acquired transaction lock for put on keys: " + keys); @@ -2296,7 +2296,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K catch (GridClosureException e) { return new GridFinishedFuture<>(cctx.kernalContext(), e.unwrap()); } - catch (GridException e) { + catch (IgniteCheckedException e) { try { return plc1.apply(false, e); } @@ -2313,7 +2313,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K } else { return loadFut.chain(new CX1<IgniteFuture<Set<K>>, GridCacheReturn<V>>() { - @Override public GridCacheReturn<V> applyx(IgniteFuture<Set<K>> f) throws GridException { + @Override public GridCacheReturn<V> applyx(IgniteFuture<Set<K>> f) throws IgniteCheckedException { f.get(); return ret; @@ -2321,7 +2321,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K }); } } - catch (GridException e) { + catch (IgniteCheckedException e) { setRollbackOnly(); return new GridFinishedFuture<>(cctx.kernalContext(), e); @@ -2393,7 +2393,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K try { checkValid(); } - catch (GridException e) { + catch (IgniteCheckedException e) { return new GridFinishedFuture<>(cctx.kernalContext(), e); } @@ -2404,7 +2404,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K try { commit(); } - catch (GridException e) { + catch (IgniteCheckedException e) { return new GridFinishedFuture<>(cctx.kernalContext(), e); } } @@ -2451,7 +2451,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K isolation, isInvalidate(), CU.<K, V>empty()); PLC1<GridCacheReturn<V>> plc1 = new PLC1<GridCacheReturn<V>>(ret) { - @Override protected GridCacheReturn<V> postLock(GridCacheReturn<V> ret) throws GridException { + @Override protected GridCacheReturn<V> postLock(GridCacheReturn<V> ret) throws IgniteCheckedException { if (log.isDebugEnabled()) log.debug("Acquired transaction lock for remove on keys: " + passedKeys); @@ -2469,7 +2469,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K catch (GridClosureException e) { return new GridFinishedFuture<>(cctx.kernalContext(), e.unwrap()); } - catch (GridException e) { + catch (IgniteCheckedException e) { try { return plc1.apply(false, e); } @@ -2486,7 +2486,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K } else { return loadFut.chain(new CX1<IgniteFuture<Set<K>>, GridCacheReturn<V>>() { - @Override public GridCacheReturn<V> applyx(IgniteFuture<Set<K>> f) throws GridException { + @Override public GridCacheReturn<V> applyx(IgniteFuture<Set<K>> f) throws IgniteCheckedException { f.get(); return ret; @@ -2494,7 +2494,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K }); } } - catch (GridException e) { + catch (IgniteCheckedException e) { setRollbackOnly(); return new GridFinishedFuture<>(cctx.kernalContext(), e); @@ -2525,9 +2525,9 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K * Checks that affinity keys are enlisted in group transaction on start. * * @param keys Keys to check. - * @throws GridException If sanity check failed. + * @throws IgniteCheckedException If sanity check failed. */ - private void groupLockSanityCheck(GridCacheContext<K, V> cacheCtx, Iterable<? extends K> keys) throws GridException { + private void groupLockSanityCheck(GridCacheContext<K, V> cacheCtx, Iterable<? extends K> keys) throws IgniteCheckedException { if (groupLock() && cctx.kernalContext().config().isCacheSanityCheckEnabled()) { // Note that affinity is called without mapper on purpose. int affinityPart = cacheCtx.config().getAffinity().partition(grpLockKey.key()); @@ -2537,7 +2537,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K int part = cacheCtx.affinity().partition(key); if (affinityPart != part) - throw new GridException("Failed to enlist key into group-lock transaction (given " + + throw new IgniteCheckedException("Failed to enlist key into group-lock transaction (given " + "key does not belong to locked partition) [key=" + key + ", affinityPart=" + affinityPart + ", part=" + part + ", groupLockKey=" + grpLockKey + ']'); } @@ -2545,7 +2545,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K Object affinityKey = cacheCtx.config().getAffinityMapper().affinityKey(key); if (!grpLockKey.equals(affinityKey)) - throw new GridException("Failed to enlist key into group-lock transaction (affinity key was " + + throw new IgniteCheckedException("Failed to enlist key into group-lock transaction (affinity key was " + "not enlisted to transaction on start) [key=" + key + ", affinityKey=" + affinityKey + ", groupLockKey=" + grpLockKey + ']'); } @@ -2593,7 +2593,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K CU.<K, V>empty()) : new GridFinishedFuture<>(cctx.kernalContext()); } - catch (GridException e) { + catch (IgniteCheckedException e) { setRollbackOnly(); return new GridFinishedFuture<Object>(cctx.kernalContext(), e); @@ -2622,10 +2622,10 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K * Adds cache to the list of active caches in transaction. * * @param cacheCtx Cache context to add. - * @throws GridException If caches already enlisted in this transaction are not compatible with given + * @throws IgniteCheckedException If caches already enlisted in this transaction are not compatible with given * cache (e.g. they have different stores). */ - private void addActiveCache(GridCacheContext<K, V> cacheCtx) throws GridException { + private void addActiveCache(GridCacheContext<K, V> cacheCtx) throws IgniteCheckedException { // If this is a first cache to work on, capture cache settings. if (activeCacheIds.isEmpty() || !activeCacheIds.contains(cacheCtx.cacheId()) && cctx.txCompatible(activeCacheIds, cacheCtx)) @@ -2635,9 +2635,9 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K /** * Checks transaction expiration. * - * @throws GridException If transaction check failed. + * @throws IgniteCheckedException If transaction check failed. */ - protected void checkValid() throws GridException { + protected void checkValid() throws IgniteCheckedException { if (isRollbackOnly()) { if (timedOut()) throw new GridCacheTxTimeoutException("Cache transaction timed out: " + this); @@ -2652,7 +2652,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K throw new GridCacheTxHeuristicException("Cache transaction is in unknown state " + "(remote transactions will be invalidated): " + this); - throw new GridException("Cache transaction marked as rollback-only: " + this); + throw new IgniteCheckedException("Cache transaction marked as rollback-only: " + this); } if (remainingTime() == 0 && setRollbackOnly()) @@ -3013,7 +3013,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K rollback = false; return commitAsync().chain(new CX1<IgniteFuture<GridCacheTx>, T>() { - @Override public T applyx(IgniteFuture<GridCacheTx> f) throws GridException { + @Override public T applyx(IgniteFuture<GridCacheTx> f) throws IgniteCheckedException { f.get(); return r; @@ -3025,7 +3025,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K return new GridFinishedFuture<>(cctx.kernalContext(), r); } - catch (final GridException ex) { + catch (final IgniteCheckedException ex) { if (commit && commitAfterLock()) return rollbackAsync().chain(new C1<IgniteFuture<GridCacheTx>, T>() { @Override public T apply(IgniteFuture<GridCacheTx> f) { @@ -3046,9 +3046,9 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K * * @param val Argument. * @return Future return value. - * @throws GridException If operation failed. + * @throws IgniteCheckedException If operation failed. */ - protected abstract T postLock(T val) throws GridException; + protected abstract T postLock(T val) throws IgniteCheckedException; } /** @@ -3078,7 +3078,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K return fut; } - catch (GridException ex) { + catch (IgniteCheckedException ex) { throw new GridClosureException(ex); } finally { @@ -3091,9 +3091,9 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K * Post lock callback. * * @return Future return value. - * @throws GridException If operation failed. + * @throws IgniteCheckedException If operation failed. */ - protected abstract IgniteFuture<T> postLock() throws GridException; + protected abstract IgniteFuture<T> postLock() throws IgniteCheckedException; } /** @@ -3119,7 +3119,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K return fut; } - catch (GridException ex) { + catch (IgniteCheckedException ex) { throw new GridClosureException(ex); } finally { @@ -3133,9 +3133,9 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K * * @param t Post-miss parameter. * @return Future return value. - * @throws GridException If operation failed. + * @throws IgniteCheckedException If operation failed. */ - protected abstract IgniteFuture<T> postMiss(T t) throws GridException; + protected abstract IgniteFuture<T> postMiss(T t) throws IgniteCheckedException; } /** @@ -3165,7 +3165,7 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K return t; } - catch (GridException ex) { + catch (IgniteCheckedException ex) { throw new GridClosureException(ex); } finally { @@ -3177,8 +3177,8 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K /** * @param t Argument. * @return Result. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - abstract T finish(T t) throws GridException; + abstract T finish(T t) throws IgniteCheckedException; } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxLocalEx.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxLocalEx.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxLocalEx.java index 1813ae1..524243c 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxLocalEx.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxLocalEx.java @@ -9,8 +9,8 @@ package org.gridgain.grid.kernal.processors.cache; +import org.apache.ignite.*; import org.apache.ignite.lang.*; -import org.gridgain.grid.*; import org.gridgain.grid.cache.*; import org.gridgain.grid.kernal.processors.cache.dr.*; import org.jetbrains.annotations.*; @@ -42,14 +42,14 @@ public interface GridCacheTxLocalEx<K, V> extends GridCacheTxEx<K, V> { public void commitError(Throwable e); /** - * @throws GridException If commit failed. + * @throws IgniteCheckedException If commit failed. */ - public void userCommit() throws GridException; + public void userCommit() throws IgniteCheckedException; /** - * @throws GridException If rollback failed. + * @throws IgniteCheckedException If rollback failed. */ - public void userRollback() throws GridException; + public void userRollback() throws IgniteCheckedException; /** * @return Group lock entry if this is a group-lock transaction. @@ -146,9 +146,9 @@ public interface GridCacheTxLocalEx<K, V> extends GridCacheTxEx<K, V> { * * @param commit {@code True} if commit, {@code false} if rollback. * @return {@code True} if state has been changed. - * @throws GridException If finish failed. + * @throws IgniteCheckedException If finish failed. */ - public boolean finish(boolean commit) throws GridException; + public boolean finish(boolean commit) throws IgniteCheckedException; /** * @param async if {@code True}, then loading will happen in a separate thread. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxManager.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxManager.java index 52c43f4..7179f8e 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxManager.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxManager.java @@ -9,9 +9,9 @@ package org.gridgain.grid.kernal.processors.cache; +import org.apache.ignite.*; import org.apache.ignite.events.*; import org.apache.ignite.lang.*; -import org.gridgain.grid.*; import org.gridgain.grid.cache.*; import org.gridgain.grid.kernal.managers.eventstorage.*; import org.gridgain.grid.kernal.processors.cache.distributed.*; @@ -32,9 +32,9 @@ import java.util.concurrent.*; import java.util.concurrent.atomic.*; import static org.apache.ignite.IgniteSystemProperties.*; +import static org.apache.ignite.events.IgniteEventType.*; import static org.gridgain.grid.cache.GridCacheTxConcurrency.*; import static org.gridgain.grid.cache.GridCacheTxState.*; -import static org.apache.ignite.events.IgniteEventType.*; import static org.gridgain.grid.kernal.processors.cache.GridCacheTxEx.FinalizationStatus.*; import static org.gridgain.grid.kernal.processors.cache.GridCacheUtils.*; import static org.gridgain.grid.util.GridConcurrentFactory.*; @@ -137,7 +137,7 @@ public class GridCacheTxManager<K, V> extends GridCacheSharedManagerAdapter<K, V } /** {@inheritDoc} */ - @Override protected void start0() throws GridException { + @Override protected void start0() throws IgniteCheckedException { pessimisticRecoveryBuf = new GridCachePerThreadTxCommitBuffer<>(cctx); txFinishSync = new GridCacheTxFinishSync<>(cctx); @@ -220,11 +220,11 @@ public class GridCacheTxManager<K, V> extends GridCacheSharedManagerAdapter<K, V try { tx.rollback(); } - catch (GridException e) { + catch (IgniteCheckedException e) { U.error(log, "Failed to rollback transaction: " + tx.xidVersion(), e); } } - catch (GridException e) { + catch (IgniteCheckedException e) { U.error(log, "Failed to invalidate transaction: " + tx, e); } } @@ -232,7 +232,7 @@ public class GridCacheTxManager<K, V> extends GridCacheSharedManagerAdapter<K, V try { tx.rollback(); } - catch (GridException e) { + catch (IgniteCheckedException e) { U.error(log, "Failed to rollback transaction: " + tx.xidVersion(), e); } } @@ -721,14 +721,14 @@ public class GridCacheTxManager<K, V> extends GridCacheSharedManagerAdapter<K, V * Handles prepare stage of 2PC. * * @param tx Transaction to prepare. - * @throws GridException If preparation failed. + * @throws IgniteCheckedException If preparation failed. */ - public void prepareTx(GridCacheTxEx<K, V> tx) throws GridException { + public void prepareTx(GridCacheTxEx<K, V> tx) throws IgniteCheckedException { if (tx.state() == MARKED_ROLLBACK) { if (tx.timedOut()) throw new GridCacheTxTimeoutException("Transaction timed out: " + this); - throw new GridException("Transaction is marked for rollback: " + tx); + throw new IgniteCheckedException("Transaction is marked for rollback: " + tx); } if (tx.remainingTime() == 0) { @@ -923,7 +923,7 @@ public class GridCacheTxManager<K, V> extends GridCacheSharedManagerAdapter<K, V near.removeEntry(e); } } - catch (GridException e) { + catch (IgniteCheckedException e) { U.error(log, "Failed to remove obsolete entry from cache: " + cached, e); } } @@ -1163,7 +1163,7 @@ public class GridCacheTxManager<K, V> extends GridCacheSharedManagerAdapter<K, V if (!(committedVers.contains(tx.xidVersion()) || tx.writeSet().isEmpty() || tx.isSystemInvalidate())) { uncommitTx(tx); - throw new GridRuntimeException("Missing commit version (consider increasing " + + throw new IgniteException("Missing commit version (consider increasing " + GG_MAX_COMPLETED_TX_COUNT + " system property) [ver=" + tx.xidVersion() + ", firstVer=" + committedVers.firstx() + ", lastVer=" + committedVers.lastx() + ", tx=" + tx.xid() + ']'); } @@ -1481,10 +1481,10 @@ public class GridCacheTxManager<K, V> extends GridCacheSharedManagerAdapter<K, V * @param tx Transaction. * @param entries Entries to lock. * @return {@code True} if all keys were locked. - * @throws GridException If lock has been cancelled. + * @throws IgniteCheckedException If lock has been cancelled. */ private boolean lockMultiple(GridCacheTxEx<K, V> tx, Iterable<GridCacheTxEntry<K, V>> entries) - throws GridException { + throws IgniteCheckedException { assert tx.optimistic(); long remainingTime = U.currentTimeMillis() - (tx.startTime() + tx.timeout()); @@ -1545,7 +1545,7 @@ public class GridCacheTxManager<K, V> extends GridCacheSharedManagerAdapter<K, V catch (GridDistributedLockCancelledException ignore) { tx.setRollbackOnly(); - throw new GridException("Entry lock has been cancelled for transaction: " + tx); + throw new IgniteCheckedException("Entry lock has been cancelled for transaction: " + tx); } } } @@ -1938,7 +1938,7 @@ public class GridCacheTxManager<K, V> extends GridCacheSharedManagerAdapter<K, V else tx.rollbackAsync(); } - catch (GridException e) { + catch (IgniteCheckedException e) { U.error(log, "Failed to prepare pessimistic transaction (will invalidate): " + tx, e); salvageTx(tx); @@ -2186,7 +2186,7 @@ public class GridCacheTxManager<K, V> extends GridCacheSharedManagerAdapter<K, V tx.rollbackAsync(); } - catch (GridException e) { + catch (IgniteCheckedException e) { U.error(log, "Failed to commit transaction during failover: " + tx, e); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxProxyImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxProxyImpl.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxProxyImpl.java index c34717d..4e61db6 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxProxyImpl.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxProxyImpl.java @@ -9,11 +9,12 @@ package org.gridgain.grid.kernal.processors.cache; +import org.apache.ignite.*; import org.apache.ignite.lang.*; import org.gridgain.grid.*; import org.gridgain.grid.cache.*; -import org.gridgain.grid.util.typedef.internal.*; import org.gridgain.grid.util.tostring.*; +import org.gridgain.grid.util.typedef.internal.*; import org.jetbrains.annotations.*; import java.io.*; @@ -165,7 +166,7 @@ public class GridCacheTxProxyImpl<K, V> implements GridCacheTxProxy, Externaliza } /** {@inheritDoc} */ - @Override public void commit() throws GridException { + @Override public void commit() throws IgniteCheckedException { enter(); try { @@ -177,7 +178,7 @@ public class GridCacheTxProxyImpl<K, V> implements GridCacheTxProxy, Externaliza } /** {@inheritDoc} */ - @Override public void close() throws GridException { + @Override public void close() throws IgniteCheckedException { enter(); try { @@ -202,7 +203,7 @@ public class GridCacheTxProxyImpl<K, V> implements GridCacheTxProxy, Externaliza } /** {@inheritDoc} */ - @Override public void rollback() throws GridException { + @Override public void rollback() throws IgniteCheckedException { enter(); try {