http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMapAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMapAdapter.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMapAdapter.java index a127b4b..7024bd3 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMapAdapter.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMapAdapter.java @@ -9,6 +9,7 @@ package org.gridgain.grid.kernal.processors.cache; +import org.apache.ignite.*; import org.gridgain.grid.*; import org.gridgain.grid.cache.*; import org.jetbrains.annotations.*; @@ -61,8 +62,8 @@ public class GridCacheMapAdapter<K, V> implements ConcurrentMap<K, V> { try { return prj.get((K)key); } - catch (GridException e) { - throw new GridRuntimeException(e); + catch (IgniteCheckedException e) { + throw new IgniteException(e); } } @@ -72,8 +73,8 @@ public class GridCacheMapAdapter<K, V> implements ConcurrentMap<K, V> { try { return prj.put(key, value); } - catch (GridException e) { - throw new GridRuntimeException(e); + catch (IgniteCheckedException e) { + throw new IgniteException(e); } } @@ -84,8 +85,8 @@ public class GridCacheMapAdapter<K, V> implements ConcurrentMap<K, V> { try { return prj.remove((K)key); } - catch (GridException e) { - throw new GridRuntimeException(e); + catch (IgniteCheckedException e) { + throw new IgniteException(e); } } @@ -94,8 +95,8 @@ public class GridCacheMapAdapter<K, V> implements ConcurrentMap<K, V> { try { prj.putAll(map); } - catch (GridException e) { - throw new GridRuntimeException(e); + catch (IgniteCheckedException e) { + throw new IgniteException(e); } } @@ -105,8 +106,8 @@ public class GridCacheMapAdapter<K, V> implements ConcurrentMap<K, V> { try { return prj.putIfAbsent(key, val); } - catch (GridException e) { - throw new GridRuntimeException(e); + catch (IgniteCheckedException e) { + throw new IgniteException(e); } } @@ -116,8 +117,8 @@ public class GridCacheMapAdapter<K, V> implements ConcurrentMap<K, V> { try { return prj.remove((K)key, (V)val); } - catch (GridException e) { - throw new GridRuntimeException(e); + catch (IgniteCheckedException e) { + throw new IgniteException(e); } } @@ -126,8 +127,8 @@ public class GridCacheMapAdapter<K, V> implements ConcurrentMap<K, V> { try { return prj.replace(key, oldVal, newVal); } - catch (GridException e) { - throw new GridRuntimeException(e); + catch (IgniteCheckedException e) { + throw new IgniteException(e); } } @@ -137,8 +138,8 @@ public class GridCacheMapAdapter<K, V> implements ConcurrentMap<K, V> { try { return prj.replace(key, val); } - catch (GridException e) { - throw new GridRuntimeException(e); + catch (IgniteCheckedException e) { + throw new IgniteException(e); } }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMapEntry.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMapEntry.java index c2846f2..32c1485 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMapEntry.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMapEntry.java @@ -243,10 +243,10 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> valPtr = 0; } } - catch (GridException e) { + catch (IgniteCheckedException e) { U.error(log, "Failed to deserialize value [entry=" + this + ", val=" + val + ']'); - throw new GridRuntimeException(e); + throw new IgniteException(e); } } } @@ -278,8 +278,8 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> if (valPtr != 0 && cctx.offheapTiered()) return offheapValueBytes(); } - catch (GridException e) { - throw new GridRuntimeException(e); + catch (IgniteCheckedException e) { + throw new IgniteException(e); } } else { @@ -296,7 +296,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> } /** {@inheritDoc} */ - @Override public int memorySize() throws GridException { + @Override public int memorySize() throws IgniteCheckedException { byte[] kb; GridCacheValueBytes vb; @@ -447,15 +447,15 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> } } } - catch (GridException e) { - throw new GridRuntimeException("Failed to unmarshal object while creating entry info: " + this, e); + catch (IgniteCheckedException e) { + throw new IgniteException("Failed to unmarshal object while creating entry info: " + this, e); } return info; } /** {@inheritDoc} */ - @Override public V unswap() throws GridException { + @Override public V unswap() throws IgniteCheckedException { return unswap(false, true); } @@ -465,9 +465,9 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> * @param ignoreFlags Whether to ignore swap flags. * @param needVal If {@code false} then do not to deserialize value during unswap. * @return Value. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - @Nullable @Override public V unswap(boolean ignoreFlags, boolean needVal) throws GridException { + @Nullable @Override public V unswap(boolean ignoreFlags, boolean needVal) throws IgniteCheckedException { boolean swapEnabled = cctx.swap().swapEnabled() && (ignoreFlags || !cctx.hasFlag(SKIP_SWAP)); if (!swapEnabled && !cctx.isOffHeapEnabled()) @@ -535,9 +535,9 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> } /** - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - private void swap() throws GridException { + private void swap() throws IgniteCheckedException { if (cctx.isSwapOrOffheapEnabled() && !deletedUnlocked() && hasValueUnlocked() && !detached()) { assert Thread.holdsLock(this); @@ -587,9 +587,9 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> } /** - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - protected final void releaseSwap() throws GridException { + protected final void releaseSwap() throws IgniteCheckedException { if (cctx.isSwapOrOffheapEnabled()) { synchronized (this){ cctx.swap().remove(key(), getOrMarshalKeyBytes()); @@ -633,7 +633,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> try { val = cctx.store().loadFromStore(null, key); } - catch (GridException e) { + catch (IgniteCheckedException e) { U.error(log, "Failed to refresh-ahead entry: " + GridCacheMapEntry.this, e); } finally { @@ -660,7 +660,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> // Don't change version for read-through. update(val, null, expTime, ttl, ver); } - catch (GridException e) { + catch (IgniteCheckedException e) { U.error(log, "Failed to update cache index: " + GridCacheMapEntry.this, e); } } @@ -678,11 +678,11 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> * @param subjId Subject ID. * @param taskName Task name. * @return Read value. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ @SuppressWarnings({"RedundantTypeArguments"}) @Nullable protected V readThrough(@Nullable GridCacheTxEx<K, V> tx, K key, boolean reload, - IgnitePredicate<GridCacheEntry<K, V>>[] filter, UUID subjId, String taskName) throws GridException { + IgnitePredicate<GridCacheEntry<K, V>>[] filter, UUID subjId, String taskName) throws IgniteCheckedException { return cctx.store().loadFromStore(tx, key); } @@ -699,7 +699,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> Object transformClo, String taskName, IgnitePredicate<GridCacheEntry<K, V>>[] filter) - throws GridException, GridCacheEntryRemovedException, GridCacheFilterFailedException { + throws IgniteCheckedException, GridCacheEntryRemovedException, GridCacheFilterFailedException { cctx.denyOnFlag(LOCAL); return innerGet0(tx, @@ -730,7 +730,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> Object transformClo, String taskName, IgnitePredicate<GridCacheEntry<K, V>>[] filter) - throws GridException, GridCacheEntryRemovedException, GridCacheFilterFailedException { + throws IgniteCheckedException, GridCacheEntryRemovedException, GridCacheFilterFailedException { // Disable read-through if there is no store. if (readThrough && !cctx.isStoreEnabled()) readThrough = false; @@ -992,7 +992,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> /** {@inheritDoc} */ @SuppressWarnings({"unchecked", "TooBroadScope"}) @Nullable @Override public final V innerReload(IgnitePredicate<GridCacheEntry<K, V>>[] filter) - throws GridException, GridCacheEntryRemovedException { + throws IgniteCheckedException, GridCacheEntryRemovedException { cctx.denyOnFlag(GridCacheFlag.READ); CU.checkStore(cctx); @@ -1110,7 +1110,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> @Nullable GridCacheVersion explicitVer, @Nullable UUID subjId, String taskName - ) throws GridException, GridCacheEntryRemovedException { + ) throws IgniteCheckedException, GridCacheEntryRemovedException { V old; boolean valid = valid(tx != null ? tx.topologyVersion() : topVer); @@ -1248,7 +1248,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> @Nullable GridCacheVersion explicitVer, @Nullable UUID subjId, String taskName - ) throws GridException, GridCacheEntryRemovedException { + ) throws IgniteCheckedException, GridCacheEntryRemovedException { assert cctx.transactional(); V old; @@ -1436,7 +1436,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> boolean intercept, @Nullable UUID subjId, String taskName - ) throws GridException, GridCacheEntryRemovedException { + ) throws IgniteCheckedException, GridCacheEntryRemovedException { assert cctx.isLocal() && cctx.atomic(); V old; @@ -1639,7 +1639,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> boolean intercept, @Nullable UUID subjId, String taskName - ) throws GridException, GridCacheEntryRemovedException, GridClosureException { + ) throws IgniteCheckedException, GridCacheEntryRemovedException, GridClosureException { assert cctx.atomic(); V old; @@ -2016,10 +2016,10 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> * @param val Value. * @param valBytes Value bytes. * @param ver Version. - * @throws GridException In case of exception. + * @throws IgniteCheckedException In case of exception. */ private void drReplicate(GridDrType drType, @Nullable V val, @Nullable byte[] valBytes, GridCacheVersion ver) - throws GridException { + throws IgniteCheckedException { if (cctx.isDrEnabled() && drType != DR_NONE && !isInternal()) cctx.dr().replicate(key, keyBytes, val, valBytes, rawTtl(), rawExpireTime(), ver.drVersion(), drType); } @@ -2041,7 +2041,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> /** {@inheritDoc} */ @Override public boolean clear(GridCacheVersion ver, boolean readers, - @Nullable IgnitePredicate<GridCacheEntry<K, V>>[] filter) throws GridException { + @Nullable IgnitePredicate<GridCacheEntry<K, V>>[] filter) throws IgniteCheckedException { cctx.denyOnFlag(GridCacheFlag.READ); boolean ret; @@ -2143,7 +2143,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> } /** {@inheritDoc} */ - @Override public boolean markObsoleteIfEmpty(@Nullable GridCacheVersion ver) throws GridException { + @Override public boolean markObsoleteIfEmpty(@Nullable GridCacheVersion ver) throws IgniteCheckedException { boolean obsolete = false; boolean deferred = false; @@ -2258,7 +2258,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> /** {@inheritDoc} */ @Override public synchronized boolean invalidate(@Nullable GridCacheVersion curVer, GridCacheVersion newVer) - throws GridException { + throws IgniteCheckedException { assert newVer != null; if (curVer == null || ver.equals(curVer)) { @@ -2287,7 +2287,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> /** {@inheritDoc} */ @Override public boolean invalidate(@Nullable IgnitePredicate<GridCacheEntry<K, V>>[] filter) - throws GridCacheEntryRemovedException, GridException { + throws GridCacheEntryRemovedException, IgniteCheckedException { if (F.isEmptyOrNulls(filter)) { synchronized (this) { checkObsolete(); @@ -2327,7 +2327,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> /** {@inheritDoc} */ @Override public boolean compact(@Nullable IgnitePredicate<GridCacheEntry<K, V>>[] filter) - throws GridCacheEntryRemovedException, GridException { + throws GridCacheEntryRemovedException, IgniteCheckedException { // For optimistic checking. GridCacheVersion startVer; @@ -2492,8 +2492,8 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> return null; } - catch (GridException e) { - throw new GridRuntimeException("Unable to perform entry peek() operation.", e); + catch (IgniteCheckedException e) { + throw new IgniteException("Unable to perform entry peek() operation.", e); } } @@ -2514,8 +2514,8 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> return null; } - catch (GridException e) { - throw new GridRuntimeException("Unable to perform entry peek() operation.", e); + catch (IgniteCheckedException e) { + throw new IgniteException("Unable to perform entry peek() operation.", e); } } @@ -2531,8 +2531,8 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> return peek != null ? peek.get() : null; } - catch (GridException e) { - throw new GridRuntimeException("Unable to perform entry peek() operation.", e); + catch (IgniteCheckedException e) { + throw new IgniteException("Unable to perform entry peek() operation.", e); } } @@ -2542,14 +2542,14 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> * @param filter Filter. * @param tx Transaction to peek value at (if mode is TX value). * @return Peeked value. - * @throws GridException In case of error. + * @throws IgniteCheckedException In case of error. * @throws GridCacheEntryRemovedException If removed. * @throws GridCacheFilterFailedException If filter failed. */ @SuppressWarnings({"RedundantTypeArguments"}) @Nullable @Override public GridTuple<V> peek0(boolean failFast, GridCachePeekMode mode, IgnitePredicate<GridCacheEntry<K, V>>[] filter, @Nullable GridCacheTxEx<K, V> tx) - throws GridCacheEntryRemovedException, GridCacheFilterFailedException, GridException { + throws GridCacheEntryRemovedException, GridCacheFilterFailedException, IgniteCheckedException { assert tx == null || tx.local(); long topVer = tx != null ? tx.topologyVersion() : cctx.affinity().affinityTopologyVersion(); @@ -2596,7 +2596,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> } /** {@inheritDoc} */ - @Override public V poke(V val) throws GridCacheEntryRemovedException, GridException { + @Override public V poke(V val) throws GridCacheEntryRemovedException, IgniteCheckedException { assert val != null; V old; @@ -2637,16 +2637,16 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> * * @param tx Transaction to check. * @throws GridCacheEntryRemovedException If entry is obsolete. - * @throws GridException If entry was externally locked. + * @throws IgniteCheckedException If entry was externally locked. */ - private void groupLockSanityCheck(GridCacheTxEx<K, V> tx) throws GridCacheEntryRemovedException, GridException { + private void groupLockSanityCheck(GridCacheTxEx<K, V> tx) throws GridCacheEntryRemovedException, IgniteCheckedException { assert tx.groupLock(); GridCacheTxEntry<K, V> txEntry = tx.entry(txKey()); if (txEntry.groupLockEntry()) { if (lockedByAny()) - throw new GridException("Failed to update cache entry (entry was externally locked while " + + throw new IgniteCheckedException("Failed to update cache entry (entry was externally locked while " + "accessing entry within group lock transaction) [entry=" + this + ", tx=" + tx + ']'); } } @@ -2658,10 +2658,10 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> * @return Peeked value. * @throws GridCacheFilterFailedException If filter failed. * @throws GridCacheEntryRemovedException If entry got removed. - * @throws GridException If unexpected cache failure occurred. + * @throws IgniteCheckedException If unexpected cache failure occurred. */ @Nullable private GridTuple<V> peekTxThenGlobal(boolean failFast, IgnitePredicate<GridCacheEntry<K, V>>[] filter, - GridCacheTxEx<K, V> tx) throws GridCacheFilterFailedException, GridCacheEntryRemovedException, GridException { + GridCacheTxEx<K, V> tx) throws GridCacheFilterFailedException, GridCacheEntryRemovedException, IgniteCheckedException { GridTuple<V> peek = peekTx(failFast, filter, tx); // If transaction has value (possibly null, which means value is to be deleted). @@ -2693,12 +2693,12 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> * @return Peeked value. * @throws GridCacheFilterFailedException If filter failed. * @throws GridCacheEntryRemovedException If entry got removed. - * @throws GridException If unexpected cache failure occurred. + * @throws IgniteCheckedException If unexpected cache failure occurred. */ @SuppressWarnings({"RedundantTypeArguments"}) @Nullable private GridTuple<V> peekGlobal(boolean failFast, long topVer, IgnitePredicate<GridCacheEntry<K, V>>[] filter) - throws GridCacheEntryRemovedException, GridCacheFilterFailedException, GridException { + throws GridCacheEntryRemovedException, GridCacheFilterFailedException, IgniteCheckedException { if (!valid(topVer)) return null; @@ -2742,12 +2742,12 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> * @param failFast Fail fast flag. * @param filter Filter. * @return Value from swap storage. - * @throws GridException In case of any errors. + * @throws IgniteCheckedException In case of any errors. * @throws GridCacheFilterFailedException If filter failed. */ @SuppressWarnings({"unchecked"}) @Nullable private GridTuple<V> peekSwap(boolean failFast, IgnitePredicate<GridCacheEntry<K, V>>[] filter) - throws GridException, GridCacheFilterFailedException { + throws IgniteCheckedException, GridCacheFilterFailedException { if (!cctx.isAll(wrap(false), filter)) return F.t((V)CU.failed(failFast)); @@ -2765,12 +2765,12 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> * @param failFast Fail fast flag. * @param filter Filter. * @return Value from persistent store. - * @throws GridException In case of any errors. + * @throws IgniteCheckedException In case of any errors. * @throws GridCacheFilterFailedException If filter failed. */ @SuppressWarnings({"unchecked"}) @Nullable private V peekDb(boolean failFast, IgnitePredicate<GridCacheEntry<K, V>>[] filter) - throws GridException, GridCacheFilterFailedException { + throws IgniteCheckedException, GridCacheFilterFailedException { if (!cctx.isAll(wrap(false), filter)) return CU.failed(failFast); @@ -2786,9 +2786,9 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> * TODO: GG-4009: do we need to generate event and invalidate value? * * @return {@code true} if expired. - * @throws GridException In case of failure. + * @throws IgniteCheckedException In case of failure. */ - private boolean checkExpired() throws GridException { + private boolean checkExpired() throws IgniteCheckedException { assert Thread.holdsLock(this); long expireTime = expireTimeExtras(); @@ -2819,16 +2819,16 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> } /** {@inheritDoc} */ - @Nullable @Override public synchronized V rawGetOrUnmarshal(boolean tmp) throws GridException { + @Nullable @Override public synchronized V rawGetOrUnmarshal(boolean tmp) throws IgniteCheckedException { return rawGetOrUnmarshalUnlocked(tmp); } /** * @param tmp If {@code true} can return temporary instance. * @return Value (unmarshalled if needed). - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - @Nullable public V rawGetOrUnmarshalUnlocked(boolean tmp) throws GridException { + @Nullable public V rawGetOrUnmarshalUnlocked(boolean tmp) throws IgniteCheckedException { assert Thread.holdsLock(this); V val = this.val; @@ -2864,7 +2864,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> /** {@inheritDoc} */ /* - @Override public synchronized GridDrEntry<K, V> drEntry() throws GridException { + @Override public synchronized GridDrEntry<K, V> drEntry() throws IgniteCheckedException { return new GridDrPlainEntry<>(key, isStartVersion() ? unswap(true, true) : rawGetOrUnmarshalUnlocked(false), ttlExtras(), expireTimeExtras(), ver.drVersion()); } @@ -2882,7 +2882,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> /** {@inheritDoc} */ @SuppressWarnings({"RedundantTypeArguments"}) @Override public boolean initialValue(V val, byte[] valBytes, GridCacheVersion ver, long ttl, long expireTime, - boolean preload, long topVer, GridDrType drType) throws GridException, GridCacheEntryRemovedException { + boolean preload, long topVer, GridDrType drType) throws IgniteCheckedException, GridCacheEntryRemovedException { if (cctx.isUnmarshalValues() && valBytes != null && val == null && isNewLocked()) val = cctx.marshaller().<V>unmarshal(valBytes, cctx.deploy().globalLoader()); @@ -2933,7 +2933,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> /** {@inheritDoc} */ @Override public synchronized boolean initialValue(K key, GridCacheSwapEntry <V> unswapped) throws - GridException, + IgniteCheckedException, GridCacheEntryRemovedException { checkObsolete(); @@ -2963,7 +2963,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> /** {@inheritDoc} */ @Override public synchronized boolean versionedValue(V val, GridCacheVersion curVer, GridCacheVersion newVer) - throws GridException, GridCacheEntryRemovedException { + throws IgniteCheckedException, GridCacheEntryRemovedException { checkObsolete(); if (curVer == null || curVer.equals(ver)) { @@ -3245,7 +3245,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> } } - catch (GridException e) { + catch (IgniteCheckedException e) { U.error(log, "Failed to clean up expired cache entry: " + this, e); } finally { @@ -3302,7 +3302,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> } /** {@inheritDoc} */ - @Override public byte[] getOrMarshalKeyBytes() throws GridException { + @Override public byte[] getOrMarshalKeyBytes() throws IgniteCheckedException { byte[] bytes = keyBytes(); if (bytes != null) @@ -3326,7 +3326,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> /** {@inheritDoc} */ @Nullable @Override public GridCacheValueBytes valueBytes(@Nullable GridCacheVersion ver) - throws GridException, GridCacheEntryRemovedException { + throws IgniteCheckedException, GridCacheEntryRemovedException { V val = null; GridCacheValueBytes valBytes = GridCacheValueBytes.nil(); @@ -3371,10 +3371,10 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> * @param expireTime Expire time. * @param ver New entry version. * @param prevVal Previous value. - * @throws GridException If update failed. + * @throws IgniteCheckedException If update failed. */ protected void updateIndex(@Nullable V val, @Nullable byte[] valBytes, long expireTime, GridCacheVersion ver, - @Nullable V prevVal) throws GridException { + @Nullable V prevVal) throws IgniteCheckedException { assert Thread.holdsLock(this); assert val != null || valBytes != null : "null values in update index for key: " + key; @@ -3384,7 +3384,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> if (qryMgr != null) qryMgr.store(key, keyBytes, val, valBytes, ver, expireTime); } - catch (GridException e) { + catch (IgniteCheckedException e) { throw new GridCacheIndexUpdateException(e); } } @@ -3393,9 +3393,9 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> * Clears index. * * @param prevVal Previous value (if needed for index update). - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - protected void clearIndex(@Nullable V prevVal) throws GridException { + protected void clearIndex(@Nullable V prevVal) throws IgniteCheckedException { assert Thread.holdsLock(this); try { @@ -3404,7 +3404,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> if (qryMgr != null) qryMgr.remove(key(), keyBytes()); } - catch (GridException e) { + catch (IgniteCheckedException e) { throw new GridCacheIndexUpdateException(e); } } @@ -3414,9 +3414,9 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> * for Mongo caches). If previous value is not required, this method will return {@code null}. * * @return Previous value or {@code null}. - * @throws GridException If failed to retrieve previous value. + * @throws IgniteCheckedException If failed to retrieve previous value. */ - protected V saveValueForIndexUnlocked() throws GridException { + protected V saveValueForIndexUnlocked() throws IgniteCheckedException { assert Thread.holdsLock(this); if (!cctx.cache().isMongoDataCache() && !cctx.cache().isMongoMetaCache()) @@ -3441,7 +3441,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> } /** {@inheritDoc} */ - @Override public GridCacheEntry<K, V> wrapFilterLocked() throws GridException { + @Override public GridCacheEntry<K, V> wrapFilterLocked() throws IgniteCheckedException { return null; } @@ -3452,7 +3452,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> /** {@inheritDoc} */ @Override public boolean evictInternal(boolean swap, GridCacheVersion obsoleteVer, - @Nullable IgnitePredicate<GridCacheEntry<K, V>>[] filter) throws GridException { + @Nullable IgnitePredicate<GridCacheEntry<K, V>>[] filter) throws IgniteCheckedException { boolean marked = false; try { @@ -3467,7 +3467,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> // Write to swap. swap(); } - catch (GridException e) { + catch (IgniteCheckedException e) { U.error(log, "Failed to write entry to swap storage: " + this, e); } } @@ -3510,7 +3510,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> // Write to swap. swap(); } - catch (GridException e) { + catch (IgniteCheckedException e) { U.error(log, "Failed to write entry to swap storage: " + this, e); } } @@ -3547,7 +3547,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> /** {@inheritDoc} */ @Override public GridCacheBatchSwapEntry<K, V> evictInBatchInternal(GridCacheVersion obsoleteVer) - throws GridException { + throws IgniteCheckedException { assert Thread.holdsLock(this); assert cctx.isSwapOrOffheapEnabled(); @@ -3590,9 +3590,9 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> * Create value bytes wrapper from the given object. * * @return Value bytes wrapper. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - private ByteBuffer swapValueBytes() throws GridException { + private ByteBuffer swapValueBytes() throws IgniteCheckedException { assert val != null || valBytes != null || valPtr != 0; if (cctx.offheapTiered() && cctx.portableEnabled()) { @@ -3624,7 +3624,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> if (obsoleteOrDeleted() || (filter != CU.<K, V>empty() && !cctx.isAll(wrap(false), filter))) return false; } - catch (GridException e) { + catch (IgniteCheckedException e) { U.error(log, "An exception was thrown while filter checking.", e); RuntimeException ex = e.getCause(RuntimeException.class); @@ -4063,9 +4063,9 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> /** * @return Value bytes read from offheap. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - private GridCacheValueBytes offheapValueBytes() throws GridException { + private GridCacheValueBytes offheapValueBytes() throws IgniteCheckedException { assert cctx.offheapTiered() && valPtr != 0; long ptr = valPtr; @@ -4088,9 +4088,9 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> /** * @param tmp If {@code true} can return temporary object. * @return Unmarshalled value. - * @throws GridException If unmarshalling failed. + * @throws IgniteCheckedException If unmarshalling failed. */ - private V unmarshalOffheap(boolean tmp) throws GridException { + private V unmarshalOffheap(boolean tmp) throws IgniteCheckedException { assert cctx.offheapTiered() && valPtr != 0; if (cctx.portableEnabled()) http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMessage.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMessage.java index 94d9881..71eac41 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMessage.java @@ -9,9 +9,9 @@ package org.gridgain.grid.kernal.processors.cache; +import org.apache.ignite.*; import org.apache.ignite.lang.*; import org.apache.ignite.marshaller.*; -import org.gridgain.grid.*; import org.gridgain.grid.cache.*; import org.gridgain.grid.kernal.*; import org.gridgain.grid.kernal.managers.deployment.*; @@ -161,10 +161,10 @@ public abstract class GridCacheMessage<K, V> extends GridTcpCommunicationMessage /** * @param filters Predicate filters. * @param ctx Context. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ protected final void prepareFilter(@Nullable IgnitePredicate<GridCacheEntry<K, V>>[] filters, - GridCacheSharedContext<K, V> ctx) throws GridException { + GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException { if (filters != null) for (IgnitePredicate filter : filters) prepareObject(filter, ctx); @@ -173,9 +173,9 @@ public abstract class GridCacheMessage<K, V> extends GridTcpCommunicationMessage /** * @param o Object to prepare for marshalling. * @param ctx Context. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - protected final void prepareObject(@Nullable Object o, GridCacheSharedContext<K, V> ctx) throws GridException { + protected final void prepareObject(@Nullable Object o, GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException { if (!skipPrepare && o != null) { GridDeploymentInfo d = ctx.deploy().globalDeploymentInfo(); @@ -201,10 +201,10 @@ public abstract class GridCacheMessage<K, V> extends GridTcpCommunicationMessage /** * @param col Collection of objects to prepare for marshalling. * @param ctx Cache context. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ protected final void prepareObjects(@Nullable Iterable<?> col, GridCacheSharedContext<K, V> ctx) - throws GridException { + throws IgniteCheckedException { if (col != null) for (Object o : col) prepareObject(o, ctx); @@ -239,9 +239,9 @@ public abstract class GridCacheMessage<K, V> extends GridTcpCommunicationMessage * and is responsible for pre-marshalling state. * * @param ctx Cache context. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws GridException { + public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException { // No-op. } @@ -251,18 +251,18 @@ public abstract class GridCacheMessage<K, V> extends GridTcpCommunicationMessage * * @param ctx Context. * @param ldr Class loader. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws GridException { + public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException { // No-op. } /** * @param info Entry to marshal. * @param ctx Context. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - protected final void marshalInfo(GridCacheEntryInfo<K, V> info, GridCacheSharedContext<K, V> ctx) throws GridException { + protected final void marshalInfo(GridCacheEntryInfo<K, V> info, GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException { assert ctx != null; if (info != null) { @@ -279,10 +279,10 @@ public abstract class GridCacheMessage<K, V> extends GridTcpCommunicationMessage * @param info Entry to unmarshal. * @param ctx Context. * @param ldr Loader. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ protected final void unmarshalInfo(GridCacheEntryInfo<K, V> info, GridCacheContext<K, V> ctx, - ClassLoader ldr) throws GridException { + ClassLoader ldr) throws IgniteCheckedException { assert ldr != null; assert ctx != null; @@ -293,10 +293,10 @@ public abstract class GridCacheMessage<K, V> extends GridTcpCommunicationMessage /** * @param infos Entries to marshal. * @param ctx Context. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ protected final void marshalInfos(Iterable<? extends GridCacheEntryInfo<K, V>> infos, GridCacheSharedContext<K, V> ctx) - throws GridException { + throws IgniteCheckedException { assert ctx != null; if (infos != null) @@ -308,10 +308,10 @@ public abstract class GridCacheMessage<K, V> extends GridTcpCommunicationMessage * @param infos Entries to unmarshal. * @param ctx Context. * @param ldr Loader. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ protected final void unmarshalInfos(Iterable<? extends GridCacheEntryInfo<K, V>> infos, - GridCacheContext<K, V> ctx, ClassLoader ldr) throws GridException { + GridCacheContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException { assert ldr != null; assert ctx != null; @@ -323,10 +323,10 @@ public abstract class GridCacheMessage<K, V> extends GridTcpCommunicationMessage /** * @param txEntries Entries to marshal. * @param ctx Context. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ protected final void marshalTx(Iterable<GridCacheTxEntry<K, V>> txEntries, GridCacheSharedContext<K, V> ctx) - throws GridException { + throws IgniteCheckedException { assert ctx != null; if (txEntries != null) { @@ -346,10 +346,10 @@ public abstract class GridCacheMessage<K, V> extends GridTcpCommunicationMessage * @param txEntries Entries to unmarshal. * @param ctx Context. * @param ldr Loader. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ protected final void unmarshalTx(Iterable<GridCacheTxEntry<K, V>> txEntries, boolean near, - GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws GridException { + GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException { assert ldr != null; assert ctx != null; @@ -363,10 +363,10 @@ public abstract class GridCacheMessage<K, V> extends GridTcpCommunicationMessage * @param filter Collection to marshal. * @param ctx Context. * @return Marshalled collection. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ @Nullable protected final <T> byte[][] marshalFilter(@Nullable IgnitePredicate<GridCacheEntry<K, V>>[] filter, - GridCacheSharedContext<K, V> ctx) throws GridException { + GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException { assert ctx != null; if (filter == null) @@ -391,11 +391,11 @@ public abstract class GridCacheMessage<K, V> extends GridTcpCommunicationMessage * @param ctx Context. * @param ldr Loader. * @return Unmarshalled collection. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ @SuppressWarnings({"unchecked"}) @Nullable protected final <T> IgnitePredicate<GridCacheEntry<K, V>>[] unmarshalFilter( - @Nullable byte[][] byteCol, GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws GridException { + @Nullable byte[][] byteCol, GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException { assert ldr != null; assert ctx != null; @@ -417,10 +417,10 @@ public abstract class GridCacheMessage<K, V> extends GridTcpCommunicationMessage * @param col Values collection to marshal. * @param ctx Context. * @return Marshaled collection. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ @Nullable protected List<GridCacheValueBytes> marshalValuesCollection(@Nullable Collection<?> col, - GridCacheSharedContext<K, V> ctx) throws GridException { + GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException { assert ctx != null; if (col == null) @@ -444,11 +444,11 @@ public abstract class GridCacheMessage<K, V> extends GridTcpCommunicationMessage * @param ctx Context. * @param ldr Loader. * @return Unmarshalled collection. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ @Nullable protected <T> List<T> unmarshalValueBytesCollection(@Nullable Collection<GridCacheValueBytes> byteCol, GridCacheSharedContext<K, V> ctx, ClassLoader ldr) - throws GridException { + throws IgniteCheckedException { assert ldr != null; assert ctx != null; @@ -472,10 +472,10 @@ public abstract class GridCacheMessage<K, V> extends GridTcpCommunicationMessage * @param col Collection to marshal. * @param ctx Context. * @return Marshalled collection. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ @Nullable protected List<byte[]> marshalCollection(@Nullable Collection<?> col, - GridCacheSharedContext<K, V> ctx) throws GridException { + GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException { assert ctx != null; if (col == null) @@ -498,10 +498,10 @@ public abstract class GridCacheMessage<K, V> extends GridTcpCommunicationMessage * @param ctx Context. * @param ldr Loader. * @return Unmarshalled collection. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ @Nullable protected <T> List<T> unmarshalCollection(@Nullable Collection<byte[]> byteCol, - GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws GridException { + GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException { assert ldr != null; assert ctx != null; @@ -522,11 +522,11 @@ public abstract class GridCacheMessage<K, V> extends GridTcpCommunicationMessage * @param map Map to marshal. * @param ctx Context. * @return Marshalled map. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ @SuppressWarnings("TypeMayBeWeakened") // Don't weaken type to clearly see that it's linked hash map. @Nullable protected final LinkedHashMap<byte[], Boolean> marshalBooleanLinkedMap( - @Nullable LinkedHashMap<?, Boolean> map, GridCacheSharedContext<K, V> ctx) throws GridException { + @Nullable LinkedHashMap<?, Boolean> map, GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException { assert ctx != null; if (map == null) @@ -549,10 +549,10 @@ public abstract class GridCacheMessage<K, V> extends GridTcpCommunicationMessage * @param ctx Context. * @param ldr Loader. * @return Unmarshalled map. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ @Nullable protected final <K1> LinkedHashMap<K1, Boolean> unmarshalBooleanLinkedMap( - @Nullable Map<byte[], Boolean> byteMap, GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws GridException { + @Nullable Map<byte[], Boolean> byteMap, GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException { assert ldr != null; assert ctx != null; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMvccManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMvccManager.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMvccManager.java index 41c1c0c..10a953b 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMvccManager.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMvccManager.java @@ -206,14 +206,14 @@ public class GridCacheMvccManager<K, V> extends GridCacheSharedManagerAdapter<K, }; /** {@inheritDoc} */ - @Override protected void start0() throws GridException { + @Override protected void start0() throws IgniteCheckedException { exchLog = cctx.logger(getClass().getName() + ".exchange"); pendingExplicit = GridConcurrentFactory.newMap(); } /** {@inheritDoc} */ - @Override public void onKernalStart0() throws GridException { + @Override public void onKernalStart0() throws IgniteCheckedException { cctx.gridEvents().addLocalEventListener(discoLsnr, EVT_NODE_FAILED, EVT_NODE_LEFT); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCachePartitionExchangeManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCachePartitionExchangeManager.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCachePartitionExchangeManager.java index e087377..a553dd5 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCachePartitionExchangeManager.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCachePartitionExchangeManager.java @@ -9,6 +9,7 @@ package org.gridgain.grid.kernal.processors.cache; +import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.events.*; import org.apache.ignite.lang.*; @@ -146,7 +147,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana }; /** {@inheritDoc} */ - @Override protected void start0() throws GridException { + @Override protected void start0() throws IgniteCheckedException { super.start0(); locExchFut = new GridFutureAdapter<>(cctx.kernalContext()); @@ -178,7 +179,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana } /** {@inheritDoc} */ - @Override protected void onKernalStart0() throws GridException { + @Override protected void onKernalStart0() throws IgniteCheckedException { super.onKernalStart0(); ClusterNode loc = cctx.localNode(); @@ -238,7 +239,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana cacheCtx.preloader().onInitialExchangeComplete(null); } catch (IgniteFutureTimeoutException e) { - GridException err = new GridException("Timed out waiting for exchange future: " + fut, e); + IgniteCheckedException err = new IgniteCheckedException("Timed out waiting for exchange future: " + fut, e); for (GridCacheContext<K, V> cacheCtx : cctx.cacheContexts()) cacheCtx.preloader().onInitialExchangeComplete(err); @@ -427,7 +428,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana sendLocalPartitions(oldest, null); } } - catch (GridException e) { + catch (IgniteCheckedException e) { U.error(log, "Failed to refresh partition map [oldest=" + oldest.id() + ", rmts=" + U.nodeIds(rmts) + ", loc=" + cctx.localNodeId() + ']', e); } @@ -458,10 +459,10 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana /** * @param nodes Nodes. * @return {@code True} if message was sent, {@code false} if node left grid. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ private boolean sendAllPartitions(Collection<? extends ClusterNode> nodes) - throws GridException { + throws IgniteCheckedException { GridDhtPartitionsFullMessage<K, V> m = new GridDhtPartitionsFullMessage<>(null, null, -1); for (GridCacheContext<K, V> cacheCtx : cctx.cacheContexts()) { @@ -481,10 +482,10 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana * @param node Node. * @param id ID. * @return {@code True} if message was sent, {@code false} if node left grid. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ private boolean sendLocalPartitions(ClusterNode node, @Nullable GridDhtPartitionExchangeId id) - throws GridException { + throws IgniteCheckedException { GridDhtPartitionsSingleMessage<K, V> m = new GridDhtPartitionsSingleMessage<>(id, cctx.versions().last()); for (GridCacheContext<K, V> cacheCtx : cctx.cacheContexts()) { @@ -651,7 +652,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana try { sendLocalPartitions(node, msg.exchangeId()); } - catch (GridException e) { + catch (IgniteCheckedException e) { U.error(log, "Failed to send local partition map to node [nodeId=" + node.id() + ", exchId=" + msg.exchangeId() + ']', e); } @@ -850,7 +851,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana catch (GridInterruptedException e) { throw e; } - catch (GridException e) { + catch (IgniteCheckedException e) { U.error(log, "Failed to wait for completion of partition map exchange " + "(preloading will not start): " + exchFut, e); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCachePreloader.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCachePreloader.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCachePreloader.java index f66bd5e..74ddab2 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCachePreloader.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCachePreloader.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.kernal.processors.cache.distributed.dht.preloader.*; import org.jetbrains.annotations.*; @@ -24,9 +24,9 @@ public interface GridCachePreloader<K, V> { /** * Starts preloading. * - * @throws GridException If start failed. + * @throws IgniteCheckedException If start failed. */ - public void start() throws GridException; + public void start() throws IgniteCheckedException; /** * Stops preloading. @@ -36,9 +36,9 @@ public interface GridCachePreloader<K, V> { /** * Kernal start callback. * - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - public void onKernalStart() throws GridException; + public void onKernalStart() throws IgniteCheckedException; /** * Kernal stop callback. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCachePreloaderAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCachePreloaderAdapter.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCachePreloaderAdapter.java index 172d062..e37b54a 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCachePreloaderAdapter.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCachePreloaderAdapter.java @@ -53,7 +53,7 @@ public class GridCachePreloaderAdapter<K, V> implements GridCachePreloader<K, V> } /** {@inheritDoc} */ - @Override public void start() throws GridException { + @Override public void start() throws IgniteCheckedException { // No-op. } @@ -63,7 +63,7 @@ public class GridCachePreloaderAdapter<K, V> implements GridCachePreloader<K, V> } /** {@inheritDoc} */ - @Override public void onKernalStart() throws GridException { + @Override public void onKernalStart() throws IgniteCheckedException { // No-op. } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheProcessor.java index 8f63358..3e557ff 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheProcessor.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheProcessor.java @@ -251,19 +251,19 @@ public class GridCacheProcessor extends GridProcessorAdapter { /** * @param c Grid configuration. * @param cc Configuration to validate. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - private void validate(IgniteConfiguration c, GridCacheConfiguration cc) throws GridException { + private void validate(IgniteConfiguration c, GridCacheConfiguration cc) throws IgniteCheckedException { if (cc.getCacheMode() == REPLICATED) { if (cc.getAffinity() instanceof GridCachePartitionFairAffinity) - throw new GridException("REPLICATED cache can not be started with GridCachePartitionFairAffinity" + + throw new IgniteCheckedException("REPLICATED cache can not be started with GridCachePartitionFairAffinity" + " [cacheName=" + cc.getName() + ']'); if (cc.getAffinity() instanceof GridCacheConsistentHashAffinityFunction) { GridCacheConsistentHashAffinityFunction aff = (GridCacheConsistentHashAffinityFunction)cc.getAffinity(); if (aff.isExcludeNeighbors()) - throw new GridException("For REPLICATED cache flag 'excludeNeighbors' in " + + throw new IgniteCheckedException("For REPLICATED cache flag 'excludeNeighbors' in " + "GridCacheConsistentHashAffinityFunction cannot be set [cacheName=" + cc.getName() + ']'); } @@ -271,7 +271,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { GridCacheRendezvousAffinityFunction aff = (GridCacheRendezvousAffinityFunction)cc.getAffinity(); if (aff.isExcludeNeighbors()) - throw new GridException("For REPLICATED cache flag 'excludeNeighbors' in " + + throw new IgniteCheckedException("For REPLICATED cache flag 'excludeNeighbors' in " + "GridCacheRendezvousAffinityFunction cannot be set [cacheName=" + cc.getName() + ']'); } @@ -305,7 +305,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { if (cfg.isPeerClassLoadingEnabled() && (depMode == PRIVATE || depMode == ISOLATED) && !CU.isSystemCache(cc.getName())) - throw new GridException("Cannot start cache in PRIVATE or ISOLATED deployment mode: " + + throw new IgniteCheckedException("Cannot start cache in PRIVATE or ISOLATED deployment mode: " + ctx.config().getDeploymentMode()); if (!c.getTransactionsConfiguration().isTxSerializableEnabled() && @@ -319,7 +319,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { if (cc.isWriteBehindEnabled()) { if (cc.getStore() == null) - throw new GridException("Cannot enable write-behind cache (cache store is not provided) for cache: " + + throw new IgniteCheckedException("Cannot enable write-behind cache (cache store is not provided) for cache: " + cc.getName()); assertParameter(cc.getWriteBehindBatchSize() > 0, "writeBehindBatchSize > 0"); @@ -328,7 +328,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { assertParameter(cc.getWriteBehindFlushThreadCount() > 0, "writeBehindFlushThreadCount > 0"); if (cc.getWriteBehindFlushSize() == 0 && cc.getWriteBehindFlushFrequency() == 0) - throw new GridException("Cannot set both 'writeBehindFlushFrequency' and " + + throw new IgniteCheckedException("Cannot set both 'writeBehindFlushFrequency' and " + "'writeBehindFlushSize' parameters to 0 for cache: " + cc.getName()); } @@ -383,7 +383,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { if (cc.getMemoryMode() == GridCacheMemoryMode.OFFHEAP_VALUES) { if (cc.isQueryIndexEnabled()) - throw new GridException("Cannot have query indexing enabled while values are stored off-heap. " + + throw new IgniteCheckedException("Cannot have query indexing enabled while values are stored off-heap. " + "You must either disable query indexing or disable off-heap values only flag for cache: " + cc.getName()); } @@ -425,9 +425,9 @@ public class GridCacheProcessor extends GridProcessorAdapter { /** * @param cfg Configuration. * @param objs Extra components. - * @throws GridException If failed to inject. + * @throws IgniteCheckedException If failed to inject. */ - private void prepare(GridCacheConfiguration cfg, Object... objs) throws GridException { + private void prepare(GridCacheConfiguration cfg, Object... objs) throws IgniteCheckedException { prepare(cfg, cfg.getEvictionPolicy(), false); prepare(cfg, cfg.getNearEvictionPolicy(), true); prepare(cfg, cfg.getAffinity(), false); @@ -445,9 +445,9 @@ public class GridCacheProcessor extends GridProcessorAdapter { * @param cfg Cache configuration. * @param rsrc Resource. * @param near Near flag. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - private void prepare(GridCacheConfiguration cfg, @Nullable Object rsrc, boolean near) throws GridException { + private void prepare(GridCacheConfiguration cfg, @Nullable Object rsrc, boolean near) throws IgniteCheckedException { if (rsrc != null) { ctx.resource().injectGeneric(rsrc); @@ -486,7 +486,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { try { ctx.resource().cleanupGeneric(rsrc); } - catch (GridException e) { + catch (IgniteCheckedException e) { U.error(log, "Failed to cleanup resource: " + rsrc, e); } } @@ -494,7 +494,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { /** {@inheritDoc} */ @SuppressWarnings( {"unchecked"}) - @Override public void start() throws GridException { + @Override public void start() throws IgniteCheckedException { if (ctx.config().isDaemon()) return; @@ -667,10 +667,10 @@ public class GridCacheProcessor extends GridProcessorAdapter { String cacheName = cfg.getName(); if (cacheName != null) - throw new GridException("Duplicate cache name found (check configuration and " + + throw new IgniteCheckedException("Duplicate cache name found (check configuration and " + "assign unique name to each cache): " + cacheName); else - throw new GridException("Default cache has already been configured (check configuration and " + + throw new IgniteCheckedException("Default cache has already been configured (check configuration and " + "assign unique name to each cache)."); } @@ -874,7 +874,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { } /** {@inheritDoc} */ - @Override public void addAttributes(Map<String, Object> attrs) throws GridException { + @Override public void addAttributes(Map<String, Object> attrs) throws IgniteCheckedException { if (ctx.isDaemon() || F.isEmpty(ctx.config().getCacheConfiguration())) return; @@ -908,9 +908,9 @@ public class GridCacheProcessor extends GridProcessorAdapter { * * @param cfgs Caches. * @return Maximum detected preload order. - * @throws GridException If validation failed. + * @throws IgniteCheckedException If validation failed. */ - private int validatePreloadOrder(GridCacheConfiguration[] cfgs) throws GridException { + private int validatePreloadOrder(GridCacheConfiguration[] cfgs) throws IgniteCheckedException { int maxOrder = 0; for (GridCacheConfiguration cfg : cfgs) { @@ -918,18 +918,18 @@ public class GridCacheProcessor extends GridProcessorAdapter { if (preloadOrder > 0) { if (cfg.getCacheMode() == LOCAL) - throw new GridException("Preload order set for local cache (fix configuration and restart the " + + throw new IgniteCheckedException("Preload order set for local cache (fix configuration and restart the " + "node): " + cfg.getName()); if (cfg.getPreloadMode() == GridCachePreloadMode.NONE) - throw new GridException("Only caches with SYNC or ASYNC preload mode can be set as preload " + + throw new IgniteCheckedException("Only caches with SYNC or ASYNC preload mode can be set as preload " + "dependency for other caches [cacheName=" + cfg.getName() + ", preloadMode=" + cfg.getPreloadMode() + ", preloadOrder=" + cfg.getPreloadOrder() + ']'); maxOrder = Math.max(maxOrder, preloadOrder); } else if (preloadOrder < 0) - throw new GridException("Preload order cannot be negative for cache (fix configuration and restart " + + throw new IgniteCheckedException("Preload order cannot be negative for cache (fix configuration and restart " + "the node) [cacheName=" + cfg.getName() + ", preloadOrder=" + preloadOrder + ']'); } @@ -998,9 +998,9 @@ public class GridCacheProcessor extends GridProcessorAdapter { * Checks that remote caches has configuration compatible with the local. * * @param rmt Node. - * @throws GridException If check failed. + * @throws IgniteCheckedException If check failed. */ - private void checkCache(ClusterNode rmt) throws GridException { + private void checkCache(ClusterNode rmt) throws IgniteCheckedException { GridCacheAttributes[] rmtAttrs = U.cacheAttributes(rmt); GridCacheAttributes[] locAttrs = U.cacheAttributes(ctx.discovery().localNode()); @@ -1200,10 +1200,10 @@ public class GridCacheProcessor extends GridProcessorAdapter { /** * @param cache Cache. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ @SuppressWarnings("unchecked") - private void onKernalStart(GridCacheAdapter<?, ?> cache) throws GridException { + private void onKernalStart(GridCacheAdapter<?, ?> cache) throws IgniteCheckedException { GridCacheContext<?, ?> ctx = cache.context(); // Start DHT cache as well. @@ -1233,7 +1233,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { /** {@inheritDoc} */ @SuppressWarnings("unchecked") - @Override public void onKernalStart() throws GridException { + @Override public void onKernalStart() throws IgniteCheckedException { if (ctx.config().isDaemon()) return; @@ -1349,7 +1349,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { /** {@inheritDoc} */ @SuppressWarnings("unchecked") - @Override public void stop(boolean cancel) throws GridException { + @Override public void stop(boolean cancel) throws IgniteCheckedException { if (ctx.config().isDaemon()) return; @@ -1454,7 +1454,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { qryMgr.remove(key, keyBytes); } - catch (GridException e) { + catch (IgniteCheckedException e) { U.error(log, "Failed to unmarshal key evicted from swap [swapSpaceName=" + spaceName + ']', e); } } @@ -1664,11 +1664,11 @@ public class GridCacheProcessor extends GridProcessorAdapter { * @param o Cache component. * @param cacheName Cache name. * @param near Near flag. - * @throws GridException If registration failed. + * @throws IgniteCheckedException If registration failed. */ @SuppressWarnings("unchecked") private void registerMbean(Object o, @Nullable String cacheName, boolean near) - throws GridException { + throws IgniteCheckedException { assert o != null; MBeanServer srvr = ctx.config().getMBeanServer(); @@ -1686,7 +1686,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { (Class<Object>)itf); } catch (JMException e) { - throw new GridException("Failed to register MBean for component: " + o, e); + throw new IgniteCheckedException("Failed to register MBean for component: " + o, e); } break; @@ -1797,7 +1797,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { } if (locNode == null) - throw new GridRuntimeException("Local node is not included into affinity nodes for 'LOCAL' cache"); + throw new IgniteException("Local node is not included into affinity nodes for 'LOCAL' cache"); List<List<ClusterNode>> res = new ArrayList<>(partitions()); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheProjectionEx.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheProjectionEx.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheProjectionEx.java index 48ce2a1..d8fbdfe 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheProjectionEx.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheProjectionEx.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.cache.store.*; import org.gridgain.grid.kernal.processors.cache.dr.*; @@ -47,10 +47,10 @@ public interface GridCacheProjectionEx<K, V> extends GridCacheProjection<K, V> { * @param ttl Optional time-to-live. If negative, leaves ttl value unchanged. * @param filter Optional filter. * @return Previous value. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ @Nullable public V put(K key, V val, @Nullable GridCacheEntryEx<K, V> entry, long ttl, - @Nullable IgnitePredicate<GridCacheEntry<K, V>>... filter) throws GridException; + @Nullable IgnitePredicate<GridCacheEntry<K, V>>... filter) throws IgniteCheckedException; /** * Internal method that is called from {@link GridCacheEntryImpl}. @@ -74,10 +74,10 @@ public interface GridCacheProjectionEx<K, V> extends GridCacheProjection<K, V> { * @param ttl Optional time-to-live. If negative, leaves ttl value unchanged. * @param filter Optional filter. * @return Previous value. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ public boolean putx(K key, V val, @Nullable GridCacheEntryEx<K, V> entry, long ttl, - @Nullable IgnitePredicate<GridCacheEntry<K, V>>... filter) throws GridException; + @Nullable IgnitePredicate<GridCacheEntry<K, V>>... filter) throws IgniteCheckedException; /** * Internal method that is called from {@link GridCacheEntryImpl}. @@ -96,20 +96,20 @@ public interface GridCacheProjectionEx<K, V> extends GridCacheProjection<K, V> { * Store DR data. * * @param drMap DR map. - * @throws GridException If put operation failed. + * @throws IgniteCheckedException If put operation failed. * @throws GridCacheFlagException If projection flags validation failed. */ - public void putAllDr(Map<? extends K, GridCacheDrInfo<V>> drMap) throws GridException; + public void putAllDr(Map<? extends K, GridCacheDrInfo<V>> drMap) throws IgniteCheckedException; /** * Store DR data asynchronously. * * @param drMap DR map. * @return Future. - * @throws GridException If put operation failed. + * @throws IgniteCheckedException If put operation failed. * @throws GridCacheFlagException If projection flags validation failed. */ - public IgniteFuture<?> putAllDrAsync(Map<? extends K, GridCacheDrInfo<V>> drMap) throws GridException; + public IgniteFuture<?> putAllDrAsync(Map<? extends K, GridCacheDrInfo<V>> drMap) throws IgniteCheckedException; /** * Internal method that is called from {@link GridCacheEntryImpl}. @@ -130,10 +130,10 @@ public interface GridCacheProjectionEx<K, V> extends GridCacheProjection<K, V> { * @param entry Cached entry. If not provided, equivalent to {GridCacheProjection#put}. * @param filter Optional filter. * @return Previous value. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ @Nullable public V remove(K key, @Nullable GridCacheEntryEx<K, V> entry, - @Nullable IgnitePredicate<GridCacheEntry<K, V>>... filter) throws GridException; + @Nullable IgnitePredicate<GridCacheEntry<K, V>>... filter) throws IgniteCheckedException; /** * Internal method that is called from {@link GridCacheEntryImpl}. @@ -150,20 +150,20 @@ public interface GridCacheProjectionEx<K, V> extends GridCacheProjection<K, V> { * Removes DR data. * * @param drMap DR map. - * @throws GridException If remove failed. + * @throws IgniteCheckedException If remove failed. * @throws GridCacheFlagException If projection flags validation failed. */ - public void removeAllDr(Map<? extends K, GridCacheVersion> drMap) throws GridException; + public void removeAllDr(Map<? extends K, GridCacheVersion> drMap) throws IgniteCheckedException; /** * Removes DR data asynchronously. * * @param drMap DR map. * @return Future. - * @throws GridException If remove failed. + * @throws IgniteCheckedException If remove failed. * @throws GridCacheFlagException If projection flags validation failed. */ - public IgniteFuture<?> removeAllDrAsync(Map<? extends K, GridCacheVersion> drMap) throws GridException; + public IgniteFuture<?> removeAllDrAsync(Map<? extends K, GridCacheVersion> drMap) throws IgniteCheckedException; /** * Internal method that is called from {@link GridCacheEntryImpl}. @@ -172,10 +172,10 @@ public interface GridCacheProjectionEx<K, V> extends GridCacheProjection<K, V> { * @param entry Cached entry. If not provided, equivalent to {GridCacheProjection#put}. * @param filter Optional filter. * @return Previous value. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ public boolean removex(K key, @Nullable GridCacheEntryEx<K, V> entry, - @Nullable IgnitePredicate<GridCacheEntry<K, V>>... filter) throws GridException; + @Nullable IgnitePredicate<GridCacheEntry<K, V>>... filter) throws IgniteCheckedException; /** * Internal method that is called from {@link GridCacheEntryImpl}. @@ -233,10 +233,10 @@ public interface GridCacheProjectionEx<K, V> extends GridCacheProjection<K, V> { * @param newVal Value to be associated with the given key. * @return Object containing actual old value and success flag. * @throws NullPointerException If either key or value are {@code null}. - * @throws GridException If replace operation failed. + * @throws IgniteCheckedException If replace operation failed. * @throws GridCacheFlagException If projection flags validation failed. */ - public GridCacheReturn<V> replacex(K key, V oldVal, V newVal) throws GridException; + public GridCacheReturn<V> replacex(K key, V oldVal, V newVal) throws IgniteCheckedException; /** * Removes given key mapping from cache if one exists and value is equal to the passed in value. @@ -254,10 +254,10 @@ public interface GridCacheProjectionEx<K, V> extends GridCacheProjection<K, V> { * @param val Value to match against currently cached value. * @return Object containing actual old value and success flag. * @throws NullPointerException if the key or value is {@code null}. - * @throws GridException If remove failed. + * @throws IgniteCheckedException If remove failed. * @throws GridCacheFlagException If projection flags validation failed. */ - public GridCacheReturn<V> removex(K key, V val) throws GridException; + public GridCacheReturn<V> removex(K key, V val) throws IgniteCheckedException; /** * Asynchronously removes given key mapping from cache if one exists and value is equal to the passed in value. @@ -289,19 +289,19 @@ public interface GridCacheProjectionEx<K, V> extends GridCacheProjection<K, V> { * @param filter Filter to check prior to getting the value. Note that filter check * together with getting the value is an atomic operation. * @return Value. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ @Nullable public V get(K key, @Nullable GridCacheEntryEx<K, V> entry, boolean deserializePortable, - @Nullable IgnitePredicate<GridCacheEntry<K, V>>... filter) throws GridException; + @Nullable IgnitePredicate<GridCacheEntry<K, V>>... filter) throws IgniteCheckedException; /** * Gets value from cache. Will go to primary node even if this is a backup. * * @param key Key to get value for. * @return Value. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - @Nullable public V getForcePrimary(K key) throws GridException; + @Nullable public V getForcePrimary(K key) throws IgniteCheckedException; /** * Asynchronously gets value from cache. Will go to primary node even if this is a backup. @@ -317,9 +317,9 @@ public interface GridCacheProjectionEx<K, V> extends GridCacheProjection<K, V> { * * @param keys Keys to get values for. * @return Value. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - @Nullable public Map<K, V> getAllOutTx(List<K> keys) throws GridException; + @Nullable public Map<K, V> getAllOutTx(List<K> keys) throws IgniteCheckedException; /** * Asynchronously gets values from cache. Will bypass started transaction, if any, i.e. will not enlist entries